codetools: c parser: fixed variable name start-end pos

git-svn-id: trunk@14519 -
This commit is contained in:
mattias 2008-03-14 12:28:29 +00:00
parent 0ab8d02996
commit e097dc36e5

View File

@ -600,8 +600,6 @@ begin
if AtomIs('const') then ReadNextAtom; if AtomIs('const') then ReadNextAtom;
CreateChildNode(ccnVariableName);
// prefixes: signed, unsigned // prefixes: signed, unsigned
// prefixes and/or names long, short // prefixes and/or names long, short
@ -625,13 +623,16 @@ begin
// read name // read name
ReadNextAtom; ReadNextAtom;
CreateChildNode(ccnVariableName);
if AtomIs('operator') then begin if AtomIs('operator') then begin
IsFunction:=true; IsFunction:=true;
// read operator // read operator
ReadNextAtom; ReadNextAtom;
CurNode.StartPos:=AtomStart;
if not IsCCodeCustomOperator.DoItCaseSensitive(Src,AtomStart,SrcPos-AtomStart) if not IsCCodeCustomOperator.DoItCaseSensitive(Src,AtomStart,SrcPos-AtomStart)
then then
RaiseExpectedButAtomFound('operator'); RaiseExpectedButAtomFound('operator');
CurNode.EndPos:=SrcPos;
end else if AtomIsChar('(') then begin end else if AtomIsChar('(') then begin
// example: int (*fp)(char*); // example: int (*fp)(char*);
// pointer to function taking a char* argument; returns an int // pointer to function taking a char* argument; returns an int
@ -643,8 +644,10 @@ begin
{$IFDEF VerboseCCodeParser} {$IFDEF VerboseCCodeParser}
DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]); DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]);
{$ENDIF} {$ENDIF}
CurNode.StartPos:=AtomStart;
if not AtomIsIdentifier then if not AtomIsIdentifier then
RaiseExpectedButAtomFound('identifier'); RaiseExpectedButAtomFound('identifier');
CurNode.EndPos:=SrcPos;
ReadNextAtom; ReadNextAtom;
if not AtomIsChar(')') then if not AtomIsChar(')') then
RaiseExpectedButAtomFound(')'); RaiseExpectedButAtomFound(')');
@ -657,8 +660,10 @@ begin
{$IFDEF VerboseCCodeParser} {$IFDEF VerboseCCodeParser}
DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]); DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]);
{$ENDIF} {$ENDIF}
CurNode.StartPos:=AtomStart;
if not AtomIsIdentifier then if not AtomIsIdentifier then
RaiseExpectedButAtomFound('identifier'); RaiseExpectedButAtomFound('identifier');
CurNode.EndPos:=SrcPos;
end; end;
EndChildNode; EndChildNode;