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

View File

@ -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.