def co.step

yaml-for-bend@0.1.1.0 · compose.bend:504

import yaml-for-bend@0.1.1.0/compose.bend as Compose
import Base
import yaml-for-bend@0.1.1.0/token.bend as T
import yaml-for-bend@0.1.1.0/parse.bend as P

504def co.step(e: P.Evt, +co: Co, +s: Schema, +c: Caps) -> Result<&2, &2, T.Error, Co>:
505  match e:
506    case P.Evt{ev, +at}:
507      match ev:
508        case P.StreamStartEv{}:
509          Done{co}
510        case P.StreamEndEv{}:
511          Done{co}
512        case P.DocStartEv{explicit}:
513          Done{co.doc.start(co, at)}
514        case P.DocEndEv{explicit}:
515          Done{co.doc.end(co)}
516        case P.AliasEv{name}:
517          co.alias(co, name, caps.aliases(c), at)
518        case P.ScalarEv{anchor, +tag, +text, style}:
519          +plain = is_plain(style)
520          when(Result<&2, &2, T.Error, Co>, too.long(s, tag, text, plain, caps.digits(c)),
521            u => Fail{limit.error("found a number in another base longer than the digits limit of " ++ Nat.show(caps.digits(c)), at)},
522            u => node.done(scalar.value(s, tag, text, plain), co, anchor, is_merge(s, tag, text, plain), 1n, 1n, at))
523        case P.SeqStartEv{anchor, tag, flow}:
524          co.push(co, OSeq{anchor, tag, [], co.count(co), at}, caps.depth(c), at)
525        case P.SeqEndEv{}:
526          co.close(co)
527        case P.MapStartEv{anchor, tag, flow}:
528          co.push(co, OMap{anchor, tag, [], co.count(co), at}, caps.depth(c), at)
529        case P.MapEndEv{}:
530          co.close(co)

Uses (27)

Used by (1)