Skip to content

Commit

Permalink
feat: Allow regex parsers to use regex-1.0
Browse files Browse the repository at this point in the history
Enabled using the `regex-1` feature.
  • Loading branch information
Marwes committed Oct 6, 2018
1 parent d13fc05 commit 77fe362
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 101 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Expand Up @@ -27,6 +27,7 @@ byteorder = "1.1.0"
either = "1"
unreachable = "1.0.0"
regex = { version = "0.2.0", optional = true }
combine-regex-1 = { version = "1", path = "combine-regex-1", optional = true }
memchr = { version = "2", default-features = false }

[dev-dependencies]
Expand All @@ -45,7 +46,9 @@ quick-error = "1.0"
default = ["std"]
# Run the mp4 benchmark, requires a mp4 file named `small.mp4` in the benches directory
mp4 = []
doc = ["regex"]
# Enables use of regex version 1 in the regex parsers
regex-1 = ["combine-regex-1"]
doc = ["regex", "regex-1"]
std = ["memchr/use_std"]

[[bench]]
Expand Down
1 change: 1 addition & 0 deletions combine-regex-1/.gitignore
@@ -0,0 +1 @@
target
98 changes: 98 additions & 0 deletions combine-regex-1/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions combine-regex-1/Cargo.toml
@@ -0,0 +1,13 @@
[package]
name = "combine-regex-1"
version = "1.0.0"
authors = ["Markus Westerlind <marwes91@gmail.com>"]

license = "MIT/Apache-2.0"

description = "Re-export of regex 1.0 letting combine use both 0.2 and 1.0"

repository = "https://github.com/Marwes/combine"

[dependencies]
regex = { version = "1", features = ["use_std"], default-features = false }
3 changes: 3 additions & 0 deletions combine-regex-1/src/lib.rs
@@ -0,0 +1,3 @@
extern crate regex;

pub use regex::*;
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -812,7 +812,7 @@ pub use parser::range;
since = "3.0.0",
note = "Please use the `parser::regex` module instead"
)]
#[cfg(feature = "regex")]
#[cfg(any(feature = "regex", feature = "regex-1"))]
pub use parser::regex;

#[doc(hidden)]
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Expand Up @@ -68,7 +68,7 @@ pub mod error;
pub mod function;
pub mod item;
pub mod range;
#[cfg(feature = "regex")]
#[cfg(any(feature = "regex", feature = "regex-1"))]
pub mod regex;
pub mod repeat;
pub mod sequence;
Expand Down

0 comments on commit 77fe362

Please sign in to comment.