mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-30 06:42:49 +02:00
codetools: c parser: fixed parsing at end of code
git-svn-id: trunk@31299 -
This commit is contained in:
parent
e6ada195c2
commit
a7b67263cd
@ -835,8 +835,10 @@ begin
|
||||
ReadDefinition(false);
|
||||
if CurNode.LastChild.Desc<>ccnFunction then begin
|
||||
ReadNextAtom;
|
||||
debugln(['TCCodeParserTool.OtherToken ',GetAtom,' SrcPos=',SrcPos,' AtomStart=',AtomStart,' SrcLen=',SrcLen]);
|
||||
if not AtomIsChar(';') then
|
||||
RaiseExpectedButAtomFound(';');
|
||||
debugln(['TCCodeParserTool.OtherToken AAA1']);
|
||||
end;
|
||||
end else
|
||||
RaiseException('unexpected token '+GetAtom);
|
||||
@ -1863,7 +1865,7 @@ end;
|
||||
function TCCodeParserTool.AtomIsChar(const c: char): boolean;
|
||||
begin
|
||||
if SrcPos-AtomStart<>1 then exit(false);
|
||||
if SrcPos>SrcLen then exit(false);
|
||||
if AtomStart>SrcLen then exit(false);
|
||||
if Src[AtomStart]<>c then exit(false);
|
||||
Result:=true;
|
||||
end;
|
||||
|
@ -124,7 +124,13 @@ begin
|
||||
try
|
||||
Header1:=CodeToolBoss.CreateFile('header1.h');
|
||||
PasCode:=CodeToolBoss.CreateFile('header1.pas');
|
||||
|
||||
Header1.Source:='int i;';
|
||||
Tool.Convert(Header1,PasCode);
|
||||
Tool.WriteH2PNodeReport;
|
||||
Tool.WriteH2PDirectivesNodeReport;
|
||||
writeln;
|
||||
writeln('=============================================');
|
||||
writeln(PasCode.Source);
|
||||
finally
|
||||
Tool.Free;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user