def AaFile.is_path

bend-osdev-apparmor@0.1.0.0 · rule_file.bend:303

import bend-osdev-apparmor@0.1.0.0/rule_file.bend as RuleFile
import Base
import bend-osdev-apparmor@0.1.0.0/text.bend as X
import bend-osdev-apparmor@0.1.0.0/token.bend as T

303# a term that is a pattern: a quoted string, or a word starting with '/' or
304# '{' (after variable expansion)
305def AaFile.is_path(t: T.AaTerm) -> Bool:
306  match t:
307    case T.AaTmWord{+w}:
308      Bool.or(U32.is_eq(X.AaText.head(w), 47), U32.is_eq(X.AaText.head(w), 123))
309    case T.AaTmQuoted{q}:
310      True{}
311    case T.AaTmList{xs}:
312      False{}
313    case T.AaTmCond{k, v}:
314      False{}
315    case T.AaTmArrow{}:
316      False{}

Uses (5)

Used by (3)