def classify

bolt@1.27.0.0 · src/syntax/tree.bend:317

import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex

317# a statement's kind from its own tokens
318def classify(kids: Node) -> StmtKind:
319  match kids:
320    case NCons{Leaf{Lex.Tok{Lex.TKey{}, t, l, c}}, rest}:
321      keyword_kind(t)
322    case NCons{Leaf{Lex.Tok{Lex.TAll{}, t, l, c}}, rest}:
323      Bool.pick(StmtKind, arrow(rest), STerm{}, SDef{})
324    case other:
325      Bool.pick(StmtKind, binds_in(other), SLet{}, STerm{})

Uses (8)

Used by (1)