def close_tok

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

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

232# a close bracket: to its match if it has one, else a stray leaf
233def close_tok(+stack: List<&2, Frame>, +close: Lex.Tok) -> List<&2, Frame>:
234  Lex.Tok{k, +t, l, c} = close
235  +n = depth_to(stack, t)
236  Lazy.stop(List<&2, Frame>, Nat.is_eq(n, 0n), put(stack, Leaf{close}), _u => close_n(n, stack, Some{close}))

Uses (10)

Used by (2)