def spin
bend-kit-regex@0.8.0.0 · regex.bend:1823
import bend-kit-regex@0.8.0.0/regex.bend as Regex
import Base
1823def spin(fuel: Nat, s: SpinStep, +len: U32, +id: U32, +cap: U32) -> Spin:
1824 match fuel:
1825 case 0n:
1826 SpinStep{a, tab, i, tr} = s
1827 Spin{a, tab, i}
1828 case 1n+f:
1829 SpinStep{a, tab, +i, tr} = s
1830 match tr:
1831 case TrSame{}:
1832 +j = (i + 1 : U32)
1833 spin(f, spin.state(spin.byte(Bool.not(U32.is_lt((j + 1 : U32), len)), a, j), tab, j, id, cap), len, id, cap)
1834 case TrNo{}:
1835 Spin{a, tab, i}
1836 case Tr{next, hit, outs, fresh}:
1837 Spin{a, tab, i}