diff --git a/src/ce_libmaneditor.pas b/src/ce_libmaneditor.pas index 7bbb77ee..8cd5a700 100644 --- a/src/ce_libmaneditor.pas +++ b/src/ce_libmaneditor.pas @@ -294,9 +294,7 @@ begin end; with TStringRange.create(pge) do while not empty do begin - popUntil('"'); - popFront; - fList.Add(takeUntil('"').yield); + fList.Add(popUntil('"')^.popFront^.takeUntil('"').yield); popFront; end; cbb.Items.clear; diff --git a/src/ce_main.pas b/src/ce_main.pas index faf4dcb8..48a9e5f9 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -2536,11 +2536,10 @@ begin rng.init(firstLineFlags); if rng.startsWith('#!') then begin - rng.popFront; - rng.popFront; - rng.popWhile([' ', #9]); - rng.popUntil([' ', #9, ':']); - rng.popWhile([' ', #9, ':']); + rng.popFrontN(2)^ + .popWhile([' ', #9])^ + .popUntil([' ', #9, ':'])^ + .popWhile([' ', #9, ':']); firstlineFlags := rng.takeUntil(#0).yield; firstlineFlags := fSymStringExpander.expand(firstlineFlags); lst := TStringList.Create; diff --git a/src/ce_stringrange.pas b/src/ce_stringrange.pas index 8f22413c..1390250d 100644 --- a/src/ce_stringrange.pas +++ b/src/ce_stringrange.pas @@ -43,7 +43,9 @@ type function init(const pchr: PChar; length: integer): PStringRange; {$IFNDEF DEBUG}inline;{$ENDIF} // 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. function front: char; {$IFNDEF DEBUG}inline;{$ENDIF} // indicates wether the range is consumed. @@ -125,9 +127,16 @@ begin Result := @self; end; -procedure TStringRange.popFront; +function TStringRange.popFront: PStringRange; begin pos += 1; + Result := @self; +end; + +function TStringRange.popFrontN(n: integer): PStringRange; +begin + pos += n; + Result := @self; end; function TStringRange.front: char; diff --git a/src/ce_symstring.pas b/src/ce_symstring.pas index ab5a810a..677c77c6 100644 --- a/src/ce_symstring.pas +++ b/src/ce_symstring.pas @@ -269,8 +269,8 @@ begin Result += rng.takeUntil('<').yield; if not rng.empty and (rng.front = '<') then begin - rng.popFront; - sym := rng.takeUntil('>').yield; + ; + sym := rng.popFront^.takeUntil('>').yield; if not rng.empty and (rng.front = '>') then begin rng.popFront;