~/bend-docscommunity

core.bend checks

raw source on the hub · import yaml-for-bend@0.1.0.0/core.bend as Core

The YAML 1.2 Core schema: how a scalar's text and tag become a value.

An untagged plain scalar is null (null, Null, NULL, ~ or nothing), a boolean (true/True/TRUE, false/False/FALSE), an integer (decimal, 0o octal, 0x hex), a float (decimal, .inf, -.inf, .nan) or else a string. A quoted or block scalar, or one tagged "!", is a string. A standard tag (!!str, !!null, !!bool, !!int, !!float) reads the text as that type, and fails when it can't; any other tag is kept as a Tagged value.

4 imports
import Base
import ./value.bend as V
import ./re.bend as R
import ./num.bend as N

Definitions

def yaml.tag source · line 18 · raw

@name:String -> String

def when source · line 21 · raw

@-A:Type -> @hit:Bool -> @yes:(@_:Unit -> A) -> @no:(@_:Unit -> A) -> A

def is_null source · line 28 · raw

@+s:String -> Bool

def is_true source · line 31 · raw

@+s:String -> Bool

def is_false source · line 34 · raw

@+s:String -> Bool

def dec.pat source · line 37 · raw

List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>

def oct.pat source · line 40 · raw

List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>

def hex.pat source · line 43 · raw

List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>

def float.pat source · line 47 · raw

List<&2, 0x36754ca959c7683aed7402df6aa2fca0/re.Pat>

[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?

def is_inf source · line 51 · raw

@+s:String -> Bool

def is_nan source · line 54 · raw

@+s:String -> Bool

def unsigned source · line 57 · raw

@s:String -> String

def is_neg source · line 70 · raw

@s:String -> Bool

def int.of source · line 74 · raw

@+s:String -> Maybe<&2, String>

An integer's decimal text, if +s+ is one.

def float.of source · line 80 · raw

@+s:String -> Maybe<&2, String>

A float's text, if +s+ is one: as written, or ".inf", "-.inf", ".nan".

def or.int source · line 86 · raw

@m:Maybe<&2, String> -> @s:String -> @rest:(@_:Unit -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml) -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml

def or.float source · line 93 · raw

@m:Maybe<&2, String> -> @rest:(@_:Unit -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml) -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml

def plain source · line 101 · raw

@+s:String -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml

An untagged plain scalar.

def must source · line 107 · raw

@m:Maybe<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml> -> @+tag:String -> @+s:String -> Result<&2, &2, String, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>

def int.yaml source · line 114 · raw

@m:Maybe<&2, String> -> Maybe<&2, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>

def float.yaml source · line 122 · 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 tagged source · line 135 · raw

@+tag:String -> @+s:String -> Result<&2, &2, String, 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml>

A scalar with a tag: !!str, !!null, !!bool, !!int and !!float read the text; "!" is a string; another tag is kept.

def collection source · line 145 · raw

@+tag:String -> @+v:0x36754ca959c7683aed7402df6aa2fca0/value.Yaml -> 0x36754ca959c7683aed7402df6aa2fca0/value.Yaml

A collection with a tag: "!", !!seq and !!map are plain; another is kept.