diff --git a/components/codetools/pascalreadertool.pas b/components/codetools/pascalreadertool.pas index 89979a6763..f2086d93f4 100644 --- a/components/codetools/pascalreadertool.pas +++ b/components/codetools/pascalreadertool.pas @@ -277,16 +277,30 @@ begin if IsCommentStartChar[Src[CommentStart]] then begin CurCommentPos:=CommentStart; case Src[CurCommentPos] of - '{': // pascal comment + '{': begin - CommentLvl:=1; inc(CurCommentPos); - while (CurCommentPos0) do begin - case Src[CurCommentPos] of - '{': if Scanner.NestedComments then inc(CommentLvl); - '}': dec(CommentLvl); - end; + if (CurCommentPos0) do begin + case Src[CurCommentPos] of + '{': if Scanner.NestedComments then inc(CommentLvl); + '}': dec(CommentLvl); + end; + inc(CurCommentPos); + end; end; end; '/': // Delphi comment