def close.depth
import bolt@1.27.0.0/src/rules/suspicious/empty.bend as Emptyimport Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
135# a bracket at the depth: the length's own `)` at depth zero; else the depth
136# it leaves
137def close.depth(kk: Lex.TokKind, dd: Nat) -> Nat:
138 match kk:
139 case Lex.TOpen{}:
140 1n+dd
141 case Lex.TClose{}:
142 match dd:
143 case 0n:
144 0n
145 case 1n+p:
146 p
147 case other:
148 dd