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);
CommentInnerStartPos:=SrcPos;
while (SrcPos<SrcLen) do begin
if ((Src[SrcPos]<>'*') or (Src[SrcPos+1]<>')')) then
inc(SrcPos)
else begin
DecCommentLevel;
inc(SrcPos,2);
break;
case Src[SrcPos] of
'*':
begin
inc(SrcPos);
if (SrcPos<=SrcLen) and (Src[SrcPos]=')') then begin
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;
CommentEndPos:=SrcPos;