std/yaml/schema
std/yaml/src/schema.trb
What a scalar is: the schemas of the specification, which say what a plain scalar without a tag resolves to, and the readers of the texts every schema shares - null, truth values, whole numbers, floating point numbers, base64.
A typed decode does not need a schema: the field's type says what it wants, and the text is read as that. The schema is for a document read without a type.
type YamlSchema
type YamlSchema
How a plain scalar without a tag is read where no type says what it is.
Examples
use Yaml from "std/yaml"
const yaml = Yaml schema: Some(YamlSchema.Json)
print yaml.value("[1, true, null]")
case Failsafe
case Failsafe
Every scalar is a text.
case Json
case Json
null, true, false and JSON's numbers; any other plain scalar is an error.
case Core
case Core
YAML 1.2's schema, and the default: null, Null, NULL, ~ and the empty scalar are null, true and false
in three spellings are truth values, decimal, 0o octal and 0x hexadecimal whole numbers, floating point numbers
with .inf and .nan, and everything else is a text.
case Yaml11
case Yaml11
YAML 1.1's types, for a document that says %YAML 1.1: yes, no, on, off, y and n are truth values
too, 0b binary and 0 octal numbers and _ between digits, base 60 (1:30:00), and timestamps, which stay texts.