Sfoglia il codice sorgente

* Merging revisions r45459 from trunk:
------------------------------------------------------------------------
r45459 | michael | 2020-05-22 07:49:59 +0200 (Fri, 22 May 2020) | 1 line

* Trim content of directives
------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@46648 -

michael 5 anni fa
parent
commit
276b6873b2

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

@@ -3970,6 +3970,7 @@ begin
     if not Handled then
       begin
       Handled:=true;
+      Param:=Trim(Param);
       Case UpperCase(Directive) of
         'ASSERTIONS':
           DoBoolDirective(bsAssertions);
@@ -4084,6 +4085,7 @@ procedure TPascalScanner.HandleBoolDirective(bs: TBoolSwitch;
   const Param: String);
 var
   NewValue: Boolean;
+  
 begin
   if CompareText(Param,'on')=0 then
     NewValue:=true

+ 11 - 0
packages/fcl-passrc/tests/tcscanner.pas

@@ -249,6 +249,7 @@ type
     Procedure TestModeSwitch;
     Procedure TestOperatorIdentifier;
     Procedure TestUTF8BOM;
+    Procedure TestBooleanSwitch;
   end;
 
 implementation
@@ -1771,6 +1772,16 @@ begin
   DoTestToken(tkLineEnding,#$EF+#$BB+#$BF);
 end;
 
+Procedure TTestScanner.TestBooleanSwitch;
+
+begin
+  Scanner.CurrentBoolSwitches:=[bsHints];
+  // end space intentional.
+  NewSource('{$HINTS OFF }');
+  While not (Scanner.FetchToken=tkEOF) do;
+  AssertFalse('Hints off',bshints in Scanner.CurrentBoolSwitches);
+end;
+
 initialization
   RegisterTests([TTestTokenFinder,TTestStreamLineReader,TTestScanner]);
 end.