From 6123660445c31be9c93527dbc6a41ab00de6e7f4 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 5 Nov 2013 23:07:57 +0000 Subject: [PATCH] codetools: fixed TCustomCodeTool.ReadBackTilBracketOpen when there is no bracket git-svn-id: trunk@43378 - --- components/codetools/customcodetool.pas | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/codetools/customcodetool.pas b/components/codetools/customcodetool.pas index 25e479c2ec..b0f3cc6c50 100644 --- a/components/codetools/customcodetool.pas +++ b/components/codetools/customcodetool.pas @@ -1954,25 +1954,25 @@ begin exit; end; Start:=CurPos; - repeat + while CurPos.StartPos>1 do begin ReadPriorAtom; - if (CurPos.Flag=OpenBracket) then break; + if (CurPos.Flag=OpenBracket) then exit(true); if (CurPos.StartPos<1) or (CurPos.Flag in [AntiOpenBracket,cafEND]) or ((CurPos.Flag=cafWord) and UnexpectedKeyWordInBrackets.DoItCaseInsensitive(Src, CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)) then begin - CurPos:=Start; - if ExceptionOnNotFound then - RaiseBracketNotFound; - exit; + break; end; if CurPos.Flag in [cafRoundBracketClose,cafEdgedBracketClose] then begin if not ReadBackTilBracketOpen(ExceptionOnNotFound) then exit; end; - until false; - Result:=true; + end; + CurPos:=Start; + if ExceptionOnNotFound then + RaiseBracketNotFound; + Result:=false; end; procedure TCustomCodeTool.ReadTillCommentEnd;