mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 13:19:07 +02:00
codetools: added TLinkScanner.FindFirstDirective
git-svn-id: trunk@53191 -
This commit is contained in:
parent
d7a2596644
commit
b23106921b
@ -427,7 +427,7 @@ type
|
||||
|
||||
TLinkScanner = class(TObject)
|
||||
private
|
||||
FLinks: PSourceLink; // list of TSourceLink
|
||||
FLinks: PSourceLink; // list of TSourceLink, sorted for CleanedPos
|
||||
FLinkCount: integer;
|
||||
FLinkCapacity: integer;
|
||||
FCleanedSrc: string;
|
||||
@ -646,6 +646,8 @@ type
|
||||
property DirectivesStored: boolean read FDirectivesStored; // directives were stored on last scan
|
||||
function FindDirective(aCode: Pointer; aSrcPos: integer;
|
||||
out FirstSortedIndex, LastSortedIndex: integer): boolean;
|
||||
function FindFirstDirective(aCode: Pointer; aSrcPos: integer;
|
||||
const AllowedStates: TLSDirectiveStates): PLSDirective;
|
||||
function GetDirectiveValueAt(ADirective: TSequenceDirective; ACleanPos: integer): string;
|
||||
|
||||
// source mapping (Cleaned <-> Original)
|
||||
@ -1606,6 +1608,20 @@ begin
|
||||
LastSortedIndex:=-1;
|
||||
end;
|
||||
|
||||
function TLinkScanner.FindFirstDirective(aCode: Pointer; aSrcPos: integer;
|
||||
const AllowedStates: TLSDirectiveStates): PLSDirective;
|
||||
var
|
||||
FirstSortedIndex, LastSortedIndex, i: integer;
|
||||
begin
|
||||
Result:=nil;
|
||||
if not FindDirective(aCode,aSrcPos,FirstSortedIndex,LastSortedIndex) then exit;
|
||||
for i:=FirstSortedIndex to LastSortedIndex do begin
|
||||
Result:=DirectivesSorted[i];
|
||||
if Result^.State in AllowedStates then exit;
|
||||
end;
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TLinkScanner.LinkIndexAtCleanPos(ACleanPos: integer): integer;
|
||||
|
||||
procedure ConsistencyError1;
|
||||
|
Loading…
Reference in New Issue
Block a user