1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2015, Yuheng Chen.
// Copyright 2023, Ethiraric.
// See the LICENSE file at the top-level directory of this distribution.
//! YAML 1.2 parser implementation in pure Rust.
//!
//! `granit-parser` is a low-level event parser. It reads YAML input and yields a stream of
//! [`Event`] values paired with their source [`Span`].
//!
//! Add it to your project:
//!
//! ```sh
//! cargo add granit-parser
//! ```
//!
//! # Usage
//!
//! ```rust
//! use granit_parser::{Event, Parser};
//!
//! # fn main() -> Result<(), granit_parser::ScanError> {
//! let yaml = "items:\n - milk\n - bread\n";
//!
//! for next in Parser::new_from_str(yaml) {
//! let (event, _span) = next?;
//! if let Event::Scalar(value, ..) = event {
//! println!("{value}");
//! }
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Features
//! **Note:** This crate's MSRV is `1.81.0`.
//!
//! #### `debug_prints`
//! Enables the `debug` module and usage of debug prints in the scanner and the parser. Do not
//! enable if you are consuming the crate rather than working on it as this can significantly
//! decrease performance. Output remains opt-in behind a local compile-time toggle in
//! `src/debug.rs`.
//!
//! This feature does not raise the MSRV further.
//!
//! This feature is _not_ `no_std` compatible.
extern crate alloc;
extern crate std;
/// A stack-based parser implementation.
pub use crate;
pub use crate;
pub use crate;