mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-23 18:01:36 +02:00
codetools: nested comments for GetAtomString
git-svn-id: trunk@19479 -
This commit is contained in:
parent
cc98da7e85
commit
73edc4762b
@ -302,8 +302,8 @@ procedure ReadRawNextPascalAtom(const Source: string;
|
||||
NestedComments: boolean = false);
|
||||
function ReadTilPascalBracketClose(const Source: string;
|
||||
var Position: integer; NestedComments: boolean = false): boolean;
|
||||
function GetAtomLength(p: PChar): integer;
|
||||
function GetAtomString(p: PChar): string;
|
||||
function GetAtomLength(p: PChar; NestedComments: boolean): integer;
|
||||
function GetAtomString(p: PChar; NestedComments: boolean): string;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@ -1869,15 +1869,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetAtomLength(p: PChar): integer;
|
||||
function GetAtomLength(p: PChar; NestedComments: boolean): integer;
|
||||
var
|
||||
c1: Char;
|
||||
CommentLvl: Integer;
|
||||
NestedComments: Boolean;
|
||||
c2: Char;
|
||||
OldP: PChar;
|
||||
begin
|
||||
NestedComments:=false;
|
||||
OldP:=p;
|
||||
// read atom
|
||||
c1:=p^;
|
||||
@ -2012,12 +2010,12 @@ begin
|
||||
Result:=P-OldP;
|
||||
end;
|
||||
|
||||
function GetAtomString(p: PChar): string;
|
||||
function GetAtomString(p: PChar; NestedComments: boolean): string;
|
||||
var
|
||||
l: LongInt;
|
||||
begin
|
||||
if p=nil then exit('');
|
||||
l:=GetAtomLength(p);
|
||||
l:=GetAtomLength(p,NestedComments);
|
||||
SetLength(Result,l);
|
||||
if l>0 then
|
||||
System.Move(p^,Result[1],length(Result));
|
||||
@ -3227,8 +3225,8 @@ begin
|
||||
end;
|
||||
|
||||
// full comparison
|
||||
Len1:=GetAtomLength(p1);
|
||||
Len2:=GetAtomLength(p2);
|
||||
Len1:=GetAtomLength(p1,NestedComments);
|
||||
Len2:=GetAtomLength(p2,NestedComments);
|
||||
l:=Len1;
|
||||
if l>Len2 then l:=Len2;
|
||||
while l>0 do begin
|
||||
|
@ -502,7 +502,7 @@ begin
|
||||
AVLNode:=NotFigureConstants.FindLowest;
|
||||
i:=0;
|
||||
while AVLNode<>nil do begin
|
||||
s:=GetAtomString(PChar(AVLNode.Data));
|
||||
s:=GetAtomString(PChar(AVLNode.Data),false);
|
||||
if s<>'' then begin
|
||||
inc(i);
|
||||
Result.Add(s);
|
||||
|
@ -1714,7 +1714,7 @@ begin
|
||||
if (Data1.Desc=ctnConstant) and (Data2.Desc=ctnConstant)
|
||||
and (fSortCodeTool<>nil) then begin
|
||||
//if GetAtomLength(@fSortCodeTool.Src[Data1.StartPos])>50 then
|
||||
// DebugLn(['TCodeExplorerView.CompareCodeNodes AAA1 ',GetAtomString(@fSortCodeTool.Src[Data1.StartPos])]);
|
||||
// DebugLn(['TCodeExplorerView.CompareCodeNodes AAA1 ',GetAtomString(@fSortCodeTool.Src[Data1.StartPos],fSortCodeTool.Scanner.NestedComments),' ',round(Now*8640000) mod 10000]);
|
||||
//Result:=-CompareAtom(@fSortCodeTool.Src[Data1.StartPos],
|
||||
// @fSortCodeTool.Src[Data2.StartPos]);
|
||||
//if Result<>0 then exit;
|
||||
|
Loading…
Reference in New Issue
Block a user