def bits.run

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

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

1255# r: the sets live at s's head, whether a match was found, and whether one ends at the end of
1256# the text, if the text ends here. Inside the text an assertion can only fail, so fin implies end,
1257# and a match at fin is final.
1258def bits.run(s: String, +sets: List<&2, Bit>, +start: Maybe<&2, List<&2, Inst>>, +atn: U32, +hit1: Bool, r: Bs) -> Bool:
1259  match s:
1260    case SNil{}:
1261      Bs{cur, done, ok} = r
1262      done || ok
1263    case SCon{Chr{+c}, t}:
1264      match r:
1265        case Bs{cur, True{}, ok}:
1266          True{}
1267        case Bs{+cur, False{}, ok}:
1268          bits.run(t, sets, start, atn, hit1, bits.go(bits.idle(start, cur, atn, c), sets, atn, hit1, cur, c))

Uses (12)

Used by (1)