From cf32ea0df94d1e204d6082aec2d7be7465f9bffb Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 21 Jun 2011 14:21:47 +0000 Subject: [PATCH] codetools: parsing on E:Exception do: using ctnVarDefinition, bug #19601 git-svn-id: trunk@31317 - --- components/codetools/codetree.pas | 4 ++-- components/codetools/pascalparsertool.pas | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/components/codetools/codetree.pas b/components/codetools/codetree.pas index 631298d441..f5ecd89bde 100644 --- a/components/codetools/codetree.pas +++ b/components/codetools/codetree.pas @@ -142,8 +142,8 @@ const ctnWithVariable =110; ctnWithStatement =111; - ctnOnBlock =112; - ctnOnIdentifier =113;// e.g. on E: Exception + ctnOnBlock =112;// childs: ctnOnIdentifier+ctnOnStatement, or ctnVarDefinition(with child ctnIdentifier)+ctnOnStatement + ctnOnIdentifier =113;// e.g. 'on Exception', Note: on E:Exception creates a ctnVarDefinition ctnOnStatement =114; // combined values diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 2955af1318..5534be220f 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -2963,21 +2963,21 @@ begin ReadNextAtom; if CurPos.Flag=cafColon then begin // this is for example: on E: Exception do ; - if CreateNodes then begin - // close the variable - EndChildNode; - end; + if CreateNodes then + CurNode.Desc:=ctnVarDefinition; ReadNextAtom; AtomIsIdentifier(true); if CreateNodes then begin - // ctnOnIdentifier for the type + // ctnIdentifier for the type CreateChildNode; - CurNode.Desc:=ctnOnIdentifier; + CurNode.Desc:=ctnIdentifier; + CurNode.EndPos:=CurPos.EndPos; end; ReadNextAtom; end; if CurPos.Flag=cafPoint then begin - // this is for example: on Unit.Exception do ; + // for example: on Unit.Exception do ; + // or: on E:Unit.Exception do ; ReadNextAtom; AtomIsIdentifier(true); if CreateNodes then begin @@ -2986,7 +2986,12 @@ begin ReadNextAtom; end; if CreateNodes then begin - // close the type + if CurNode.Desc=ctnIdentifier then begin + // close the type + CurNode.Parent.EndPos:=CurNode.EndPos; + EndChildNode; + end; + // close ctnVarDefinition or ctnOnIdentifier EndChildNode; end; // read 'do'