* Patch from Pascal Riekenberg to allow using BOM markers in source files (bug ID 34344)

git-svn-id: trunk@39832 -
This commit is contained in:
michael 2018-09-27 11:16:26 +00:00
parent 8495967fc2
commit 4bb4eb5cca
2 changed files with 14 additions and 0 deletions

View File

@ -4259,6 +4259,13 @@ begin
FCurLine := CurSourceFile.ReadLine;
FTokenStr := PChar(CurLine);
Result := true;
if (FCurRow = 0)
and (Length(CurLine) >= 3)
and (FTokenStr[0] = #$EF)
and (FTokenStr[1] = #$BB)
and (FTokenStr[2] = #$BF) then
// ignore UTF-8 Byte Order Mark
inc(FTokenStr, 3);
Inc(FCurRow);
inc(FModuleRow);
FCurColumnOffset:=1;

View File

@ -244,6 +244,7 @@ type
procedure TestIfError;
Procedure TestModeSwitch;
Procedure TestOperatorIdentifier;
Procedure TestUTF8BOM;
end;
implementation
@ -1744,6 +1745,12 @@ begin
TestToken(tkidentifier,'operator',True);
end;
procedure TTestScanner.TestUTF8BOM;
begin
DoTestToken(tkLineEnding,#$EF+#$BB+#$BF);
end;
initialization
RegisterTests([TTestTokenFinder,TTestStreamLineReader,TTestScanner]);
end.