def lex.step

bend-kit-regex@0.8.0.0 · regex.bend:340

import bend-kit-regex@0.8.0.0/regex.bend as Regex
import Base

340def lex.step(s: String, toks: List<&2, Tok>) -> Lx:
341  match s:
342    case SNil{}:
343      LDone{toks}
344    case SCon{'\\', t}:
345      lex.esc(esc(t), toks)
346    case SCon{'[', SCon{'^', t}}:
347      lex.class(True{}, class(t, True{}), toks)
348    case SCon{'[', t}:
349      lex.class(False{}, class(t, True{}), toks)
350    case SCon{'(', SCon{'?', SCon{':', t}}}:
351      LGo{t, TOpen{False{}} <> toks}
352    case SCon{'(', SCon{'?', t}}:
353      LFail{}
354    case SCon{'(', t}:
355      LGo{t, TOpen{True{}} <> toks}
356    case SCon{')', t}:
357      LGo{t, TClose{} <> toks}
358    case SCon{'|', t}:
359      LGo{t, TBar{} <> toks}
360    case SCon{'*', t}:
361      lex.rep(0, None{}, t, toks)
362    case SCon{'+', t}:
363      lex.rep(1, None{}, t, toks)
364    case SCon{'?', t}:
365      lex.rep(0, Some{1}, t, toks)
366    case SCon{'{', +t}:
367      +m = num(t)
368      lex.brace.min(U32.is_eq(Num.n(m), 0), m, t, toks)
369    case SCon{'.', t}:
370      LGo{t, TAtom{NSet{True{}, [Rng{10, 10}]}} <> toks}
371    case SCon{'^', t}:
372      LGo{t, TAtom{NAssert{0}} <> toks}
373    case SCon{'$', t}:
374      LGo{t, TAtom{NAssert{1}} <> toks}
375    case SCon{Chr{+c}, t}:
376      LGo{t, TAtom{lit(c)} <> toks}

Uses (22)

Used by (1)