| 1 |
//! TOML lexer and parser |
| 2 |
//! |
| 3 |
//! Characteristics: |
| 4 |
//! - Error recovery |
| 5 |
//! - Lazy validation |
| 6 |
//! - `forbid(unsafe)` by default, requiring the `unsafe` feature otherwise |
| 7 |
//! - `no_std` support, including putting users in charge of allocation choices (including not |
| 8 |
//! allocating) |
| 9 |
//! |
| 10 |
//! Full parsing is broken into three phases: |
| 11 |
//! 1. [Lexing tokens][lexer] |
| 12 |
//! 2. [Parsing tokens][parser] (push parser) |
| 13 |
//! 3. Organizing the physical layout into the logical layout, |
| 14 |
//! including [decoding keys and values][decoder] |
| 15 |
|
| 16 |
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)] |
| 17 |
#![cfg_attr(docsrs, feature(doc_cfg))] |
| 18 |
#![cfg_attr(not(feature = "unsafe"), forbid(unsafe_code))] |
| 19 |
#![warn(clippy::std_instead_of_core)] |
| 20 |
#![warn(clippy::std_instead_of_alloc)] |
| 21 |
#![warn(clippy::print_stderr)] |
| 22 |
#![warn(clippy::print_stdout)] |
| 23 |
|
| 24 |
#[cfg(feature = "alloc")] |
| 25 |
extern crate alloc; |
| 26 |
|
| 27 |
#[macro_use] |
| 28 |
mod macros; |
| 29 |
|
| 30 |
#[cfg(feature = "debug")] |
| 31 |
pub(crate) mod debug; |
| 32 |
mod error; |
| 33 |
mod source; |
| 34 |
|
| 35 |
pub mod decoder; |
| 36 |
pub mod lexer; |
| 37 |
pub mod parser; |
| 38 |
|
| 39 |
pub use error::ErrorSink; |
| 40 |
pub use error::Expected; |
| 41 |
pub use error::ParseError; |
| 42 |
pub use source::Raw; |
| 43 |
pub use source::Source; |
| 44 |
pub use source::SourceIndex; |
| 45 |
pub use source::Span; |
| 46 |
|
| 47 |
#[doc = include_str!("../README.md")] |
| 48 |
#[cfg(doctest)] |
| 49 |
pub struct ReadmeDoctests; |