ron_reboot/utf8_parser/
mod.rs1use crate::{ast, ast::Ron, Error, utf8_parser::ok::IOk};
2
3use self::{
4 containers::{list, rmap, tuple, untagged_struct},
5 error::{BaseErrorKind, Expectation, InputParseErr},
6 input::Input,
7 primitive::{bool, decimal, escaped_string, signed_integer, unescaped_str, unsigned_integer},
8 ron::expr,
9};
10pub use self::error::{ErrorTree, InputParseError};
11
12type IResultLookahead<'a, O> = Result<IOk<'a, O>, InputParseErr<'a>>;
14type OutputResult<'a, O> = Result<O, InputParseErr<'a>>;
15
16mod basic;
18mod combinators;
20mod containers;
22mod error;
24mod error_fmt;
25mod input;
27mod ok;
28mod primitive;
30mod pt;
32mod ron;
34#[cfg(feature = "utf8_parser_serde1")]
35pub mod serde;
36#[cfg(test)]
37mod tests;
38mod util;
40#[cfg(any(test, feature = "test"))]
43pub mod test_util;
44
45pub fn ast_from_str(input: &str) -> Result<Ron, crate::error::Error> {
46 let pt: pt::Ron = ron::ron(input)
47 .map_err(ErrorTree::calc_locations)
48 .map_err(Error::from)
49 .map_err(|e| e.context_file_content(input.to_owned()))?;
50 let ast: ast::Ron = pt.into();
51
52 Ok(ast)
53}