def last_text

bolt@1.27.0.0 · src/syntax/bind.bend:162

import bolt@1.27.0.0/src/syntax/bind.bend as Bind
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

162# the text of a chain's last leaf
163def last_text(kids: Tree.Node) -> String:
164  match kids:
165    case Tree.NCons{Tree.Leaf{Lex.Tok{k, t, l, c}}, Tree.NNil{}}:
166      t
167    case Tree.NCons{h, rest}:
168      last_text(rest)
169    case other:
170      ""

Uses (3)

Used by (1)