def skip

bolt@1.27.0.0 · src/rules/suspicious/prefix.bend:151

import bolt@1.27.0.0/src/rules/suspicious/prefix.bend as Prefix
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex

151# the take's first argument, scanned from where the scan stands: what it
152# says (acc: its pieces so far, last first) and the tokens after the comma
153# that ends it; none when the take
154# closes first or the tokens run out
155def skip(toks: List<&2, Lex.Tok>, sk: Skip, +acc: List<&2, String>) -> Maybe<&2, Arg>:
156  match toks:
157    case Nil{}:
158      None{}
159    case Con{Lex.Tok{+k, +t, l, c}, rest}:
160      match sk:
161        case SComma{}:
162          Some{Arg{String.join(List.reverse(&2, String, acc), ""), Lex.Tok{k, t, l, c} <> rest}}
163        case SClose{}:
164          None{}
165        case SGo{dd}:
166          +nx = skip.step(k, dd)
167          skip(rest, nx, skip.piece(nx, k, t) <> acc)

Uses (10)

Used by (2)