IDE: codeexplorer: implemented ignoring some function calls when gathering constants

git-svn-id: trunk@19505 -
This commit is contained in:
mattias 2009-04-19 10:36:05 +00:00
parent f1645590fd
commit 1e362205e8
2 changed files with 68 additions and 35 deletions

View File

@ -95,8 +95,9 @@ const
'0',
'1'
);
DefaultIgnoreFigConstInFuncs: array[1..14] of ansistring // Note: keep this asciiz
DefaultIgnoreFigConstInFuncs: array[1..15] of ansistring // Note: keep this asciiz
= (
'Assert',
'Debug',
'DebugLn',
'DbgOut',

View File

@ -1012,11 +1012,19 @@ var
TVNode: TTreeNode;
ProcNode: TCodeTreeNode;
OldPos: LongInt;
CurAtom, Last1Atom, Last2Atom: TCommonAtomFlag;
FuncName: string;
Atom: TAtomPosition;
begin
if (StartPos<1) or (StartPos>=EndPos) then exit;
Tool.MoveCursorToCleanPos(StartPos);
Last1Atom:=cafNone;
Last2Atom:=cafNone;
while Tool.CurPos.StartPos<EndPos do begin
if Tool.Src[Tool.CurPos.StartPos] in ['''','#','0'..'9','$','%'] then begin
CurAtom:=cafNone;
case Tool.Src[Tool.CurPos.StartPos] of
'''','#','0'..'9','$','%':
begin
// a constant
if Tool.AtomIsEmptyStringConstant then begin
// ignore empty string constant ''
@ -1054,6 +1062,30 @@ begin
TVNode.SelectedIndex:=NodeImageIndCex;
end;
end;
'.':
CurAtom:=cafPoint;
'_','a'..'z','A'..'Z':
CurAtom:=cafWord;
'(','[':
if Last1Atom=cafWord then
begin
Atom:=Tool.LastAtoms.GetValueAt(0);
FuncName:=copy(Tool.Src,Atom.StartPos,Atom.EndPos-Atom.StartPos);
if Last2Atom=cafPoint then
FuncName:='.'+FuncName;
if CodeExplorerOptions.IgnoreFigConstInFunc(FuncName) then
begin
// skip this function call
Tool.ReadTilBracketClose(false);
end;
end;
end;
// read next atom
Last2Atom:=Last1Atom;
Last1Atom:=CurAtom;
Tool.ReadNextAtom;
end;
end;