mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-08 07:37:27 +01:00
codetools: implemented parsing on Exception do, bug #9291
git-svn-id: trunk@13702 -
This commit is contained in:
parent
a492b69611
commit
91f054ad10
@ -2478,6 +2478,10 @@ end;
|
|||||||
|
|
||||||
function TPascalParserTool.ReadOnStatement(ExceptionOnError,
|
function TPascalParserTool.ReadOnStatement(ExceptionOnError,
|
||||||
CreateNodes: boolean): boolean;
|
CreateNodes: boolean): boolean;
|
||||||
|
// for example:
|
||||||
|
// on E: Exception do ;
|
||||||
|
// on Exception do ;
|
||||||
|
// on Unit.Exception do ;
|
||||||
begin
|
begin
|
||||||
if CreateNodes then begin
|
if CreateNodes then begin
|
||||||
CreateChildNode;
|
CreateChildNode;
|
||||||
@ -2487,34 +2491,43 @@ begin
|
|||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
AtomIsIdentifier(true);
|
AtomIsIdentifier(true);
|
||||||
if CreateNodes then begin
|
if CreateNodes then begin
|
||||||
// ctnOnIdentifier for the variable
|
// ctnOnIdentifier for the variable or the type
|
||||||
CreateChildNode;
|
CreateChildNode;
|
||||||
CurNode.Desc:=ctnOnIdentifier;
|
CurNode.Desc:=ctnOnIdentifier;
|
||||||
CurNode.EndPos:=CurPos.EndPos;
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
EndChildNode;
|
|
||||||
end;
|
|
||||||
// read :
|
|
||||||
ReadNextAtom;
|
|
||||||
if CurPos.Flag<>cafColon then
|
|
||||||
RaiseCharExpectedButAtomFound(':');
|
|
||||||
// read type: e.g. Exception, or unit.Exception
|
|
||||||
ReadNextAtom;
|
|
||||||
AtomIsIdentifier(true);
|
|
||||||
if CreateNodes then begin
|
|
||||||
// ctnOnIdentifier for the type
|
|
||||||
CreateChildNode;
|
|
||||||
CurNode.Desc:=ctnOnIdentifier;
|
|
||||||
end;
|
end;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if CurPos.Flag=cafPoint then begin
|
if CurPos.Flag=cafColon then begin
|
||||||
|
// this is for example: on E: Exception do ;
|
||||||
|
if CreateNodes then begin
|
||||||
|
// close the variable
|
||||||
|
EndChildNode;
|
||||||
|
end;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
AtomIsIdentifier(true);
|
AtomIsIdentifier(true);
|
||||||
|
if CreateNodes then begin
|
||||||
|
// ctnOnIdentifier for the type
|
||||||
|
CreateChildNode;
|
||||||
|
CurNode.Desc:=ctnOnIdentifier;
|
||||||
|
end;
|
||||||
|
ReadNextAtom;
|
||||||
|
end;
|
||||||
|
if CurPos.Flag=cafPoint then begin
|
||||||
|
// this is for example: on Unit.Exception do ;
|
||||||
|
ReadNextAtom;
|
||||||
|
AtomIsIdentifier(true);
|
||||||
|
if CreateNodes then begin
|
||||||
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
|
end;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
end;
|
end;
|
||||||
if CreateNodes then begin
|
if CreateNodes then begin
|
||||||
CurNode.EndPos:=CurPos.StartPos;
|
// close the type
|
||||||
EndChildNode;
|
EndChildNode;
|
||||||
end;
|
end;
|
||||||
|
// read 'do'
|
||||||
|
if not UpAtomIs('DO') then
|
||||||
|
RaiseStringExpectedButAtomFound('DO');
|
||||||
// ctnOnStatement
|
// ctnOnStatement
|
||||||
if CreateNodes then begin
|
if CreateNodes then begin
|
||||||
CreateChildNode;
|
CreateChildNode;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user