From e097dc36e55ddcb29cfedb68251e885b552a72fd Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 14 Mar 2008 12:28:29 +0000 Subject: [PATCH] codetools: c parser: fixed variable name start-end pos git-svn-id: trunk@14519 - --- components/codetools/ccodeparsertool.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/codetools/ccodeparsertool.pas b/components/codetools/ccodeparsertool.pas index 45e5ba3a9c..e368d9724e 100644 --- a/components/codetools/ccodeparsertool.pas +++ b/components/codetools/ccodeparsertool.pas @@ -600,8 +600,6 @@ begin if AtomIs('const') then ReadNextAtom; - CreateChildNode(ccnVariableName); - // prefixes: signed, unsigned // prefixes and/or names long, short @@ -625,13 +623,16 @@ begin // read name ReadNextAtom; + CreateChildNode(ccnVariableName); if AtomIs('operator') then begin IsFunction:=true; // read operator ReadNextAtom; + CurNode.StartPos:=AtomStart; if not IsCCodeCustomOperator.DoItCaseSensitive(Src,AtomStart,SrcPos-AtomStart) then RaiseExpectedButAtomFound('operator'); + CurNode.EndPos:=SrcPos; end else if AtomIsChar('(') then begin // example: int (*fp)(char*); // pointer to function taking a char* argument; returns an int @@ -643,8 +644,10 @@ begin {$IFDEF VerboseCCodeParser} DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]); {$ENDIF} + CurNode.StartPos:=AtomStart; if not AtomIsIdentifier then RaiseExpectedButAtomFound('identifier'); + CurNode.EndPos:=SrcPos; ReadNextAtom; if not AtomIsChar(')') then RaiseExpectedButAtomFound(')'); @@ -657,8 +660,10 @@ begin {$IFDEF VerboseCCodeParser} DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]); {$ENDIF} + CurNode.StartPos:=AtomStart; if not AtomIsIdentifier then RaiseExpectedButAtomFound('identifier'); + CurNode.EndPos:=SrcPos; end; EndChildNode;