codetools: fixed FindStartOFindStartOfAtomfAtom if at start of string constant

git-svn-id: trunk@27688 -
This commit is contained in:
mattias 2010-10-13 22:11:06 +00:00
parent ce82f81416
commit ef525bda22
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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