yaml.bend checks
raw source on the hub · import yaml-for-bend@0.1.0.0/yaml.bend as Yaml
YAML for Bend: read YAML text into values and write values back as YAML.
import ./yaml.bend as Y import ./value.bend as V
Y.load("a: [1, 2]") # Done{V.Mapping{[V.Entry{V.Str{"a"}, V.Seq{...}}]}}
load reads under the YAML 1.2 Core schema; load.v11 reads the YAML 1.1 types (yes/no booleans, 0 octal, base 60, timestamps, "<<" merges). Errors say what went wrong and where: T.error.show(e) is "mapping values are not allowed in this context at line 1 column 5".
6 imports
import Base import ./token.bend as T import ./parse.bend as P import ./value.bend as V import ./compose.bend as C import ./emit.bend as E
Definitions
def doc.vals source · line 25 · raw
@ds:List<&2, 0x36754ca959c7683aed7402df6aa2fca0/compose.Doc> -> List<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
def all.of source · line 34 · raw
@r:Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, List<&2, 0x36754ca959c7683aed7402df6aa2fca0/compose.Doc>> -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, List<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>>
def one.of source · line 41 · raw
@r:Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, List<&2, 0x36754ca959c7683aed7402df6aa2fca0/compose.Doc>> -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
def load.all.with source · line 62 · raw
@s:0x36754ca959c7683aed7402df6aa2fca0/compose.Schema -> @limit:Nat -> @text:String -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, List<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>>
Every document in +text+ under schema +s+, with aliases making at most +limit+ nodes in a document.
def load.with source · line 67 · raw
@s:0x36754ca959c7683aed7402df6aa2fca0/compose.Schema -> @limit:Nat -> @text:String -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
The one document in +text+ under schema +s+: null when there is none, an error when there are more.
def load source · line 73 · raw
@text:String -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
The one document in +text+ under the YAML 1.2 Core schema: null when there is none, an error when there are more. A repeated key is an error, and so is a document whose aliases make more than 100000 nodes.
def load.all source · line 77 · raw
@text:String -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, List<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>>
Every document in +text+, under the Core schema.
def load.v11 source · line 81 · raw
@text:String -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
load, reading the YAML 1.1 types.
def load.all.v11 source · line 85 · raw
@text:String -> Result<&2, &2, 0x36754ca959c7683aed7402df6aa2fca0/token.Error, List<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>>
load.all, reading the YAML 1.1 types.
def events source · line 90 · raw
@text:String -> 0x36754ca959c7683aed7402df6aa2fca0/parse.Parsed
The events of +text+, as the parser emits them, and the error that ended them early, if one did.
def dump source · line 94 · raw
@v:0x36754ca959c7683aed7402df6aa2fca0/value.Yaml -> String
+v+ as YAML text in block style, which load reads back as +v+.
def dump.all source · line 98 · raw
@vs:List<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml> -> String
Values as a stream of documents, each after "---".