Pārlūkot izejas kodu

* fixed some corner cases when parsing nested (* *) comments (mantis #15293)

git-svn-id: trunk@14412 -
Jonas Maebe 15 gadi atpakaļ
vecāks
revīzija
76c499a0f6
4 mainītis faili ar 20 papildinājumiem un 2 dzēšanām
  1. 2 0
      .gitattributes
  2. 9 2
      compiler/scanner.pas
  3. 5 0
      tests/webtbs/tw15293.pp
  4. 4 0
      tests/webtbs/tw15293a.pp

+ 2 - 0
.gitattributes

@@ -10132,6 +10132,8 @@ tests/webtbs/tw15088.pp svneol=native#text/plain
 tests/webtbs/tw15169.pp svneol=native#text/plain
 tests/webtbs/tw15207.pp svneol=native#text/plain
 tests/webtbs/tw15274.pp svneol=native#text/plain
+tests/webtbs/tw15293.pp svneol=native#text/plain
+tests/webtbs/tw15293a.pp svneol=native#text/plain
 tests/webtbs/tw15304.pp svneol=native#text/plain
 tests/webtbs/tw1532.pp svneol=native#text/plain
 tests/webtbs/tw1539.pp svneol=native#text/plain

+ 9 - 2
compiler/scanner.pas

@@ -3253,7 +3253,12 @@ In case not, the value returned can be arbitrary.
                    continue;
                  end;
                #10,#13 :
-                 linebreak;
+                 begin
+                   if found=4 then
+                    inc_comment_level;
+                   linebreak;
+                   found:=0;
+                 end;
                '*' :
                  begin
                    if found=3 then
@@ -3270,7 +3275,9 @@ In case not, the value returned can be arbitrary.
                        found:=2
                       else
                        found:=0;
-                    end;
+                    end
+                   else
+                    found:=0;
                  end;
                '(' :
                  begin

+ 5 - 0
tests/webtbs/tw15293.pp

@@ -0,0 +1,5 @@
+{ %norun }
+
+begin
+(* ()* *)
+end.

+ 4 - 0
tests/webtbs/tw15293a.pp

@@ -0,0 +1,4 @@
+begin
+  (*(*
+*)*)
+end.