diff options
Diffstat (limited to '')
-rw-r--r-- | build/rust/nom/Cargo.toml | 15 | ||||
-rw-r--r-- | build/rust/nom/lib.rs | 26 |
2 files changed, 41 insertions, 0 deletions
diff --git a/build/rust/nom/Cargo.toml b/build/rust/nom/Cargo.toml new file mode 100644 index 0000000000..7a69aa23c1 --- /dev/null +++ b/build/rust/nom/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "nom" +version = "6.99.99" +edition = "2018" +license = "MPL-2.0" + +[lib] +path = "lib.rs" + +[dependencies.nom] +version = "7" +default-features = false + +[features] +std = ["nom/std"] diff --git a/build/rust/nom/lib.rs b/build/rust/nom/lib.rs new file mode 100644 index 0000000000..2e85191113 --- /dev/null +++ b/build/rust/nom/lib.rs @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Strict minimum to make glsl happy. +pub use nom::{branch, bytes, character, combinator, error, sequence, Err, IResult, ParseTo}; + +pub mod multi { + use nom::multi::fold_many0 as nom_fold_many0; + pub use nom::multi::{many0, many1, separated_list0}; + + pub fn fold_many0<I, O, E, F, G, R>( + f: F, + init: R, + g: G, + ) -> impl FnMut(I) -> nom::IResult<I, R, E> + where + I: Clone + nom::InputLength, + F: nom::Parser<I, O, E>, + G: FnMut(R, O) -> R, + E: nom::error::ParseError<I>, + R: Clone, + { + nom_fold_many0(f, move || init.clone(), g) + } +} |