def value.with

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

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

1401# ": ": a value. When a simple key waits, it becomes a key: a KeyTok goes
1402# before it, and a block mapping may start at its column.
1403def value.with(k: SKey, +st: Sc) -> Step:
1404  match k:
1405    case SKey{possible, required, +number, +at, tab, low}:
1406      +rolls = Bool.and(Nat.is_eq(sc.flow(st), 0n), Nat.is_lt(sc.ind(st), 1n+T.mark.col(at)))
1407      when(Step, possible,
1408        u => when(Step, Bool.and(tab, rolls), u => fail(st, "found a tab character that violates indentation", at),
1409          u => Go{single(sc.allow(roll(insert.key(st, number, at), T.mark.col(at), Some{number}, T.BMapStart{}, at), False{}), T.ValueTok{})}),
1410        u => value.alone(st))

Uses (20)

Used by (1)