Browse Source

* Fix bug #31720

git-svn-id: trunk@36181 -
michael 8 years ago
parent
commit
a5ae6778e3
2 changed files with 23 additions and 0 deletions
  1. 11 0
      packages/fcl-passrc/src/pscanner.pp
  2. 12 0
      packages/fcl-passrc/tests/tcstatements.pas

+ 11 - 0
packages/fcl-passrc/src/pscanner.pp

@@ -2870,6 +2870,8 @@ var
   TokenStart: PChar;
   i: TToken;
   OldLength, SectionLength, NestingLevel, Index: Integer;
+
+
 begin
   result:=tkLineEnding;
   if TokenStr = nil then
@@ -3090,6 +3092,15 @@ begin
           SetLength(FCurTokenString, SectionLength);
           if SectionLength > 0 then
             Move(TokenStart^, FCurTokenString[1], SectionLength);
+          // Handle macro which is //
+          if FCurSourceFile is TMacroReader then
+            begin
+            // exhaust till eof of macro stream
+            Repeat
+              I:=Fetchtoken;
+            until (i<>tkLineEnding);
+            FetchLine;
+            end;
           Result := tkComment;
           end
         else if (po_CAssignments in options) then

+ 12 - 0
packages/fcl-passrc/tests/tcstatements.pas

@@ -118,6 +118,7 @@ Type
     Procedure TestGotoInIfThen;
     procedure AssignToAddress;
     procedure FinalizationNoSemicolon;
+    procedure MacroComment;
   end;
 
 
@@ -1718,6 +1719,17 @@ begin
   ParseModule;
 end;
 
+procedure TTestStatementParser.MacroComment;
+begin
+  AddStatements(['{$MACRO ON}',
+  '{$DEFINE func := //}',
+  '  calltest;',
+  '  func (''1'',''2'',''3'');',
+  'CallTest2;',
+  'end.']);
+  ParseModule;
+end;
+
 Procedure TTestStatementParser.TestGotoInIfThen;
 
 begin