From b09a26670a5cba6e89dba3e16364645b10783257 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 23 Jan 2012 18:07:14 +0000 Subject: [PATCH] codetools: FindProcNode: read name of a class operator git-svn-id: trunk@34887 - --- components/codetools/methodjumptool.pas | 4 ++-- components/codetools/pascalparsertool.pas | 6 +++--- components/codetools/pascalreadertool.pas | 14 ++++++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/components/codetools/methodjumptool.pas b/components/codetools/methodjumptool.pas index b85de7ab5e..cce266bec7 100644 --- a/components/codetools/methodjumptool.pas +++ b/components/codetools/methodjumptool.pas @@ -346,7 +346,7 @@ begin // find CodeTreeNode at cursor CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true); {$IFDEF CTDEBUG} - DebugLn('TMethodJumpingCodeTool.FindJumpPoint C ',NodeDescriptionAsString(CursorNode.Desc)); + DebugLn('TMethodJumpingCodeTool.FindJumpPoint CursorNode=',CursorNode.DescAsString); {$ENDIF} // first test if in a class ClassNode:=CursorNode.GetNodeOfTypes([ctnClass,ctnClassInterface, @@ -359,7 +359,7 @@ begin // and then jumping is a nide feature // => search in all implemented class procedures for the body {$IFDEF CTDEBUG} - DebugLn('TMethodJumpingCodeTool.FindJumpPoint D ',NodeDescriptionAsString(ClassNode.Desc)); + DebugLn('TMethodJumpingCodeTool.FindJumpPoint ClasNode=',ClassNode.DescAsString); {$ENDIF} if (ClassNode.SubDesc and ctnsForwardDeclaration)>0 then exit; // parse class and build CodeTreeNodes for all properties/methods diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index a9391fb0d8..b4b6fb2c2e 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -1158,8 +1158,8 @@ begin end; end; // read procedure head - IsOperator:=UpAtomIs('OPERATOR'); IsFunction:=UpAtomIs('FUNCTION'); + IsOperator:=(not IsFunction) and UpAtomIs('OPERATOR'); // read name ReadNextAtom; if (not IsOperator) @@ -2560,8 +2560,8 @@ begin if CurSection=ctnInterface then ProcNode.SubDesc:=ctnsForwardDeclaration; end; - IsOperator:=UpAtomIs('OPERATOR'); IsFunction:=UpAtomIs('FUNCTION'); + IsOperator:=(not IsFunction) and UpAtomIs('OPERATOR'); IsMethod:=False; ReadNextAtom;// read first atom of head (= name/operator + parameterlist + resulttype;) if (not IsOperator) @@ -5300,7 +5300,7 @@ begin if UpAtomIs('CLASS') then ReadNextAtom; IsFunction:=UpAtomIs('FUNCTION'); - IsOperator:=UpAtomIs('OPERATOR'); + IsOperator:=(not IsFunction) and UpAtomIs('OPERATOR'); IsProcType:=ProcNode.Desc=ctnProcedureType; // read procedure head (= [name] + parameterlist + resulttype;) ReadNextAtom;// read first atom of head diff --git a/components/codetools/pascalreadertool.pas b/components/codetools/pascalreadertool.pas index b187c02719..ca3814df06 100644 --- a/components/codetools/pascalreadertool.pas +++ b/components/codetools/pascalreadertool.pas @@ -458,7 +458,9 @@ begin ExtractProcHeadPos:=phepStart; if not IsProcType then begin // read name - if (not IsOperator) and (not AtomIsIdentifier(false)) then exit; + if ((not IsOperator) + or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))) + and (not AtomIsIdentifier(false)) then exit; if TheClassName<>'' then begin s:=TheClassName+'.'; @@ -483,7 +485,9 @@ begin end; if CurPos.Flag<>cafPoint then break; ExtractNextAtom(true,Attr); - if not AtomIsIdentifier(false) then exit; + if ((not IsOperator) + or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))) + and (not AtomIsIdentifier(false)) then exit; until false; end else begin // read only part of name @@ -502,7 +506,9 @@ begin ExtractNextAtom(not (phpWithoutClassName in Attr),Attr); // read '.' ExtractNextAtom(not (phpWithoutClassName in Attr),Attr); - if not AtomIsIdentifier(false) then break; + if ((not IsOperator) + or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))) + and (not AtomIsIdentifier(false)) then exit; end else begin // read name ExtractNextAtom(not (phpWithoutName in Attr),Attr); @@ -686,7 +692,7 @@ begin and (FindProcBody(Result)<>nil))) then begin CurProcHead:=ExtractProcHead(Result,Attr); - //DebugLn('TPascalReaderTool.FindProcNode B "',CurProcHead,'" =? "',AProcHead,'"'); + //DebugLn(['TPascalReaderTool.FindProcNode B "',CurProcHead,'" =? "',AProcHead,'" Result=',CompareTextIgnoringSpace(CurProcHead,AProcHead,false)]); if (CurProcHead<>'') and (CompareTextIgnoringSpace(CurProcHead,AProcHead,false)=0) then exit;