Skip to content

Commit

Permalink
remove core module for clarity; duplicate with core from Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Stargateur committed Mar 26, 2024
1 parent 9853f07 commit b0c011f
Show file tree
Hide file tree
Showing 74 changed files with 230 additions and 296 deletions.
6 changes: 2 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ The very same hex color example from nom but using binator:

```rust
use binator::{
Parse,
Parsed,
base::{
is,
uint_radix,
IntRadixParse,
Radix,
},
context::Ignore,
core::{
Parse,
Parsed,
},
utils::Utils,
};

Expand Down
2 changes: 1 addition & 1 deletion src/base/all.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::core::{
use crate::{
Contexting,
CoreAtom,
Parsed,
Expand Down
2 changes: 1 addition & 1 deletion src/base/any.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::core::{
use crate::{
Contexting,
CoreAtom,
Parsed,
Expand Down
4 changes: 2 additions & 2 deletions src/base/ascii.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//! ASCII Core Rules (RFC5234 B.1.)

use stdcore::fmt::{
use core::fmt::{
self,
Display,
Formatter,
};

use crate::{
base::*,
core::*,
utils::*,
*,
};

/// Meta trait for ascii combinator
Expand Down
2 changes: 1 addition & 1 deletion src/base/base_atom.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use stdcore::fmt::{
use core::fmt::{
Debug,
Display,
Formatter,
Expand Down
2 changes: 1 addition & 1 deletion src/base/character.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::core::{
use crate::{
any,
Contexting,
CoreAtom,
Expand Down
12 changes: 5 additions & 7 deletions src/base/end_of_stream.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use crate::{
base::any,
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Context from end_of_stream parser.
Expand Down
2 changes: 1 addition & 1 deletion src/base/failure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::{
fmt::Debug,
};

use crate::core::{
use crate::{
Contexting,
Parse,
Parsed,
Expand Down
28 changes: 12 additions & 16 deletions src/base/float.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use stdcore::{
use core::{
fmt::{
self,
Debug,
Expand All @@ -17,19 +17,17 @@ use crate::{
to_digit,
BaseAtom,
},
core::{
Acc,
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
Success,
},
utils::{
Acc,
Utils,
UtilsAtom,
},
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
Success,
};

/// Information about float failure
Expand Down Expand Up @@ -178,13 +176,11 @@ mod tests {
use crate::{
base::BaseAtom,
context::Tree,
core::{
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::UtilsAtom,
CoreAtom,
Parse,
Parsed,
Streaming,
};

#[derive(Display, Debug, Clone, From)]
Expand Down
12 changes: 5 additions & 7 deletions src/base/is.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ use crate::{
any,
BaseAtom,
},
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::Utils,
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Return Success if item from stream is partially equal to t.
Expand Down
12 changes: 5 additions & 7 deletions src/base/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ use crate::{
any,
BaseAtom,
},
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::{
Utils,
UtilsAtom,
},
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Take a list of T and return a Parser that will partially Eq in order Item
Expand Down
14 changes: 6 additions & 8 deletions src/base/nbit.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use crate::{
base::octet,
core::{
Contexting,
CoreAtom,
Parse,
Streaming,
},
utils::Utils,
Contexting,
CoreAtom,
Parse,
Streaming,
};

/// Used by nbit to represent n only if 0 > n > 8
Expand Down Expand Up @@ -65,7 +63,7 @@ where
feature = "tracing",
tracing::instrument(level = "trace", name = "nbit", skip_all, ret(Display))
)]
fn parse(&mut self, stream: Stream) -> crate::core::Parsed<Self::Token, Stream, Context> {
fn parse(&mut self, stream: Stream) -> crate::Parsed<Self::Token, Stream, Context> {
octet
.map(|b| (b >> self.n, b & u8::MAX >> (8 - self.n)))
.parse(stream)
Expand All @@ -77,7 +75,7 @@ mod tests {
use super::*;
use crate::{
context::*,
core::*,
*,
};

#[test]
Expand Down
12 changes: 5 additions & 7 deletions src/base/octet.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use crate::{
base::any,
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::Utils,
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Will read an item from the Stream and convert it to an octet
Expand Down
12 changes: 5 additions & 7 deletions src/base/one_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ use crate::{
any,
BaseAtom,
},
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::Utils,
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Will check if next Item from Stream is partially equal
Expand Down
2 changes: 1 addition & 1 deletion src/base/parse.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt::Debug;

use crate::core::Parse;
use crate::Parse;

/// Take a parser and return a Parser that will call parse on it.
pub fn parse<Stream, Context, Parser>(
Expand Down
12 changes: 5 additions & 7 deletions src/base/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ use paste::paste;

use crate::{
base::octet,
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::{
Utils,
UtilsAtom,
},
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Meta trait for number
Expand Down
43 changes: 20 additions & 23 deletions src/base/radix.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
use core::{
fmt::{
self,
Debug,
Display,
Formatter,
},
marker::PhantomData,
};

use num_traits::{
cast::AsPrimitive,
identities::Zero,
Expand All @@ -11,15 +21,6 @@ use num_traits::{
},
CheckedSub,
};
use stdcore::{
fmt::{
self,
Debug,
Display,
Formatter,
},
marker::PhantomData,
};

use crate::{
base::{
Expand All @@ -28,19 +29,17 @@ use crate::{
BaseAtom,
Sign,
},
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
Success,
},
utils::{
TryFoldBoundsParse,
Utils,
UtilsAtom,
},
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
Success,
};

/// Represent Radix, used to limit radix <= 36
Expand Down Expand Up @@ -309,13 +308,11 @@ mod tests {
use crate::{
base::BaseAtom,
context::Tree,
core::{
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::UtilsAtom,
CoreAtom,
Parse,
Parsed,
Streaming,
};

#[derive(Display, Debug, Clone, From)]
Expand Down
12 changes: 5 additions & 7 deletions src/base/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ use crate::{
is,
BaseAtom,
},
core::{
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
},
utils::{
Utils,
UtilsAtom,
},
Contexting,
CoreAtom,
Parse,
Parsed,
Streaming,
};

/// Enum that hold Sign value
Expand Down
2 changes: 1 addition & 1 deletion src/base/success.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt::Debug;

use crate::core::{
use crate::{
Parse,
Parsed,
ProvideElement,
Expand Down
Loading

0 comments on commit b0c011f

Please sign in to comment.