Forráskód Böngészése

+ allow in ISO mode that { ... } and (* ... *) comments are paired, resolves at least partly #37428

git-svn-id: trunk@46903 -
florian 4 éve
szülő
commit
e83d214e98
2 módosított fájl, 24 hozzáadás és 4 törlés
  1. 20 0
      compiler/scanner.pas
  2. 4 4
      tests/webtbs/tw37428.pp

+ 20 - 0
compiler/scanner.pas

@@ -4601,6 +4601,16 @@ type
               inc_comment_level;
             '}' :
               dec_comment_level;
+            '*' :
+              { in iso mode, comments opened by a curly bracket can be closed by asterisk, round bracket }
+              if m_iso in current_settings.modeswitches then
+                begin
+                  readchar;
+                  if c=')' then
+                    dec_comment_level
+                  else
+                    continue;
+                end;
             #10,#13 :
               linebreak;
             #26 :
@@ -4690,6 +4700,16 @@ type
                    else
                     found:=0;
                  end;
+              '}' :
+                { in iso mode, comments opened by asterisk, round bracket can be closed by a curly bracket }
+                if m_iso in current_settings.modeswitches then
+                  begin
+                    dec_comment_level;
+                    if comment_level=0 then
+                      found:=2
+                    else
+                      found:=0;
+                  end;
                '(' :
                  begin
                    if found=4 then

+ 4 - 4
tests/webtbs/tw37428.pp

@@ -1,8 +1,8 @@
 {$mode iso}
-label
-  0;
+{$goto on}
 
 begin
-  0:
-    writeln('ok');
+  writeln{comment*);{}
+  writeln(*comment};(* *)
+  writeln;
 end.