Browse Source

* support of | commented out, doesn't work yet

git-svn-id: trunk@634 -
florian 20 years ago
parent
commit
1f532ee36f
1 changed files with 28 additions and 13 deletions
  1. 28 13
      packages/base/regexpr/regexpr.pp

+ 28 - 13
packages/base/regexpr/regexpr.pp

@@ -1,9 +1,9 @@
 {
 {
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2000 by Florian Klaempfl
-
     This unit implements basic regular expression support
     This unit implements basic regular expression support
 
 
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2000-2005 by Florian Klaempfl
+
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
 
 
@@ -300,25 +300,40 @@ unit regexpr;
                             end;
                             end;
                           inc(currentpos);
                           inc(currentpos);
                        end;
                        end;
+{
                     '|':
                     '|':
                        begin
                        begin
 {$ifdef DEBUG}
 {$ifdef DEBUG}
                           writeln('Creating backtrace entry');
                           writeln('Creating backtrace entry');
 {$endif DEBUG}
 {$endif DEBUG}
-                          inc(currentpos);
-                          if currentpos^=#0 then
+                          while currentpos^='|' do
                             begin
                             begin
-                               error:=true;
-                               exit;
+                              inc(currentpos);
+                              if currentpos^=#0 then
+                                begin
+                                   error:=true;
+                                   exit;
+                                end;
+
+                          doregister(hp2);
+                          hp2^.typ:=ret_charset;
+                          hp2^.chars:=[];
+                          hp2^.elsepath:=next;
+
+                              new(hp);
+                              doregister(hp);
+                              hp^.typ:=ret_backtrace;
+                              hp^.elsepath:=parseregexpr();
+                              hp^.next:=next;
+                              if assigned(chaining) then
+                                chaining^:=hp
+                              else
+                                parseregexpr:=hp;
+                              chaining:=@hp^.elsepath;
                             end;
                             end;
-                          new(hp);
-                          doregister(hp);
-                          hp^.typ:=ret_backtrace;
-                          // hp^.elsepath:=parseregexpr(elsepath);
-                          hp^.next:=@parseregexpr;
-                          parseregexpr:=hp;
                           exit;
                           exit;
                        end;
                        end;
+}
                     ')':
                     ')':
                        exit;
                        exit;
                     '^':
                     '^':