Tree.depth_to: def of bolt@1.27.0.0 Import: import bolt@1.27.0.0/src/syntax/tree.bend as Tree Lines 197-208 of bolt@1.27.0.0/src/syntax/tree.bend: https://jend.leeeet.dev/read.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&start_line=197&end_line=208 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 # how many groups sit open above the one that c closes (counting it); 0 when # none does. A `>` closes only an angle group on top: inside `(..)`, `[..]` # or `{..}` it is an operator, even within `<..>` def depth_to(stack: List<&2, Frame>, +cc: String) -> Nat: match stack: case Nil{}: 0n case Con{FGroup{Lex.Tok{k, +t, l, c2}, kids}, rest}: Lazy.stop(Nat, String.eq(closer(t), cc), 1n, _u => Lazy.stop(Nat, String.eq(cc, ">"), 0n, _v => depth_to.up(depth_to(rest, cc)))) case Con{other, rest}: 0n Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.eq https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/lazy/lazy.bend&name=stop https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=Tok https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=Frame https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=closer https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=depth_to.up