Crate yaml_peg[][src]

Expand description

A YAML 1.2 parser using greedy parsing algorithm with PEG atoms.

The major purpose of this crate is to let the user build their own YAML reader / builder / validator.

This parser is not ensure about YAML spec but almost functions are well-implemented. (test case is here)

The buffer reader has also not implemented, but the chunks can be read by sub-parsers.

Function parse is used to parse YAML string into Node data structure, which has a data holder Yaml. There also has multiple thread version corresponding to parse_arc, ArcNode, ArcYaml. To get back as string, please use dump function.

There are also have some macros for building NodeBase structure from Rust data. Especially node! / node_arc! macro, almost data can be built by the macro literally.

If you went to rise your own error message, indicated_msg might be a good choice.

The anchor system is implemented by using std::rc::Rc and std::sync::Arc as inner handler, please see AnchorVisitor.

Re-exports

pub use crate::dumper::dump;
pub use crate::parser::parse;
pub use crate::parser::parse_arc;

Modules

Dumper components.

Parser components.

This module contains representation holder, the reference counter type.

Macros

Create Node items literally.

node! macro for ArcNode.

Create YamlBase::Array items literally.

Create YamlBase::Map items literally.

Structs

Readonly node, including line number, column number, type assertion and anchor. You can access YamlBase type through NodeBase::yaml method.

Enums

YAML data types, but it is recommended to use Node for shorten code.

Functions

Create a visitor by visiting all nodes of the data.

Indicate the position of the documentation. This function will show the line number and column number of the position.

Type Definitions

Anchor visitor is made by a hash map that you can get the node reference inside.

A node with std::sync::Arc holder.

A YAML data with std::sync::Arc holder.

The array data structure of YAML.

The map data structure of YAML.

A node with std::rc::Rc holder.

A YAML data with std::rc::Rc holder.