def ev.text
yaml-for-bend@0.1.1.0 · parse.bend:735
import yaml-for-bend@0.1.1.0/parse.bend as Parse
import Base
735
736def ev.text(e: Ev) -> String:
737 match e:
738 case StreamStartEv{}:
739 "+STR"
740 case StreamEndEv{}:
741 "-STR"
742 case DocStartEv{explicit}:
743 Bool.pick(String, explicit, "+DOC ---", "+DOC")
744 case DocEndEv{explicit}:
745 Bool.pick(String, explicit, "-DOC ...", "-DOC")
746 case AliasEv{name}:
747 "=ALI *" ++ name
748 case ScalarEv{anchor, tag, text, style}:
749 "=VAL" ++ anchor.text(anchor) ++ tag.text(tag) ++ " " ++ style.mark(style) ++ escaped(text)
750 case SeqStartEv{anchor, tag, flow}:
751 "+SEQ" ++ flow.text(flow, "[]") ++ anchor.text(anchor) ++ tag.text(tag)
752 case SeqEndEv{}:
753 "-SEQ"
754 case MapStartEv{anchor, tag, flow}:
755 "+MAP" ++ flow.text(flow, "{}") ++ anchor.text(anchor) ++ tag.text(tag)
756 case MapEndEv{}:
757 "-MAP"