yaml11.bend checks
raw source on the hub · import yaml-for-bend@0.1.0.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
0x36754ca959c7683aed7402df6aa2fca0/re.Pat
def digits_ source · line 46 · raw
0x36754ca959c7683aed7402df6aa2fca0/re.Pat
def bin.pat source · line 49 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def oct.pat source · line 52 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def dec.pat source · line 55 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def hex.pat source · line 58 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def sexa.part source · line 61 · raw
0x36754ca959c7683aed7402df6aa2fca0/re.Pat
def sexa.int.pat source · line 64 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def float.pat source · line 67 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def sexa.float.pat source · line 70 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def ymd.pat source · line 73 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>
def blank source · line 76 · raw
0x36754ca959c7683aed7402df6aa2fca0/re.Pat
def time.pat source · line 79 · raw
List<&2, 0x36754ca959c7683aed7402df6aa2fca0/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 before.dot source · line 139 · raw
@s:String -> String
def after.dot source · line 150 · raw
@s:String -> String
def sexa.float source · line 162 · raw
@+s:String -> String
A base-60 float: the whole part in base 60, then the fraction.
def float.of source · line 167 · raw
@+s:String -> Maybe<&2, String>
def int.of source · line 174 · raw
@+s:String -> Maybe<&2, String>
def or.int source · line 177 · raw
@m:Maybe<&2, String> -> @rest:(@_:Unit -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml) -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml
def or.float source · line 184 · raw
@m:Maybe<&2, String> -> @rest:(@_:Unit -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml) -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml
def plain source · line 192 · raw
@+s:String -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml
An untagged plain scalar.
def int.yaml source · line 199 · raw
@m:Maybe<&2, String> -> Maybe<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
def float.yaml source · line 207 · raw
@m:Maybe<&2, String> -> @i:Maybe<&2, String> -> Maybe<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
!!float: a float, or an integer written as one ("3" is 3.0).
def bool.yaml source · line 218 · raw
@+s:String -> Maybe<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
def tagged source · line 223 · raw
@+tag:String -> @+s:String -> Result<&2, &2, String, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>
A scalar with a tag: the standard types read the text in their 1.1 forms, !!merge is the merge key, "!" is a string; another tag is kept.