Skip to content

Move nom into nom_core workspace and re-export #1787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ include = [
"tests/*.rs",
"doc/nom_recipes.md",
]
[dependencies]
nom_core = {path = "./nom_core"}

[features]
alloc = []
std = ["alloc", "memchr/std"]
alloc = ["nom_core/alloc"]
std = ["nom_core/std"]
default = ["std"]
docsrs = []

[dependencies.memchr]
version = "2.3"
default-features = false

[dev-dependencies]
doc-comment = "0.3"
proptest = "=1.0.0"
Expand Down Expand Up @@ -142,4 +140,4 @@ coveralls = { repository = "Geal/nom", branch = "main", service = "github" }
maintenance = { status = "actively-developed" }

[workspace]
members = [".", "benchmarks/"]
members = [".", "benchmarks/", "nom_core"]
18 changes: 18 additions & 0 deletions nom_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "nom_core"
version = "0.1.0"
edition = "2021"


[features]
alloc = []
std = ["alloc", "memchr/std"]
default = ["std"]
docsrs = []

[dependencies.memchr]
version = "2.3"
default-features = false
[dev-dependencies]
doc-comment = "0.3"
proptest = "=1.0.0"
2 changes: 2 additions & 0 deletions src/bits/complete.rs → nom_core/src/bits/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::traits::{Input, ToUsize};
///
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::bits::complete::take;
/// # use nom::IResult;
/// # use nom::error::{Error, ErrorKind};
Expand Down Expand Up @@ -107,6 +108,7 @@ where
///
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::bits::complete::bool;
/// # use nom::IResult;
/// # use nom::error::{Error, ErrorKind};
Expand Down
6 changes: 4 additions & 2 deletions src/bits/mod.rs → nom_core/src/bits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use crate::Input;
/// away.
///
/// # Example
/// ```
/// ```rust
/// # use nom_core as nom;
/// use nom::bits::{bits, streaming::take};
/// use nom::error::Error;
/// use nom::IResult;
Expand Down Expand Up @@ -63,7 +64,8 @@ where
/// A partial byte remaining in the input will be ignored and the given parser will start parsing
/// at the next full byte.
///
/// ```
/// ```rust
/// # use nom_core as nom;
/// use nom::bits::{bits, bytes, streaming::take};
/// use nom::combinator::rest;
/// use nom::error::Error;
Expand Down
1 change: 1 addition & 0 deletions src/bits/streaming.rs → nom_core/src/bits/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ where
///
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::bits::complete::bool;
/// # use nom::IResult;
/// # use nom::error::{Error, ErrorKind};
Expand Down
3 changes: 3 additions & 0 deletions src/branch/mod.rs → nom_core/src/branch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::internal::{Err, Mode, Parser};
/// use an array.
///
/// ```rust
/// # use nom_core as nom;
/// # use nom::error_position;
/// # use nom::{Err,error::ErrorKind, Needed, IResult, Parser};
/// use nom::character::complete::{alpha1, digit1};
Expand Down Expand Up @@ -49,6 +50,7 @@ pub fn alt<List>(l: List) -> Choice<List> {
/// tuple of the parser results.
///
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err,error::{Error, ErrorKind}, Needed, IResult, Parser};
/// use nom::character::complete::{alpha1, digit1};
/// use nom::branch::permutation;
Expand All @@ -71,6 +73,7 @@ pub fn alt<List>(l: List) -> Choice<List> {
/// The parsers are applied greedily: if there are multiple unapplied parsers
/// that could parse the next slice of input, the first one is used.
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, IResult, Parser};
/// use nom::branch::permutation;
/// use nom::character::complete::{anychar, char};
Expand Down
File renamed without changes.
19 changes: 17 additions & 2 deletions src/bytes/complete.rs → nom_core/src/bytes/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::OutputM;
/// It will return `Err(Err::Error((_, ErrorKind::Tag)))` if the input doesn't match the pattern
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::tag;
///
Expand Down Expand Up @@ -52,6 +53,7 @@ where
/// It will return `Err(Err::Error((_, ErrorKind::Tag)))` if the input doesn't match the pattern.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::tag_no_case;
///
Expand Down Expand Up @@ -89,6 +91,7 @@ where
/// It will return a `Err::Error(("", ErrorKind::IsNot))` if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::is_not;
///
Expand Down Expand Up @@ -119,6 +122,7 @@ where
/// It will return a `Err(Err::Error((_, ErrorKind::IsA)))` if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::is_a;
///
Expand Down Expand Up @@ -148,6 +152,7 @@ where
/// takes the input and returns a bool)*.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// use nom::bytes::complete::take_while;
/// use nom::AsChar;
Expand Down Expand Up @@ -179,6 +184,7 @@ where
/// It will return an `Err(Err::Error((_, ErrorKind::TakeWhile1)))` if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::take_while1;
/// use nom::AsChar;
Expand Down Expand Up @@ -210,6 +216,7 @@ where
/// of range (m <= len <= n).
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::take_while_m_n;
/// use nom::AsChar;
Expand Down Expand Up @@ -244,6 +251,7 @@ where
/// takes the input and returns a bool)*.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// use nom::bytes::complete::take_till;
///
Expand Down Expand Up @@ -276,6 +284,7 @@ where
/// predicate matches the first input.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::take_till1;
///
Expand Down Expand Up @@ -304,6 +313,7 @@ where
/// It will return `Err(Err::Error((_, ErrorKind::Eof)))` if the input is shorter than the argument.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::take;
///
Expand All @@ -322,6 +332,7 @@ where
/// take that many `u8`'s:
///
/// ```rust
/// # use nom_core as nom;
/// use nom::error::Error;
/// use nom::bytes::complete::take;
///
Expand All @@ -344,6 +355,7 @@ where
/// if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::take_until;
///
Expand Down Expand Up @@ -372,6 +384,7 @@ where
/// if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::take_until1;
///
Expand Down Expand Up @@ -401,7 +414,8 @@ where
/// * The second argument is the control character (like `\` in most languages)
/// * The third argument matches the escaped characters
/// # Example
/// ```
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// # use nom::character::complete::digit1;
/// use nom::bytes::complete::escaped;
Expand Down Expand Up @@ -440,7 +454,8 @@ where
///
/// As an example, the chain `abc\tdef` could be `abc def` (it also consumes the control character)
///
/// ```
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// # use std::str::from_utf8;
/// use nom::bytes::complete::{escaped_transform, tag};
Expand Down
18 changes: 16 additions & 2 deletions src/bytes/mod.rs → nom_core/src/bytes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::ToUsize;
/// the input that matches the argument.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::streaming::tag;
///
Expand Down Expand Up @@ -98,6 +99,7 @@ where
/// the input that matches the argument with no regard to case.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::streaming::tag_no_case;
///
Expand Down Expand Up @@ -213,6 +215,7 @@ where
/// It will return a `Err::Error(("", ErrorKind::IsNot))` if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::is_not;
///
Expand Down Expand Up @@ -245,6 +248,7 @@ where
/// It will return a `Err(Err::Error((_, ErrorKind::IsA)))` if the pattern wasn't met.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::complete::is_a;
///
Expand Down Expand Up @@ -276,6 +280,7 @@ where
/// takes the input and returns a bool)*.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// use nom::bytes::complete::take_while;
/// use nom::character::is_alphabetic;
Expand Down Expand Up @@ -312,6 +317,7 @@ where
///
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::streaming::take_while1;
/// use nom::character::is_alphabetic;
Expand Down Expand Up @@ -347,6 +353,7 @@ where
///
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::streaming::take_while_m_n;
/// use nom::character::is_alphabetic;
Expand Down Expand Up @@ -449,6 +456,7 @@ where
/// takes the input and returns a bool)*.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// use nom::bytes::complete::take_till;
///
Expand Down Expand Up @@ -483,6 +491,7 @@ where
/// end of input or if there was not match.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::streaming::take_till1;
///
Expand Down Expand Up @@ -520,6 +529,7 @@ where
///
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// use nom::bytes::streaming::take;
///
Expand Down Expand Up @@ -581,6 +591,7 @@ where
/// contain the pattern or if the input is smaller than the pattern.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// use nom::bytes::streaming::take_until;
///
Expand Down Expand Up @@ -644,6 +655,7 @@ where
/// contain the pattern or if the input is smaller than the pattern.
/// # Example
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
/// use nom::bytes::streaming::take_until1;
///
Expand Down Expand Up @@ -709,7 +721,8 @@ where
/// * The second argument is the control character (like `\` in most languages)
/// * The third argument matches the escaped characters
/// # Example
/// ```
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// # use nom::character::complete::digit1;
/// use nom::bytes::streaming::escaped;
Expand Down Expand Up @@ -874,7 +887,8 @@ where
///
/// As an example, the chain `abc\tdef` could be `abc def` (it also consumes the control character)
///
/// ```
/// ```rust
/// # use nom_core as nom;
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
/// # use std::str::from_utf8;
/// use nom::bytes::streaming::{escaped_transform, tag};
Expand Down
Loading