def AaGlob.rank
import bend-osdev-apparmor@0.1.0.0/glob.bend as Globimport Base
405# 0: no match; 1 + prefix length for a pattern; 1000000 for a literal match
406def AaGlob.rank(g: AaGlob, +s: List<&2, U32>) -> U32:
407 match g:
408 case AaGlob{alts, literal}:
409 match literal:
410 case True{}:
411 Bool.pick(U32, AaGlob.matches.go(alts, s), 1000000, 0)
412 case False{}:
413 AaGlob.rank.go(alts, s, 0)