mirror of https://gitlab.com/basile.b/dexed.git
add self return to TStringRange.popFront + add TStringRange.popFrontN
This commit is contained in:
parent
7d0f3212c1
commit
0b8c3bf093
|
@ -294,9 +294,7 @@ begin
|
||||||
end;
|
end;
|
||||||
with TStringRange.create(pge) do while not empty do
|
with TStringRange.create(pge) do while not empty do
|
||||||
begin
|
begin
|
||||||
popUntil('"');
|
fList.Add(popUntil('"')^.popFront^.takeUntil('"').yield);
|
||||||
popFront;
|
|
||||||
fList.Add(takeUntil('"').yield);
|
|
||||||
popFront;
|
popFront;
|
||||||
end;
|
end;
|
||||||
cbb.Items.clear;
|
cbb.Items.clear;
|
||||||
|
|
|
@ -2536,11 +2536,10 @@ begin
|
||||||
rng.init(firstLineFlags);
|
rng.init(firstLineFlags);
|
||||||
if rng.startsWith('#!') then
|
if rng.startsWith('#!') then
|
||||||
begin
|
begin
|
||||||
rng.popFront;
|
rng.popFrontN(2)^
|
||||||
rng.popFront;
|
.popWhile([' ', #9])^
|
||||||
rng.popWhile([' ', #9]);
|
.popUntil([' ', #9, ':'])^
|
||||||
rng.popUntil([' ', #9, ':']);
|
.popWhile([' ', #9, ':']);
|
||||||
rng.popWhile([' ', #9, ':']);
|
|
||||||
firstlineFlags := rng.takeUntil(#0).yield;
|
firstlineFlags := rng.takeUntil(#0).yield;
|
||||||
firstlineFlags := fSymStringExpander.expand(firstlineFlags);
|
firstlineFlags := fSymStringExpander.expand(firstlineFlags);
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
|
|
|
@ -43,7 +43,9 @@ type
|
||||||
function init(const pchr: PChar; length: integer): PStringRange; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function init(const pchr: PChar; length: integer): PStringRange; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
|
|
||||||
// advances.
|
// advances.
|
||||||
procedure popFront; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function popFront: PStringRange; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
|
// advances N times
|
||||||
|
function popFrontN(n: integer): PStringRange; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
// returns the current element.
|
// returns the current element.
|
||||||
function front: char; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function front: char; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
// indicates wether the range is consumed.
|
// indicates wether the range is consumed.
|
||||||
|
@ -125,9 +127,16 @@ begin
|
||||||
Result := @self;
|
Result := @self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TStringRange.popFront;
|
function TStringRange.popFront: PStringRange;
|
||||||
begin
|
begin
|
||||||
pos += 1;
|
pos += 1;
|
||||||
|
Result := @self;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStringRange.popFrontN(n: integer): PStringRange;
|
||||||
|
begin
|
||||||
|
pos += n;
|
||||||
|
Result := @self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TStringRange.front: char;
|
function TStringRange.front: char;
|
||||||
|
|
|
@ -269,8 +269,8 @@ begin
|
||||||
Result += rng.takeUntil('<').yield;
|
Result += rng.takeUntil('<').yield;
|
||||||
if not rng.empty and (rng.front = '<') then
|
if not rng.empty and (rng.front = '<') then
|
||||||
begin
|
begin
|
||||||
rng.popFront;
|
;
|
||||||
sym := rng.takeUntil('>').yield;
|
sym := rng.popFront^.takeUntil('>').yield;
|
||||||
if not rng.empty and (rng.front = '>') then
|
if not rng.empty and (rng.front = '>') then
|
||||||
begin
|
begin
|
||||||
rng.popFront;
|
rng.popFront;
|
||||||
|
|
Loading…
Reference in New Issue