From ef525bda22aa3e3e255257d76c66358c69309bdb Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 13 Oct 2010 22:11:06 +0000 Subject: [PATCH] codetools: fixed FindStartOFindStartOfAtomfAtom if at start of string constant git-svn-id: trunk@27688 - --- components/codetools/basiccodetools.pas | 5 +++++ components/codetools/finddeclarationtool.pas | 1 + 2 files changed, 6 insertions(+) diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index 7ad2e12826..e490a80ec6 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -2076,7 +2076,9 @@ function FindStartOfAtom(const Source: string; Position: integer): integer; procedure ReadStringConstantBackward(var p: integer); var PrePos: integer; + StartPos: LongInt; begin + StartPos:=p; while (p>1) do begin case Source[p-1] of '''': @@ -2086,6 +2088,8 @@ function FindStartOfAtom(const Source: string; Position: integer): integer; repeat dec(PrePos); if (PrePos<1) or (Source[PrePos] in [#10,#13]) then begin + // the StartPos was the start of a string constant + p:=StartPos-1; exit; end; until (Source[PrePos]=''''); @@ -2158,6 +2162,7 @@ begin end; '''': begin + // could be start or end inc(Result); ReadStringConstantBackward(Result); end; diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 586af501dc..29208206ca 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -8127,6 +8127,7 @@ function TFindDeclarationTool.GetCurrentAtomType: TVariableAtomType; var Node: TCodeTreeNode; begin + //debugln(['TFindDeclarationTool.GetCurrentAtomType ',CurPos.StartPos,' ',CurPos.EndPos,' ',SrcLen,' ',GetAtom]); if (CurPos.StartPos=CurPos.EndPos) then Result:=vatSpace else if (CurPos.StartPos>SrcLen) then