codetools: accelerated TLinkScanner.SkipComment

git-svn-id: trunk@25730 -
This commit is contained in:
mattias 2010-05-28 17:12:04 +00:00
parent f2ab7eb0e6
commit 3992b33b89
2 changed files with 23 additions and 7 deletions

View File

@ -1292,20 +1292,31 @@ end;
procedure TLinkScanner.SkipComment;
// a normal pascal {} comment
var
p: PChar;
begin
CommentStyle:=CommentTP;
CommentStartPos:=SrcPos;
p:=@Src[SrcPos]+1;
IncCommentLevel;
inc(SrcPos);
CommentInnerStartPos:=SrcPos;
{ HandleSwitches can dec CommentLevel }
while (SrcPos<=SrcLen) and (CommentLevel>0) do begin
case Src[SrcPos] of
while true do begin
case p^ of
#0: break;
'{' : IncCommentLevel;
'}' : DecCommentLevel;
'}' :
begin
DecCommentLevel;
if CommentLevel=0 then begin
inc(p);
break;
end;
end;
end;
inc(SrcPos);
inc(p);
end;
SrcPos:=p-PChar(Src)+1;
CommentEndPos:=SrcPos;
CommentInnerEndPos:=SrcPos-1;
if (CommentLevel>0) then CommentEndNotFound;

View File

@ -2156,8 +2156,11 @@ begin
#0,#10,#13: break;
'}':
if TopPascalCodeFoldBlockType=cfbtNestedComment then
EndPascalCodeFoldBlock
else begin
begin
Run:=p;
EndPascalCodeFoldBlock;
p:=Run;
end else begin
fRange := fRange - [rsBor];
Inc(p);
break;
@ -2165,7 +2168,9 @@ begin
'{':
if NestedComments then begin
fStringLen := 1;
Run:=p;
StartPascalCodeFoldBlock(cfbtNestedComment);
p:=Run;
end;
end;
Inc(p);