mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 04:19:09 +02:00
codetools: accelerated TLinkScanner.SkipComment
git-svn-id: trunk@25730 -
This commit is contained in:
parent
f2ab7eb0e6
commit
3992b33b89
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user