def first_str

bolt@1.26.0.0 · src/config.bend:84

import bolt@1.26.0.0/src/config.bend as Config
import Base
import bolt@1.26.0.0/src/syntax/lex.bend as Lex

84# the first string among the tokens
85def first_str(toks: List<&2, Lex.Tok>) -> Maybe<&2, String>:
86  match toks:
87    case Nil{}:
88      None{}
89    case Con{Lex.Tok{Lex.TStr{}, t, l, c}, rest}:
90      Some{unquote(t)}
91    case Con{h, rest}:
92      first_str(rest)

Uses (6)

Used by (1)