mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 04:59:26 +02:00
* 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:
parent
8495967fc2
commit
4bb4eb5cca
@ -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;
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user