mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:39:22 +02:00
codetools: GetPasDocComment: fixed endless loop
git-svn-id: trunk@33014 -
This commit is contained in:
parent
4ca2e72008
commit
95f93fb4a6
@ -1150,7 +1150,10 @@ end;
|
||||
function FindNextComment(const ASource: string; StartPos: integer;
|
||||
MaxPos: integer): integer;
|
||||
// if not found: Result=MaxPos+1
|
||||
var
|
||||
NotFoundPos: Integer;
|
||||
begin
|
||||
NotFoundPos:=MaxPos+1;
|
||||
if (MaxPos>length(ASource)) or (MaxPos<1) then
|
||||
MaxPos:=length(ASource);
|
||||
Result:=StartPos;
|
||||
@ -1160,11 +1163,9 @@ begin
|
||||
begin
|
||||
inc(Result);
|
||||
while (Result<=MaxPos) do begin
|
||||
if (ASource[Result]<>'''') then
|
||||
inc(Result)
|
||||
else begin
|
||||
if (ASource[Result] in ['''',#10,#13]) then
|
||||
break;
|
||||
end;
|
||||
inc(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1182,7 +1183,7 @@ begin
|
||||
end;
|
||||
inc(Result);
|
||||
end;
|
||||
if Result>MaxPos+1 then Result:=MaxPos+1;
|
||||
if Result>=MaxPos+1 then Result:=NotFoundPos;
|
||||
end;
|
||||
|
||||
procedure FindCommentsInRange(const Src: string; StartPos, EndPos: integer;
|
||||
|
@ -2994,6 +2994,7 @@ function TPascalReaderTool.GetPasDocComments(Node: TCodeTreeNode;
|
||||
begin
|
||||
// read comments (start in front of node)
|
||||
//DebugLn(['TPascalReaderTool.GetPasDocComments Scan Src=',copy(Src,StartPos,EndPos-StartPos)]);
|
||||
if EndPos>SrcLen then EndPos:=SrcLen+1;
|
||||
p:=FindLineEndOrCodeInFrontOfPosition(StartPos,true);
|
||||
while p<EndPos do begin
|
||||
p:=FindNextComment(Src,p,EndPos);
|
||||
|
Loading…
Reference in New Issue
Block a user