* Trim content of directives

git-svn-id: trunk@45459 -
This commit is contained in:
michael 2020-05-22 05:49:59 +00:00
parent d2d2904d78
commit 4dcae91474
2 changed files with 13 additions and 0 deletions

View File

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

View File

@ -249,6 +249,7 @@ type
Procedure TestModeSwitch; Procedure TestModeSwitch;
Procedure TestOperatorIdentifier; Procedure TestOperatorIdentifier;
Procedure TestUTF8BOM; Procedure TestUTF8BOM;
Procedure TestBooleanSwitch;
end; end;
implementation implementation
@ -1771,6 +1772,16 @@ begin
DoTestToken(tkLineEnding,#$EF+#$BB+#$BF); DoTestToken(tkLineEnding,#$EF+#$BB+#$BF);
end; 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 initialization
RegisterTests([TTestTokenFinder,TTestStreamLineReader,TTestScanner]); RegisterTests([TTestTokenFinder,TTestStreamLineReader,TTestScanner]);
end. end.