def stale.go
yaml-for-bend@0.1.1.0 · scan.bend:540
import yaml-for-bend@0.1.1.0/scan.bend as Scan
import Base
import yaml-for-bend@0.1.1.0/token.bend as T
540
541
542
543def stale.go(keys: List<&2, SKey>, +at: T.Mark) -> Result<&2, &2, T.Error, List<&2, SKey>>:
544 match keys:
545 case Nil{}:
546 Done{[]}
547 case Con{k, +rest}:
548 match k:
549 case SKey{+possible, +required, +number, +kat, +tab, +low}:
550 +old = Bool.and(possible, is_stale(kat, at))
551 when(Result<&2, &2, T.Error, List<&2, SKey>>, Bool.not(low.stale(low, at)), u => Done{SKey{possible, required, number, kat, tab, low} <> rest},
552 u => when(Result<&2, &2, T.Error, List<&2, SKey>>, Bool.and(old, required),
553 u => Fail{T.Error{"could not find expected ':' while scanning a simple key", kat, T.Syntax{}}},
554 u => stale.cons(Bool.and(possible, Bool.not(old)), required, number, kat, tab, stale.go(rest, at))))