def depth_to
bolt@1.27.0.0 · src/syntax/tree.bend:197
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
197
198
199
200def depth_to(stack: List<&2, Frame>, +cc: String) -> Nat:
201 match stack:
202 case Nil{}:
203 0n
204 case Con{FGroup{Lex.Tok{k, +t, l, c2}, kids}, rest}:
205 Lazy.stop(Nat, String.eq(closer(t), cc), 1n,
206 _u => Lazy.stop(Nat, String.eq(cc, ">"), 0n, _v => depth_to.up(depth_to(rest, cc))))
207 case Con{other, rest}:
208 0n