def AaGNfa.sem
import bend-osdev-apparmor@0.1.0.0/glob.bend as Globimport Base
import bend-osdev-apparmor@0.1.0.0/text.bend as X
164# what a set of positions accepts: some active position's suffix matches s
165def AaGNfa.sem(+seq: List<&2, AaGTok>, +bs: List<&2, Bool>, +s: List<&2, U32>) -> Bool:
166 match seq:
167 case Nil{}:
168 Bool.and(AaGNfa.hd(bs), X.AaText.is_nil(s))
169 case Con{tok, r}:
170 Bool.or(Bool.and(AaGNfa.hd(bs), AaGSeq.matches(Con{tok, r}, s)), AaGNfa.sem(r, AaGNfa.tl(bs), s))