yaml11.bend checks
raw source on the hub · import yaml-for-bend@0.1.1.0/yaml11.bend as Yaml11
The YAML 1.1 types (yaml.org/type), for YAML written for 1.1 parsers.
An untagged plain scalar is null (~, null, Null, NULL or nothing), a boolean (yes, no, true, false, on, off, each lowercase, capitalized or uppercase), an integer (decimal, 0b binary, 0 octal, 0x hex, or base 60 as in 1:30:00, with "_" anywhere among the digits), a float (decimal, base 60 with a fraction, .inf, -.inf, .nan), a timestamp, or a string. A timestamp is Tagged{"tag:yaml.org,2002:timestamp", Str{text}}, the text as written. "<<" is the merge key, which the composer handles.
y, Y, n and N are strings, as in most 1.1 parsers, though the 1.1 type list has them as booleans.
5 imports
import Base import ./value.bend as V import ./re.bend as R import ./num.bend as N import ./core.bend as C
Definitions
def when source · line 24 · raw
@-A:Type -> @hit:Bool -> @yes:(@_:Unit -> A) -> @no:(@_:Unit -> A) -> A
def timestamp source · line 31 · raw
String
def is_true source · line 34 · raw
@+s:String -> Bool
def is_false source · line 37 · raw
@+s:String -> Bool
def d source · line 43 · raw
0x856d414a32087762da315b6efc605eaa/re.Pat
def digits_ source · line 46 · raw
0x856d414a32087762da315b6efc605eaa/re.Pat
def bin.pat source · line 49 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def oct.pat source · line 52 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def dec.pat source · line 55 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def hex.pat source · line 58 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def sexa.part source · line 61 · raw
0x856d414a32087762da315b6efc605eaa/re.Pat
def sexa.int.pat source · line 64 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def float.pat source · line 67 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def sexa.float.pat source · line 70 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def ymd.pat source · line 73 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def blank source · line 76 · raw
0x856d414a32087762da315b6efc605eaa/re.Pat
def time.pat source · line 79 · raw
List<&2, 0x856d414a32087762da315b6efc605eaa/re.Pat>
def is_timestamp source · line 85 · raw
@+s:String -> Bool
def no.seps source · line 91 · raw
@s:String -> String
def has_digit source · line 102 · raw
@s:String -> Bool
def sexa.go source · line 110 · raw
@parts:List<&2, String> -> @acc:List<&2, Nat> -> List<&2, Nat>
Base 60: each part is the next digit, "1:30" is 90.
def sexa.big source · line 117 · raw
@parts:List<&2, String> -> List<&2, Nat>
def int.of.digits source · line 124 · raw
@+ds:String -> String
def int.text source · line 131 · raw
@+s:String -> String
An integer's decimal text; +s+ already matched one of the integer forms.
def is_int source · line 135 · raw
@+s:String -> Bool
def in.base source · line 141 · raw
@+s:String -> Bool
Whether +s+ is an integer or float in a base other than ten, which takes time that grows with the square of its length to read.
def before.dot source · line 145 · raw
@s:String -> String
def after.dot source · line 156 · raw
@s:String -> String
def sexa.float source · line 168 · raw
@+s:String -> String
A base-60 float: the whole part in base 60, then the fraction.
def float.of source · line 173 · raw
@+s:String -> Maybe<&2, String>
def int.of source · line 180 · raw
@+s:String -> Maybe<&2, String>
def or.int source · line 183 · raw
@m:Maybe<&2, String> -> @rest:(@_:Unit -> 0x856d414a32087762da315b6efc605eaa/value.Yaml) -> 0x856d414a32087762da315b6efc605eaa/value.Yaml
def or.float source · line 190 · raw
@m:Maybe<&2, String> -> @rest:(@_:Unit -> 0x856d414a32087762da315b6efc605eaa/value.Yaml) -> 0x856d414a32087762da315b6efc605eaa/value.Yaml
def plain source · line 198 · raw
@+s:String -> 0x856d414a32087762da315b6efc605eaa/value.Yaml
An untagged plain scalar.
def int.yaml source · line 205 · raw
@m:Maybe<&2, String> -> Maybe<&2, 0x856d414a32087762da315b6efc605eaa/value.Yaml>
def float.yaml source · line 213 · raw
@m:Maybe<&2, String> -> @i:Maybe<&2, String> -> Maybe<&2, 0x856d414a32087762da315b6efc605eaa/value.Yaml>
!!float: a float, or an integer written as one ("3" is 3.0).
def bool.yaml source · line 224 · raw
@+s:String -> Maybe<&2, 0x856d414a32087762da315b6efc605eaa/value.Yaml>
def known source · line 229 · raw
@+tag:String -> Bool
The tags whose text YAML 1.1 reads: "!", !!str, !!merge, !!null, !!bool, !!int and !!float.
def read source · line 235 · raw
@+tag:String -> @+s:String -> Result<&2, &2, String, 0x856d414a32087762da315b6efc605eaa/value.Yaml>
A scalar's text read by a known tag, in its 1.1 forms: !!merge is the merge key, "!" and !!str are a string.
def read.or.keep source · line 243 · raw
@hit:Bool -> @+tag:String -> @+s:String -> Result<&2, &2, String, 0x856d414a32087762da315b6efc605eaa/value.Yaml>
A tag that isn't known is kept with the text, as data: no tag runs code.
def tagged source · line 251 · raw
@+tag:String -> @+s:String -> Result<&2, &2, String, 0x856d414a32087762da315b6efc605eaa/value.Yaml>
A scalar with a tag.