mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-31 19:06:09 +02:00
* Patch from Graeme Geldenhuys (bug 17237) extending scanner to report EOL and TAB
git-svn-id: trunk@15877 -
This commit is contained in:
parent
700f687692
commit
a848b6fde2
@ -92,16 +92,18 @@ uses Classes;
|
||||
var
|
||||
IsIdentStart: array[char] of boolean;
|
||||
|
||||
type
|
||||
const
|
||||
WhitespaceTokensToIgnore = [tkWhitespace, tkComment, tkLineEnding, tkTab];
|
||||
|
||||
type
|
||||
TDeclType = (declNone, declConst, declResourcestring, declType, declVar, declThreadvar, declProperty);
|
||||
|
||||
TProcType = (ptProcedure, ptFunction, ptOperator, ptConstructor, ptDestructor,
|
||||
ptClassProcedure, ptClassFunction);
|
||||
|
||||
|
||||
TExprKind = (ek_Normal, ek_PropertyIndex);
|
||||
|
||||
TExprKind = (ek_Normal, ek_PropertyIndex);
|
||||
|
||||
{ TPasParser }
|
||||
|
||||
TPasParser = class
|
||||
@ -291,7 +293,7 @@ begin
|
||||
try
|
||||
repeat
|
||||
FCurToken := Scanner.FetchToken;
|
||||
until not (FCurToken in [tkWhitespace, tkComment]);
|
||||
until not (FCurToken in WhitespaceTokensToIgnore);
|
||||
except
|
||||
on e: EScannerError do
|
||||
raise EParserError.Create(e.Message,
|
||||
|
@ -138,7 +138,10 @@ type
|
||||
tkvar,
|
||||
tkwhile,
|
||||
tkwith,
|
||||
tkxor);
|
||||
tkxor,
|
||||
tkLineEnding,
|
||||
tkTab
|
||||
);
|
||||
|
||||
TLineReader = class
|
||||
public
|
||||
@ -339,7 +342,9 @@ const
|
||||
'var',
|
||||
'while',
|
||||
'with',
|
||||
'xor'
|
||||
'xor',
|
||||
'LineEnding',
|
||||
'Tab'
|
||||
);
|
||||
|
||||
function FilenameIsAbsolute(const TheFilename: string):boolean;
|
||||
@ -675,9 +680,9 @@ begin
|
||||
#0: // Empty line
|
||||
begin
|
||||
FetchLine;
|
||||
Result := tkWhitespace;
|
||||
Result := tkLineEnding;
|
||||
end;
|
||||
#9, ' ':
|
||||
' ':
|
||||
begin
|
||||
Result := tkWhitespace;
|
||||
repeat
|
||||
@ -688,7 +693,20 @@ begin
|
||||
FCurToken := Result;
|
||||
exit;
|
||||
end;
|
||||
until not (TokenStr[0] in [#9, ' ']);
|
||||
until not (TokenStr[0] in [' ']);
|
||||
end;
|
||||
#9:
|
||||
begin
|
||||
Result := tkTab;
|
||||
repeat
|
||||
Inc(TokenStr);
|
||||
if TokenStr[0] = #0 then
|
||||
if not FetchLine then
|
||||
begin
|
||||
FCurToken := Result;
|
||||
exit;
|
||||
end;
|
||||
until not (TokenStr[0] in [#9]);
|
||||
end;
|
||||
'#', '''':
|
||||
Result:=DoFetchTextToken;
|
||||
|
Loading…
Reference in New Issue
Block a user