def declared.name
import bolt@1.27.0.0/src/syntax/bind.bend as Bindimport 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
82# a leaf's name, when its kind is one: the kind is tested, the text only kept
83def declared.name(nn: Tree.Node) -> Maybe<&2, String>:
84 match nn:
85 case Tree.Leaf{Lex.Tok{k, t, l, c}}:
86 Bool.pick(Maybe<&2, String>, declared.is_name(k), Some{t}, None{})
87 case other:
88 None{}