def bind_name
bolt@1.27.0.0 · src/rules/table.bend:143
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
143
144def bind_name(nn: Tree.Node, +seen: Bool, +bad: Bool, +nm: String) -> String:
145 match nn:
146 case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TEq{}, t, l, c}}, rest}:
147 bind_at(seen, bad, nm)
148 case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TName{}, +t, l, c}}, rest}:
149 bind_name(rest, True{}, Bool.or(bad, seen), t)
150 case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TUpper{}, t, l, c}}, rest}:
151 bind_name(rest, seen, True{}, nm)
152 case Tree.NCons{Tree.Group{open, kids, close}, rest}:
153 bind_name(rest, seen, bad, nm)
154 case Tree.NCons{h, rest}:
155 bind_name(rest, seen, bad, nm)
156 case other:
157 ""