def skip.check

yaml-for-bend@0.1.1.0 · scan.bend:695

import yaml-for-bend@0.1.1.0/scan.bend as Scan
import Base

695# What the skipped whitespace allows: no tab where block indentation
696# belongs, and in flow, lines indented past the block around them.
697def skip.check(k: Skipped, +st: Sc) -> Step:
698  match k:
699    case Skipped{+cur, +allowed, +tab, +nl, +sp, +bad}:
700      +content = Bool.not(is_end(peek(cur.s(cur), 0n)))
701      +at = cur.at(cur)
702      when(Step, Bool.and(bad, content), u => fail(st, "found a tab character where an indentation space is expected", at),
703        u => when(Step, Bool.and(Bool.and(sc.in_flow(st), nl), Bool.and(content, Nat.is_lt(sp, sc.ind(st)))),
704          u => fail(st, "did not find expected indentation in a flow collection", at),
705          u => Go{skipped(Skipped{cur, allowed, tab, nl, sp, bad}, st)}))

Uses (15)

Used by (1)