def array_sized
bolt@1.27.0.0 · src/rules/table.bend:37
import bolt@1.27.0.0/src/rules/table.bend as Table
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
37
38def array_sized(nn: Tree.Node) -> Bool:
39 match nn:
40 case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TOp{}, +op, l, c}},
41 Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TNum{}, t, l2, c2}}, rest}}:
42 +here = Bool.or(String.eq(op, "*"), String.eq(op, "^"))
43 +more = array_sized(rest)
44 Bool.or(here, more)
45 case Tree.NCons{Tree.Group{open, kids, close}, rest}:
46 array_sized(rest)
47 case Tree.NCons{h, rest}:
48 array_sized(rest)
49 case other:
50 False{}