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. To get back as string, please use dump function.

There are also have some macros for building Node structure from Rust data. Especially node! 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.

Please be aware that the anchor system must be done by your self to prevent recursive problem. This crate is only store the anchor information in Yaml::Anchor and Node::anchor. A reference counter system maybe the best choice.

Re-exports

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

Modules

dumper

Dumper components.

parser

Parser components.

Macros

node

Create Node items literally.

yaml_array

Create Yaml::Array items literally.

yaml_map

Create Yaml::Map items literally.

Structs

Node

Parser node, includes line number, column number, type assertion and anchor.

Enums

Yaml

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

Functions

indicated_msg

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

Type Definitions

Array

The array data structure of YAML.

Map

The map data structure of YAML.