Skip to main content

oni_comb_parser/
prelude.rs

1pub use crate::byte_input::ByteInput;
2pub use crate::parser::Parser;
3pub use crate::parser_ext::ParserExt;
4pub use crate::str_input::StrInput;
5
6// ジェネリックプリミティブパーサー(StrInput / ByteInput 両対応)
7pub use crate::primitive::eof::eof;
8pub use crate::primitive::none_of::none_of;
9pub use crate::primitive::one_of::one_of;
10pub use crate::primitive::satisfy::satisfy;
11pub use crate::primitive::take::take;
12pub use crate::primitive::take_till0::take_till0;
13pub use crate::primitive::take_till1::take_till1;
14pub use crate::primitive::take_while0::take_while0;
15pub use crate::primitive::take_while1::take_while1;
16pub use crate::primitive::take_while_n_m::take_while_n_m;
17
18// text 専用パーサー(StrInput のみ)
19pub use crate::text::char::char;
20pub use crate::text::identifier::identifier;
21pub use crate::text::integer::integer;
22pub use crate::text::lexeme::lexeme;
23pub use crate::text::tag::tag;
24pub use crate::text::whitespace::{whitespace0, whitespace1};
25
26#[cfg(feature = "alloc")]
27pub use crate::text::escaped::escaped;
28#[cfg(feature = "alloc")]
29pub use crate::text::quoted_string::quoted_string;
30
31pub use crate::combinator::fn_parser::fn_parser;
32#[cfg(feature = "alloc")]
33pub use crate::combinator::recursive::recursive;
34
35#[cfg(feature = "regex")]
36pub use crate::text::regex::{regex, RegexBuildError};
37
38/// left, parser, right を順に実行し、parser の値だけを返す。
39pub fn between<I, L, P, R>(
40  left: L,
41  parser: P,
42  right: R,
43) -> crate::combinator::zip_right::ZipRight<L, crate::combinator::zip_left::ZipLeft<P, R>>
44where
45  I: crate::input::Input,
46  L: crate::parser::Parser<I>,
47  P: crate::parser::Parser<I, Error = L::Error>,
48  R: crate::parser::Parser<I, Error = L::Error>, {
49  left.zip_right(parser.zip_left(right))
50}