mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 15:49:32 +01: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);
 | 
					   NestedComments: boolean = false);
 | 
				
			||||||
function ReadTilPascalBracketClose(const Source: string;
 | 
					function ReadTilPascalBracketClose(const Source: string;
 | 
				
			||||||
   var Position: integer; NestedComments: boolean = false): boolean;
 | 
					   var Position: integer; NestedComments: boolean = false): boolean;
 | 
				
			||||||
function GetAtomLength(p: PChar): integer;
 | 
					function GetAtomLength(p: PChar; NestedComments: boolean): integer;
 | 
				
			||||||
function GetAtomString(p: PChar): string;
 | 
					function GetAtomString(p: PChar; NestedComments: boolean): string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//-----------------------------------------------------------------------------
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1869,15 +1869,13 @@ begin
 | 
				
			|||||||
  end;
 | 
					  end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function GetAtomLength(p: PChar): integer;
 | 
					function GetAtomLength(p: PChar; NestedComments: boolean): integer;
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  c1: Char;
 | 
					  c1: Char;
 | 
				
			||||||
  CommentLvl: Integer;
 | 
					  CommentLvl: Integer;
 | 
				
			||||||
  NestedComments: Boolean;
 | 
					 | 
				
			||||||
  c2: Char;
 | 
					  c2: Char;
 | 
				
			||||||
  OldP: PChar;
 | 
					  OldP: PChar;
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  NestedComments:=false;
 | 
					 | 
				
			||||||
  OldP:=p;
 | 
					  OldP:=p;
 | 
				
			||||||
  // read atom
 | 
					  // read atom
 | 
				
			||||||
  c1:=p^;
 | 
					  c1:=p^;
 | 
				
			||||||
@ -2012,12 +2010,12 @@ begin
 | 
				
			|||||||
  Result:=P-OldP;
 | 
					  Result:=P-OldP;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function GetAtomString(p: PChar): string;
 | 
					function GetAtomString(p: PChar; NestedComments: boolean): string;
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  l: LongInt;
 | 
					  l: LongInt;
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  if p=nil then exit('');
 | 
					  if p=nil then exit('');
 | 
				
			||||||
  l:=GetAtomLength(p);
 | 
					  l:=GetAtomLength(p,NestedComments);
 | 
				
			||||||
  SetLength(Result,l);
 | 
					  SetLength(Result,l);
 | 
				
			||||||
  if l>0 then
 | 
					  if l>0 then
 | 
				
			||||||
    System.Move(p^,Result[1],length(Result));
 | 
					    System.Move(p^,Result[1],length(Result));
 | 
				
			||||||
@ -3227,8 +3225,8 @@ begin
 | 
				
			|||||||
  end;
 | 
					  end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // full comparison
 | 
					  // full comparison
 | 
				
			||||||
  Len1:=GetAtomLength(p1);
 | 
					  Len1:=GetAtomLength(p1,NestedComments);
 | 
				
			||||||
  Len2:=GetAtomLength(p2);
 | 
					  Len2:=GetAtomLength(p2,NestedComments);
 | 
				
			||||||
  l:=Len1;
 | 
					  l:=Len1;
 | 
				
			||||||
  if l>Len2 then l:=Len2;
 | 
					  if l>Len2 then l:=Len2;
 | 
				
			||||||
  while l>0 do begin
 | 
					  while l>0 do begin
 | 
				
			||||||
 | 
				
			|||||||
@ -502,7 +502,7 @@ begin
 | 
				
			|||||||
  AVLNode:=NotFigureConstants.FindLowest;
 | 
					  AVLNode:=NotFigureConstants.FindLowest;
 | 
				
			||||||
  i:=0;
 | 
					  i:=0;
 | 
				
			||||||
  while AVLNode<>nil do begin
 | 
					  while AVLNode<>nil do begin
 | 
				
			||||||
    s:=GetAtomString(PChar(AVLNode.Data));
 | 
					    s:=GetAtomString(PChar(AVLNode.Data),false);
 | 
				
			||||||
    if s<>'' then begin
 | 
					    if s<>'' then begin
 | 
				
			||||||
      inc(i);
 | 
					      inc(i);
 | 
				
			||||||
      Result.Add(s);
 | 
					      Result.Add(s);
 | 
				
			||||||
 | 
				
			|||||||
@ -1714,7 +1714,7 @@ begin
 | 
				
			|||||||
    if (Data1.Desc=ctnConstant) and (Data2.Desc=ctnConstant)
 | 
					    if (Data1.Desc=ctnConstant) and (Data2.Desc=ctnConstant)
 | 
				
			||||||
    and (fSortCodeTool<>nil) then begin
 | 
					    and (fSortCodeTool<>nil) then begin
 | 
				
			||||||
      //if GetAtomLength(@fSortCodeTool.Src[Data1.StartPos])>50 then
 | 
					      //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],
 | 
					      //Result:=-CompareAtom(@fSortCodeTool.Src[Data1.StartPos],
 | 
				
			||||||
      //                     @fSortCodeTool.Src[Data2.StartPos]);
 | 
					      //                     @fSortCodeTool.Src[Data2.StartPos]);
 | 
				
			||||||
      //if Result<>0 then exit;
 | 
					      //if Result<>0 then exit;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user