def kept

bolt@1.27.0.0 · src/rules/suspicious/empty.bend:201

import bolt@1.27.0.0/src/rules/suspicious/empty.bend as Empty
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex

201# is x read among the tokens before the bracket that closes the group they
202# sit in? found carries whether the last token read was x, live whether that
203# bracket is still ahead
204def kept(toks: List<&2, Lex.Tok>, +xx: String, +dd: Nat, found: Bool, live: Bool) -> Bool:
205  match toks:
206    case Nil{}:
207      found
208    case Con{Lex.Tok{+k, +t, l, c}, rest}:
209      match found:
210        case True{}:
211          True{}
212        case False{}:
213          match live:
214            case False{}:
215              False{}
216            case True{}:
217              kept(rest, xx, close.depth(k, dd), same(k, t, xx), Bool.not(close.here(k, dd)))

Uses (9)

Used by (1)