codetools: fixed parsing nested (* comments, bug #13380

git-svn-id: trunk@20002 -
This commit is contained in:
mattias 2009-05-17 02:43:29 +00:00
parent d85dd7e92c
commit 211701de5f

View File

@ -1308,12 +1308,26 @@ begin
inc(SrcPos,2); inc(SrcPos,2);
CommentInnerStartPos:=SrcPos; CommentInnerStartPos:=SrcPos;
while (SrcPos<SrcLen) do begin while (SrcPos<SrcLen) do begin
if ((Src[SrcPos]<>'*') or (Src[SrcPos+1]<>')')) then case Src[SrcPos] of
inc(SrcPos) '*':
else begin begin
DecCommentLevel; inc(SrcPos);
inc(SrcPos,2); if (SrcPos<=SrcLen) and (Src[SrcPos]=')') then begin
break; inc(SrcPos);
DecCommentLevel;
if CommentLevel=0 then break;
end;
end;
'(':
begin
inc(SrcPos);
if FNestedComments and (SrcPos<=SrcLen) and (Src[SrcPos]='*') then begin
inc(SrcPos);
IncCommentLevel;
end;
end;
else
inc(SrcPos);
end; end;
end; end;
CommentEndPos:=SrcPos; CommentEndPos:=SrcPos;