Expand description
A core-subset YAML grammar plugin for the
tabnas parsing engine.
Unlike most tabnas grammars this one layers on
tabnas_jsonic rather than on the
bare engine: YAML’s flow collections are relaxed JSON, and the block
forms are added around jsonic’s val / map / list / pair /
elem rules.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let value = tabnas_yaml::parse("name: Alice\nitems:\n - one\n - two\n")?;
assert_eq!(
value.to_string(),
r#"{"name":"Alice","items":["one","two"]}"#
);
Ok(())
}Structs§
- Translation
Part - One optional alchemy translation source and its explicit entry point.
- Translation
Parts - The package-local structural translation interface.
- Yaml
Error - Errors this crate returns are the engine’s, re-exported so a caller
does not need
tabnasin scope to name them. - Yaml
Options - The options this plugin takes.
Enums§
- Schema
- A schema a plain scalar may be resolved by.
Constants§
- VERSION
- VERSION is this package’s version. It MUST equal
ts/package.json“version”: the release orchestrator rewrites all three constants, andtests/version_test.rsfails the build if they drift. Mirrorsconst VERSIONints/src/yaml.tsandgo/yaml.go.
Functions§
- make
- Build a YAML parser with the default options.
- make_
with - Build a YAML parser with caller options.
- manifest_
text - The plugin’s manifest,
tabnas.plugin.json, as the repository carries it. Itstranslateobject is what a host that translates reads: the shape YAML is read as and written from (tree), the file that holds the render, the sentences that say what the render does not keep, and the file that holds the transducer part (transduce), the document’s JSON events from the grammar’s rule passes under its default options, through which a host that reads parser events reads a document. The crate embeds its own copies,translate/manifest.jsonandtranslate/transduce.alc, since a packaged crate holds nothing outsiders/;tests/translate_test.rsholds each copy to its file. - parse
- Parse a YAML source string with the shared default parser.
- plugin
- The plugin form of
yaml, forTabnas::use_plugin. Installed this way the grammar is re-applied to derived instances, as every native plugin is. - render_
text - YAML’s render,
alchemy/render.alc, the file the manifest’stranslate.rendernames: a library of alchemy definitions, with noexport, whose entry pointyaml-renderwrites a tree’s events as one YAML document. A host links it with its own program. The crate embeds its own copy,translate/render.alc, held to the file as the manifest’s is. - translate
- Return YAML’s immutable translation parts.
- yaml
- Install YAML on a jsonic-enabled
parser.