mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 09:12: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);
|
ReadDefinition(false);
|
||||||
if CurNode.LastChild.Desc<>ccnFunction then begin
|
if CurNode.LastChild.Desc<>ccnFunction then begin
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
debugln(['TCCodeParserTool.OtherToken ',GetAtom,' SrcPos=',SrcPos,' AtomStart=',AtomStart,' SrcLen=',SrcLen]);
|
||||||
if not AtomIsChar(';') then
|
if not AtomIsChar(';') then
|
||||||
RaiseExpectedButAtomFound(';');
|
RaiseExpectedButAtomFound(';');
|
||||||
|
debugln(['TCCodeParserTool.OtherToken AAA1']);
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
RaiseException('unexpected token '+GetAtom);
|
RaiseException('unexpected token '+GetAtom);
|
||||||
@ -1863,7 +1865,7 @@ end;
|
|||||||
function TCCodeParserTool.AtomIsChar(const c: char): boolean;
|
function TCCodeParserTool.AtomIsChar(const c: char): boolean;
|
||||||
begin
|
begin
|
||||||
if SrcPos-AtomStart<>1 then exit(false);
|
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);
|
if Src[AtomStart]<>c then exit(false);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
@ -124,7 +124,13 @@ begin
|
|||||||
try
|
try
|
||||||
Header1:=CodeToolBoss.CreateFile('header1.h');
|
Header1:=CodeToolBoss.CreateFile('header1.h');
|
||||||
PasCode:=CodeToolBoss.CreateFile('header1.pas');
|
PasCode:=CodeToolBoss.CreateFile('header1.pas');
|
||||||
|
Header1.Source:='int i;';
|
||||||
|
Tool.Convert(Header1,PasCode);
|
||||||
|
Tool.WriteH2PNodeReport;
|
||||||
|
Tool.WriteH2PDirectivesNodeReport;
|
||||||
|
writeln;
|
||||||
|
writeln('=============================================');
|
||||||
|
writeln(PasCode.Source);
|
||||||
finally
|
finally
|
||||||
Tool.Free;
|
Tool.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user