Skip to main content

saphyr_parser_bw/
lib.rs

1// Copyright 2015, Yuheng Chen.
2// Copyright 2023, Ethiraric.
3// See the LICENSE file at the top-level directory of this distribution.
4
5//! YAML 1.2 parser implementation in pure Rust.
6//!
7//! **If you want to load to a YAML Rust structure or manipulate YAML objects, use `saphyr` instead
8//! of `saphyr-parser`. This crate contains only the parser.**
9//!
10//! This is YAML 1.2 parser implementation and low-level parsing API for YAML. It allows users to
11//! fetch a stream of YAML events from a stream of characters.
12//!
13//! # Usage
14//!
15//! This crate is [on github](https://github.com/saphyr-rs/saphyr-parser) and can be used by adding
16//! `saphyr-parser` to the dependencies in your project's `Cargo.toml`:
17//!
18//! ```sh
19//! cargo add saphyr-parser
20//! ```
21//!
22//! # Features
23//! **Note:** With all features disabled, this crate's MSRV is `1.65.0`.
24//!
25//! #### `debug_prints`
26//! Enables the `debug` module and usage of debug prints in the scanner and the parser. Do not
27//! enable if you are consuming the crate rather than working on it as this can significantly
28//! decrease performance.
29//!
30//! The MSRV for this feature is `1.70.0`.
31//!
32//! This feature is _not_ `no_std` compatible.
33
34#![forbid(unsafe_code)]
35#![warn(missing_docs, clippy::pedantic)]
36#![no_std]
37
38#[macro_use]
39extern crate alloc;
40
41#[cfg(feature = "debug_prints")]
42extern crate std;
43
44mod char_traits;
45#[macro_use]
46mod debug;
47pub mod input;
48mod parser;
49/// A stack-based parser implementation.
50pub mod parser_stack;
51mod scanner;
52
53pub use crate::input::{str::StrInput, BorrowedInput, BufferedInput, Input};
54pub use crate::parser::{Event, EventReceiver, Parser, ParserTrait, SpannedEventReceiver, Tag};
55pub use crate::scanner::{Marker, ScalarStyle, ScanError, Scanner, Span, Token, TokenType};