mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 22:19:20 +02:00
codetools: clean up
git-svn-id: trunk@48667 -
This commit is contained in:
parent
c26c395562
commit
aea275de32
@ -489,7 +489,7 @@ function Dbgs(const p: TCodePosition): string;
|
|||||||
var
|
var
|
||||||
CodeXYPosition: TCodeXYPosition;
|
CodeXYPosition: TCodeXYPosition;
|
||||||
begin
|
begin
|
||||||
FillChar(CodeXYPosition,SizeOf(TCodeXYPosition),0);
|
FillChar(CodeXYPosition{%H-},SizeOf(TCodeXYPosition),0);
|
||||||
CodeXYPosition.Code:=p.Code;
|
CodeXYPosition.Code:=p.Code;
|
||||||
if CodeXYPosition.Code<>nil then begin
|
if CodeXYPosition.Code<>nil then begin
|
||||||
CodeXYPosition.Code.AbsoluteToLineCol(p.P,CodeXYPosition.Y,CodeXYPosition.X);
|
CodeXYPosition.Code.AbsoluteToLineCol(p.P,CodeXYPosition.Y,CodeXYPosition.X);
|
||||||
|
@ -43,7 +43,7 @@ uses
|
|||||||
MemCheck,
|
MemCheck,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, FileProcs, CodeToolsStructs, BasicCodeTools,
|
Classes, SysUtils, FileProcs, CodeToolsStructs, BasicCodeTools,
|
||||||
AVL_Tree, CodeToolMemManager;
|
AVL_Tree;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure ConsistencyCheck;
|
procedure ConsistencyCheck;
|
||||||
procedure WriteDebugReport(WithChilds: boolean);
|
procedure WriteDebugReport(WithChildren: boolean);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1051,11 +1051,11 @@ begin
|
|||||||
raise Exception.Create('');
|
raise Exception.Create('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeTree.WriteDebugReport(WithChilds: boolean);
|
procedure TCodeTree.WriteDebugReport(WithChildren: boolean);
|
||||||
begin
|
begin
|
||||||
DebugLn('[TCodeTree.WriteDebugReport] Root=',dbgs(Root<>nil));
|
DebugLn('[TCodeTree.WriteDebugReport] Root=',dbgs(Root<>nil));
|
||||||
if Root<>nil then
|
if Root<>nil then
|
||||||
Root.WriteDebugReport(' ',true);
|
Root.WriteDebugReport(' ',WithChildren);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCodeTreeNodeExtension }
|
{ TCodeTreeNodeExtension }
|
||||||
|
@ -427,8 +427,7 @@ type
|
|||||||
procedure HandleDirective;
|
procedure HandleDirective;
|
||||||
procedure UpdateCleanedSource(NewCopiedSrcPos: integer);
|
procedure UpdateCleanedSource(NewCopiedSrcPos: integer);
|
||||||
function ReturnFromIncludeFile: boolean;
|
function ReturnFromIncludeFile: boolean;
|
||||||
function ParseKeyWord(StartPos, WordLen: integer; LastTokenType: TLSTokenType
|
function ParseKeyWord(StartPos: integer; LastTokenType: TLSTokenType): boolean;
|
||||||
): boolean;
|
|
||||||
function DoEndToken: boolean; inline;
|
function DoEndToken: boolean; inline;
|
||||||
function DoSourceTypeToken: boolean; inline;
|
function DoSourceTypeToken: boolean; inline;
|
||||||
function DoInterfaceToken: boolean; inline;
|
function DoInterfaceToken: boolean; inline;
|
||||||
@ -1836,7 +1835,7 @@ begin
|
|||||||
//debugln(['TLinkScanner.Scan Token ',dbgstr(Src,TokenStart,SrcPos-TokenStart)]);
|
//debugln(['TLinkScanner.Scan Token ',dbgstr(Src,TokenStart,SrcPos-TokenStart)]);
|
||||||
ReadNextToken;
|
ReadNextToken;
|
||||||
if TokenType=lsttWord then
|
if TokenType=lsttWord then
|
||||||
ParseKeyWord(TokenStart,SrcPos-TokenStart,LastTokenType);
|
ParseKeyWord(TokenStart,LastTokenType);
|
||||||
|
|
||||||
//writeln('TLinkScanner.Scan G "',copy(Src,TokenStart,SrcPos-TokenStart),'" LastTokenType=',LastTokenType,' TokenType=',TokenType);
|
//writeln('TLinkScanner.Scan G "',copy(Src,TokenStart,SrcPos-TokenStart),'" LastTokenType=',LastTokenType,' TokenType=',TokenType);
|
||||||
if (LastTokenType=lsttEnd) and (TokenType=lsttPoint) then begin
|
if (LastTokenType=lsttEnd) and (TokenType=lsttPoint) then begin
|
||||||
@ -2621,8 +2620,8 @@ function TLinkScanner.GuessMisplacedIfdefEndif(StartCursorPos: integer;
|
|||||||
IfStack:=nil;
|
IfStack:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function InitGuessMisplaced(var CurToken: TToken; ACode: Pointer;
|
function InitGuessMisplaced(out CurToken: TToken; ACode: Pointer;
|
||||||
var ASrc: string; var ASrcLen: integer): boolean;
|
out ASrc: string; out ASrcLen: integer): boolean;
|
||||||
var
|
var
|
||||||
ASrcLog: TSourceLog;
|
ASrcLog: TSourceLog;
|
||||||
begin
|
begin
|
||||||
@ -2698,7 +2697,6 @@ function TLinkScanner.GuessMisplacedIfdefEndif(StartCursorPos: integer;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function GuessMisplacedIfdefEndifInCode(ACode: Pointer;
|
function GuessMisplacedIfdefEndifInCode(ACode: Pointer;
|
||||||
StartCursorPos: integer; StartCode: Pointer;
|
|
||||||
var EndCursorPos: integer; var EndCode: Pointer): boolean;
|
var EndCursorPos: integer; var EndCode: Pointer): boolean;
|
||||||
var
|
var
|
||||||
ASrc: string;
|
ASrc: string;
|
||||||
@ -2798,7 +2796,7 @@ begin
|
|||||||
try
|
try
|
||||||
while LinkId<LinkCount do begin
|
while LinkId<LinkCount do begin
|
||||||
Result:=GuessMisplacedIfdefEndifInCode(FLinks[LinkID].Code,
|
Result:=GuessMisplacedIfdefEndifInCode(FLinks[LinkID].Code,
|
||||||
StartCursorPos,StartCode,EndCursorPos,EndCode);
|
EndCursorPos,EndCode);
|
||||||
if Result then exit;
|
if Result then exit;
|
||||||
// search next code
|
// search next code
|
||||||
LastCode:=FLinks[LinkID].Code;
|
LastCode:=FLinks[LinkID].Code;
|
||||||
@ -4103,7 +4101,7 @@ begin
|
|||||||
Result:=SrcPos<=SrcLen;
|
Result:=SrcPos<=SrcLen;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLinkScanner.ParseKeyWord(StartPos, WordLen: integer;
|
function TLinkScanner.ParseKeyWord(StartPos: integer;
|
||||||
LastTokenType: TLSTokenType): boolean;
|
LastTokenType: TLSTokenType): boolean;
|
||||||
var
|
var
|
||||||
p: PChar;
|
p: PChar;
|
||||||
@ -4491,6 +4489,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
ACode:=FLinks[LinkIndex].Code;
|
ACode:=FLinks[LinkIndex].Code;
|
||||||
|
CodeIsReadOnly:=false;
|
||||||
FOnGetSourceStatus(Self,ACode,CodeIsReadOnly);
|
FOnGetSourceStatus(Self,ACode,CodeIsReadOnly);
|
||||||
if CodeIsReadOnly then begin
|
if CodeIsReadOnly then begin
|
||||||
EditError(ctsfileIsReadOnly, ACode);
|
EditError(ctsfileIsReadOnly, ACode);
|
||||||
|
Loading…
Reference in New Issue
Block a user