fixed parsing include files without space at end

git-svn-id: trunk@8009 -
This commit is contained in:
mattias 2005-10-31 00:48:23 +00:00
parent 04e8972368
commit 937eb5fe69

View File

@ -204,9 +204,10 @@ type
IfLevel: integer; IfLevel: integer;
KeywordFuncList: TKeyWordFunctionList; KeywordFuncList: TKeyWordFunctionList;
procedure ReadNextToken; procedure ReadNextToken;
function ReturnFromIncludeFileAndIsEnd: boolean;
function ReadIdentifier: string; function ReadIdentifier: string;
function ReadUpperIdentifier: string; function ReadUpperIdentifier: string;
procedure SkipSpace; procedure SkipSpace; inline;
procedure SkipComment; procedure SkipComment;
procedure SkipDelphiComment; procedure SkipDelphiComment;
procedure SkipOldTPComment; procedure SkipOldTPComment;
@ -218,9 +219,9 @@ type
procedure UpdateCleanedSource(SourcePos: integer); procedure UpdateCleanedSource(SourcePos: integer);
function ReturnFromIncludeFile: boolean; function ReturnFromIncludeFile: boolean;
procedure InitKeyWordList; procedure InitKeyWordList;
function DoEndToken: boolean; function DoEndToken: boolean; inline;
function DoDefaultIdentToken: boolean; function DoDefaultIdentToken: boolean; inline;
function DoEndOfInterfaceToken: boolean; function DoEndOfInterfaceToken: boolean; inline;
private private
// directives // directives
FDirectiveName: shortstring; FDirectiveName: shortstring;
@ -872,26 +873,25 @@ begin
Result:=FLinkCount; Result:=FLinkCount;
end; end;
procedure TLinkScanner.ReadNextToken; function TLinkScanner.ReturnFromIncludeFileAndIsEnd: boolean;
begin
function ReturnFromIncludeFileAndCheck: boolean; Result:=false;
begin if not ReturnFromIncludeFile then begin
Result:=false; SrcPos:=SrcLen+1; // make sure SrcPos stands somewhere
if not ReturnFromIncludeFile then begin TokenStart:=SrcPos;
SrcPos:=SrcLen+1; // make sure SrcPos stands somewhere TokenType:=lsttSrcEnd;
TokenStart:=SrcPos; Result:=true;
TokenType:=lsttSrcEnd;
Result:=true;
end;
end; end;
end;
procedure TLinkScanner.ReadNextToken;
var var
c1: char; c1: char;
c2: char; c2: char;
begin begin
// Skip all spaces and comments // Skip all spaces and comments
//DebugLn(' TLinkScanner.ReadNextToken SrcPos=',SrcPos,' SrcLen=',SrcLen,' "',copy(Src,SrcPos,5),'"'); //DebugLn(' TLinkScanner.ReadNextToken SrcPos=',SrcPos,' SrcLen=',SrcLen,' "',copy(Src,SrcPos,5),'"');
if (SrcPos>SrcLen) and ReturnFromIncludeFileAndCheck then exit; if (SrcPos>SrcLen) and ReturnFromIncludeFileAndIsEnd then exit;
c1:=Src[SrcPos]; c1:=Src[SrcPos];
if IsCommentStartChar[c1] or IsSpaceChar[c1] then begin if IsCommentStartChar[c1] or IsSpaceChar[c1] then begin
while true do begin while true do begin
@ -916,7 +916,7 @@ begin
until (SrcPos>SrcLen) or (not (IsSpaceChar[Src[SrcPos]])); until (SrcPos>SrcLen) or (not (IsSpaceChar[Src[SrcPos]]));
end else end else
break; break;
if (SrcPos>SrcLen) and ReturnFromIncludeFileAndCheck then exit; if (SrcPos>SrcLen) and ReturnFromIncludeFileAndIsEnd then exit;
c1:=Src[SrcPos]; c1:=Src[SrcPos];
end; end;
end; end;
@ -1128,7 +1128,7 @@ begin
EndOfInterfaceFound:=true; EndOfInterfaceFound:=true;
EndOfSourceFound:=true; EndOfSourceFound:=true;
break; break;
end else if SrcPos>SrcLen then end else if (SrcPos>SrcLen) and ReturnFromIncludeFileAndIsEnd then
break; break;
LastTokenType:=TokenType; LastTokenType:=TokenType;
until false; until false;