mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 12:20:38 +02:00
codetools: TStandardCodeTool.FindDelphiProjectUnits: dotted names
git-svn-id: trunk@32115 -
This commit is contained in:
parent
14cca12943
commit
ef465ef95f
@ -2571,6 +2571,7 @@ end;
|
||||
|
||||
function TPascalReaderTool.ExtractUsedUnitName(UseUnitNode: TCodeTreeNode;
|
||||
InFilename: PAnsiString): string;
|
||||
// after reading CurPos is on atom behind, i.e. comma or semicolon
|
||||
begin
|
||||
Result:='';
|
||||
if InFilename<>nil then InFilename^:='';
|
||||
@ -2588,6 +2589,7 @@ begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsStringConstant then exit;
|
||||
InFilename^:=copy(Src,CurPos.StartPos+1,CurPos.EndPos-CurPos.StartPos-2);
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1337,33 +1337,26 @@ end;
|
||||
function TStandardCodeTool.FindDelphiProjectUnits(var FoundInUnits,
|
||||
MissingInUnits, NormalUnits: TStrings; UseContainsSection: boolean): boolean;
|
||||
var
|
||||
InAtom, UnitNameAtom: TAtomPosition;
|
||||
AnUnitName, AnUnitInFilename: string;
|
||||
NewCode: TCodeBuffer;
|
||||
UsesNode: TCodeTreeNode;
|
||||
Node: TCodeTreeNode;
|
||||
begin
|
||||
Result:=false;
|
||||
FoundInUnits:=nil;
|
||||
MissingInUnits:=nil;
|
||||
NormalUnits:=nil;
|
||||
DebugLn('TStandardCodeTool.FindDelphiProjectUnits UseContainsSection=',dbgs(UseContainsSection));
|
||||
// find the uses sections
|
||||
BuildTree(lsrEnd);
|
||||
BuildTree(lsrMainUsesSectionEnd);
|
||||
UsesNode:=FindMainUsesSection(UseContainsSection);
|
||||
if UsesNode=nil then exit;
|
||||
MoveCursorToUsesStart(UsesNode);
|
||||
FoundInUnits:=TStringList.Create;
|
||||
MissingInUnits:=TStringList.Create;
|
||||
NormalUnits:=TStringList.Create;
|
||||
repeat
|
||||
Node:=UsesNode.FirstChild;
|
||||
while Node<>nil do begin
|
||||
// read next unit name
|
||||
ReadNextUsedUnit(UnitNameAtom, InAtom);
|
||||
AnUnitName:=GetAtom(UnitNameAtom);
|
||||
if InAtom.StartPos>0 then begin
|
||||
AnUnitInFilename:=copy(Src,InAtom.StartPos+1,
|
||||
InAtom.EndPos-InAtom.StartPos-2);
|
||||
end else
|
||||
AnUnitInFilename:='';
|
||||
AnUnitName:=ExtractUsedUnitName(Node,@AnUnitInFilename);
|
||||
// find unit file
|
||||
if AnUnitInFilename<>'' then begin
|
||||
// An 'in' unit => Delphi project file
|
||||
@ -1380,14 +1373,8 @@ begin
|
||||
NewCode:=FindUnitSource(AnUnitName,AnUnitInFilename,false);
|
||||
NormalUnits.AddObject(AnUnitName,NewCode);
|
||||
end;
|
||||
if CurPos.Flag=cafComma then begin
|
||||
// read next unit name
|
||||
ReadNextAtom;
|
||||
end else if CurPos.Flag=cafSemicolon then begin
|
||||
break;
|
||||
end else
|
||||
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[';',GetAtom]);
|
||||
until false;
|
||||
Node:=Node.NextBrother;
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user