summaryrefslogtreecommitdiffstats
path: root/build/rust/nom
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /build/rust/nom
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--build/rust/nom/Cargo.toml15
-rw-r--r--build/rust/nom/lib.rs26
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)
+ }
+}