def built

bolt@1.27.0.0 · src/rules/table.bend:76

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

76# a list literal, a sized array, or a constant-size constructor
77def built(nn: Tree.Node) -> Bool:
78  match nn:
79    case Tree.NCons{Tree.Group{Lex.Tok{k, +o, l, c}, +kids, close}, Tree.NNil{}}:
80      Bool.and(String.eq(o, "["), Bool.or(top_has(kids, ","), Bool.and(top_has(kids, ":"), array_sized(kids))))
81    case Tree.NCons{Tree.Leaf{Lex.Tok{k, +t, l, c}},
82        Tree.NCons{Tree.Group{Lex.Tok{_, +o, _, _}, +kids, _}, Tree.NNil{}}}:
83      Bool.and(String.eq(o, "("), built_call(t, kids))
84    case other:
85      False{}

Uses (9)

Used by (3)