def pl.word

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

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

729# In a word: a blank ends it; ": " or a flow indicator in flow ends the scalar.
730def pl.word(cur: Cur, +acc: String, +end: T.Mark, +ws: String, +lead: Bool, +brks: Nat, +flow: Bool) -> Pl:
731  match cur:
732    case Cur{+s, +at, +left}:
733      +c = peek(s, 0n)
734      +c1 = peek(s, 1n)
735      +stop = Bool.or(Bool.and(Char.is_eq(c, ':'), Bool.or(is_blankz(c1), Bool.and(flow, is_flow.ind(c1)))), Bool.and(flow, is_flow.ind(c)))
736      Bool.pick(Pl, is_blankz(c), Pl{Cur{s, at, left}, acc, end, ws, lead, brks, False{}, False{}},
737        Bool.pick(Pl, stop, PlDone{Cur{s, at, left}, acc, end, lead},
738          Pl{Cur{String.drop(s, 1n), past(at, c), Nat.sub(left, 1n)}, SCon{c, flush(acc, ws, lead, brks)}, past(at, c), "", False{}, 0n, True{}, False{}}))

Uses (18)

Used by (1)