Skip to content

Commit 52fdae7

Browse files
committed
Auto merge of rust-lang#310 - BurntSushi:rfc, r=BurntSushi
regex 0.2 0.2.0 ===== This is a new major release of the regex crate, and is an implementation of the [regex 1.0 RFC](https://github.com/rust-lang/rfcs/blob/master/text/1620-regex-1.0.md). We are releasing a `0.2` first, and if there are no major problems, we will release a `1.0` shortly. For `0.2`, the minimum *supported* Rust version is 1.12. There are a number of **breaking changes** in `0.2`. They are split into two types. The first type correspond to breaking changes in regular expression syntax. The second type correspond to breaking changes in the API. Breaking changes for regex syntax: * POSIX character classes now require double bracketing. Previously, the regex `[:upper:]` would parse as the `upper` POSIX character class. Now it parses as the character class containing the characters `:upper:`. The fix to this change is to use `[[:upper:]]` instead. Note that variants like `[[:upper:][:blank:]]` continue to work. * The character `[` must always be escaped inside a character class. * The characters `&`, `-` and `~` must be escaped if any one of them are repeated consecutively. For example, `[&]`, `[\&]`, `[\&\&]`, `[&-&]` are all equivalent while `[&&]` is illegal. (The motivation for this and the prior change is to provide a backwards compatible path for adding character class set notation.) * A `bytes::Regex` now has Unicode mode enabled by default (like the main `Regex` type). This means regexes compiled with `bytes::Regex::new` that don't have the Unicode flag set should add `(?-u)` to recover the original behavior. Breaking changes for the regex API: * `find` and `find_iter` now **return `Match` values instead of `(usize, usize)`.** `Match` values have `start` and `end` methods, which return the match offsets. `Match` values also have an `as_str` method, which returns the text of the match itself. * The `Captures` type now only provides a single iterator over all capturing matches, which should replace uses of `iter` and `iter_pos`. Uses of `iter_named` should use the `capture_names` method on `Regex`. * The `replace` methods now return `Cow` values. The `Cow::Borrowed` variant is returned when no replacements are made. * The `Replacer` trait has been completely overhauled. This should only impact clients that implement this trait explicitly. Standard uses of the `replace` methods should continue to work unchanged. * The `quote` free function has been renamed to `escape`. * The `Regex::with_size_limit` method has been removed. It is replaced by `RegexBuilder::size_limit`. * The `RegexBuilder` type has switched from owned `self` method receivers to `&mut self` method receivers. Most uses will continue to work unchanged, but some code may require naming an intermediate variable to hold the builder. * The free `is_match` function has been removed. It is replaced by compiling a `Regex` and calling its `is_match` method. * The `PartialEq` and `Eq` impls on `Regex` have been dropped. If you relied on these impls, the fix is to define a wrapper type around `Regex`, impl `Deref` on it and provide the necessary impls. * The `is_empty` method on `Captures` has been removed. This always returns `false`, so its use is superfluous. * The `Syntax` variant of the `Error` type now contains a string instead of a `regex_syntax::Error`. If you were examining syntax errors more closely, you'll need to explicitly use the `regex_syntax` crate to re-parse the regex. * The `InvalidSet` variant of the `Error` type has been removed since it is no longer used. * Most of the iterator types have been renamed to match conventions. If you were using these iterator types explicitly, please consult the documentation for its new name. For example, `RegexSplits` has been renamed to `Split`. A number of bugs have been fixed: * [BUG rust-lang#151](rust-lang#151): The `Replacer` trait has been changed to permit the caller to control allocation. * [BUG rust-lang#165](rust-lang#165): Remove the free `is_match` function. * [BUG rust-lang#166](rust-lang#166): Expose more knobs (available in `0.1`) and remove `with_size_limit`. * [BUG rust-lang#168](rust-lang#168): Iterators produced by `Captures` now have the correct lifetime parameters. * [BUG rust-lang#175](rust-lang#175): Fix a corner case in the parsing of POSIX character classes. * [BUG rust-lang#178](rust-lang#178): Drop the `PartialEq` and `Eq` impls on `Regex`. * [BUG rust-lang#179](rust-lang#179): Remove `is_empty` from `Captures` since it always returns false. * [BUG rust-lang#276](rust-lang#276): Position of named capture can now be retrieved from a `Captures`. * [BUG rust-lang#296](rust-lang#296): Remove winapi/kernel32-sys dependency on UNIX. * [BUG rust-lang#307](rust-lang#307): Fix error on emscripten.
2 parents e2f0850 + ac3ab6d commit 52fdae7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2018
-1608
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: rust
22
rust:
3-
- 1.3.0
3+
- 1.12.0
44
- stable
55
- beta
66
- nightly

Diff for: CHANGELOG.md

+119-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,101 @@
1+
0.2.0
2+
=====
3+
This is a new major release of the regex crate, and is an implementation of the
4+
[regex 1.0 RFC](https://github.com/rust-lang/rfcs/blob/master/text/1620-regex-1.0.md).
5+
We are releasing a `0.2` first, and if there are no major problems, we will
6+
release a `1.0` shortly. For `0.2`, the minimum *supported* Rust version is
7+
1.12.
8+
9+
There are a number of **breaking changes** in `0.2`. They are split into two
10+
types. The first type correspond to breaking changes in regular expression
11+
syntax. The second type correspond to breaking changes in the API.
12+
13+
Breaking changes for regex syntax:
14+
15+
* POSIX character classes now require double bracketing. Previously, the regex
16+
`[:upper:]` would parse as the `upper` POSIX character class. Now it parses
17+
as the character class containing the characters `:upper:`. The fix to this
18+
change is to use `[[:upper:]]` instead. Note that variants like
19+
`[[:upper:][:blank:]]` continue to work.
20+
* The character `[` must always be escaped inside a character class.
21+
* The characters `&`, `-` and `~` must be escaped if any one of them are
22+
repeated consecutively. For example, `[&]`, `[\&]`, `[\&\&]`, `[&-&]` are all
23+
equivalent while `[&&]` is illegal. (The motivation for this and the prior
24+
change is to provide a backwards compatible path for adding character class
25+
set notation.)
26+
* A `bytes::Regex` now has Unicode mode enabled by default (like the main
27+
`Regex` type). This means regexes compiled with `bytes::Regex::new` that
28+
don't have the Unicode flag set should add `(?-u)` to recover the original
29+
behavior.
30+
31+
Breaking changes for the regex API:
32+
33+
* `find` and `find_iter` now **return `Match` values instead of
34+
`(usize, usize)`.** `Match` values have `start` and `end` methods, which
35+
return the match offsets. `Match` values also have an `as_str` method,
36+
which returns the text of the match itself.
37+
* The `Captures` type now only provides a single iterator over all capturing
38+
matches, which should replace uses of `iter` and `iter_pos`. Uses of
39+
`iter_named` should use the `capture_names` method on `Regex`.
40+
* The `at` method on the `Captures` type has been renamed to `get`, and it
41+
now returns a `Match`. Similarly, the `name` method on `Captures` now returns
42+
a `Match`.
43+
* The `replace` methods now return `Cow` values. The `Cow::Borrowed` variant
44+
is returned when no replacements are made.
45+
* The `Replacer` trait has been completely overhauled. This should only
46+
impact clients that implement this trait explicitly. Standard uses of
47+
the `replace` methods should continue to work unchanged. If you implement
48+
the `Replacer` trait, please consult the new documentation.
49+
* The `quote` free function has been renamed to `escape`.
50+
* The `Regex::with_size_limit` method has been removed. It is replaced by
51+
`RegexBuilder::size_limit`.
52+
* The `RegexBuilder` type has switched from owned `self` method receivers to
53+
`&mut self` method receivers. Most uses will continue to work unchanged, but
54+
some code may require naming an intermediate variable to hold the builder.
55+
* The free `is_match` function has been removed. It is replaced by compiling
56+
a `Regex` and calling its `is_match` method.
57+
* The `PartialEq` and `Eq` impls on `Regex` have been dropped. If you relied
58+
on these impls, the fix is to define a wrapper type around `Regex`, impl
59+
`Deref` on it and provide the necessary impls.
60+
* The `is_empty` method on `Captures` has been removed. This always returns
61+
`false`, so its use is superfluous.
62+
* The `Syntax` variant of the `Error` type now contains a string instead of
63+
a `regex_syntax::Error`. If you were examining syntax errors more closely,
64+
you'll need to explicitly use the `regex_syntax` crate to re-parse the regex.
65+
* The `InvalidSet` variant of the `Error` type has been removed since it is
66+
no longer used.
67+
* Most of the iterator types have been renamed to match conventions. If you
68+
were using these iterator types explicitly, please consult the documentation
69+
for its new name. For example, `RegexSplits` has been renamed to `Split`.
70+
71+
A number of bugs have been fixed:
72+
73+
* [BUG #151](https://github.com/rust-lang/regex/issues/151):
74+
The `Replacer` trait has been changed to permit the caller to control
75+
allocation.
76+
* [BUG #165](https://github.com/rust-lang/regex/issues/165):
77+
Remove the free `is_match` function.
78+
* [BUG #166](https://github.com/rust-lang/regex/issues/166):
79+
Expose more knobs (available in `0.1`) and remove `with_size_limit`.
80+
* [BUG #168](https://github.com/rust-lang/regex/issues/168):
81+
Iterators produced by `Captures` now have the correct lifetime parameters.
82+
* [BUG #175](https://github.com/rust-lang/regex/issues/175):
83+
Fix a corner case in the parsing of POSIX character classes.
84+
* [BUG #178](https://github.com/rust-lang/regex/issues/178):
85+
Drop the `PartialEq` and `Eq` impls on `Regex`.
86+
* [BUG #179](https://github.com/rust-lang/regex/issues/179):
87+
Remove `is_empty` from `Captures` since it always returns false.
88+
* [BUG #276](https://github.com/rust-lang/regex/issues/276):
89+
Position of named capture can now be retrieved from a `Captures`.
90+
* [BUG #296](https://github.com/rust-lang/regex/issues/296):
91+
Remove winapi/kernel32-sys dependency on UNIX.
92+
* [BUG #307](https://github.com/rust-lang/regex/issues/307):
93+
Fix error on emscripten.
94+
95+
196
0.1.80
297
======
3-
* [PR #292](https://github.com/rust-lang-nursery/regex/pull/292):
98+
* [PR #292](https://github.com/rust-lang/regex/pull/292):
499
Fixes bug #291, which was introduced by PR #290.
5100

6101
0.1.79
@@ -9,13 +104,13 @@
9104

10105
0.1.78
11106
======
12-
* [PR #290](https://github.com/rust-lang-nursery/regex/pull/290):
107+
* [PR #290](https://github.com/rust-lang/regex/pull/290):
13108
Fixes bug #289, which caused some regexes with a certain combination
14109
of literals to match incorrectly.
15110

16111
0.1.77
17112
======
18-
* [PR #281](https://github.com/rust-lang-nursery/regex/pull/281):
113+
* [PR #281](https://github.com/rust-lang/regex/pull/281):
19114
Fixes bug #280 by disabling all literal optimizations when a pattern
20115
is partially anchored.
21116

@@ -25,9 +120,9 @@
25120

26121
0.1.75
27122
======
28-
* [PR #275](https://github.com/rust-lang-nursery/regex/pull/275):
123+
* [PR #275](https://github.com/rust-lang/regex/pull/275):
29124
Improves match verification performance in the Teddy SIMD searcher.
30-
* [PR #278](https://github.com/rust-lang-nursery/regex/pull/278):
125+
* [PR #278](https://github.com/rust-lang/regex/pull/278):
31126
Replaces slow substring loop in the Teddy SIMD searcher with Aho-Corasick.
32127
* Implemented DoubleEndedIterator on regex set match iterators.
33128

@@ -36,7 +131,7 @@
36131
* Release regex-syntax 0.3.5 with a minor bug fix.
37132
* Fix bug #272.
38133
* Fix bug #277.
39-
* [PR #270](https://github.com/rust-lang-nursery/regex/pull/270):
134+
* [PR #270](https://github.com/rust-lang/regex/pull/270):
40135
Fixes bugs #264, #268 and an unreported where the DFA cache size could be
41136
drastically under estimated in some cases (leading to high unexpected memory
42137
usage).
@@ -48,55 +143,55 @@
48143

49144
0.1.72
50145
======
51-
* [PR #262](https://github.com/rust-lang-nursery/regex/pull/262):
146+
* [PR #262](https://github.com/rust-lang/regex/pull/262):
52147
Fixes a number of small bugs caught by fuzz testing (AFL).
53148

54149
0.1.71
55150
======
56-
* [PR #236](https://github.com/rust-lang-nursery/regex/pull/236):
151+
* [PR #236](https://github.com/rust-lang/regex/pull/236):
57152
Fix a bug in how suffix literals were extracted, which could lead
58153
to invalid match behavior in some cases.
59154

60155
0.1.70
61156
======
62-
* [PR #231](https://github.com/rust-lang-nursery/regex/pull/231):
157+
* [PR #231](https://github.com/rust-lang/regex/pull/231):
63158
Add SIMD accelerated multiple pattern search.
64-
* [PR #228](https://github.com/rust-lang-nursery/regex/pull/228):
159+
* [PR #228](https://github.com/rust-lang/regex/pull/228):
65160
Reintroduce the reverse suffix literal optimization.
66-
* [PR #226](https://github.com/rust-lang-nursery/regex/pull/226):
161+
* [PR #226](https://github.com/rust-lang/regex/pull/226):
67162
Implements NFA state compression in the lazy DFA.
68-
* [PR #223](https://github.com/rust-lang-nursery/regex/pull/223):
163+
* [PR #223](https://github.com/rust-lang/regex/pull/223):
69164
A fully anchored RegexSet can now short-circuit.
70165

71166
0.1.69
72167
======
73-
* [PR #216](https://github.com/rust-lang-nursery/regex/pull/216):
168+
* [PR #216](https://github.com/rust-lang/regex/pull/216):
74169
Tweak the threshold for running backtracking.
75-
* [PR #217](https://github.com/rust-lang-nursery/regex/pull/217):
170+
* [PR #217](https://github.com/rust-lang/regex/pull/217):
76171
Add upper limit (from the DFA) to capture search (for the NFA).
77-
* [PR #218](https://github.com/rust-lang-nursery/regex/pull/218):
172+
* [PR #218](https://github.com/rust-lang/regex/pull/218):
78173
Add rure, a C API.
79174

80175
0.1.68
81176
======
82-
* [PR #210](https://github.com/rust-lang-nursery/regex/pull/210):
177+
* [PR #210](https://github.com/rust-lang/regex/pull/210):
83178
Fixed a performance bug in `bytes::Regex::replace` where `extend` was used
84179
instead of `extend_from_slice`.
85-
* [PR #211](https://github.com/rust-lang-nursery/regex/pull/211):
180+
* [PR #211](https://github.com/rust-lang/regex/pull/211):
86181
Fixed a bug in the handling of word boundaries in the DFA.
87-
* [PR #213](https://github.com/rust-lang-nursery/regex/pull/213):
182+
* [PR #213](https://github.com/rust-lang/pull/213):
88183
Added RE2 and Tcl to the benchmark harness. Also added a CLI utility from
89184
running regexes using any of the following regex engines: PCRE1, PCRE2,
90185
Oniguruma, RE2, Tcl and of course Rust's own regexes.
91186

92187
0.1.67
93188
======
94-
* [PR #201](https://github.com/rust-lang-nursery/regex/pull/201):
189+
* [PR #201](https://github.com/rust-lang/regex/pull/201):
95190
Fix undefined behavior in the `regex!` compiler plugin macro.
96-
* [PR #205](https://github.com/rust-lang-nursery/regex/pull/205):
191+
* [PR #205](https://github.com/rust-lang/regex/pull/205):
97192
More improvements to DFA performance. Competitive with RE2. See PR for
98193
benchmarks.
99-
* [PR #209](https://github.com/rust-lang-nursery/regex/pull/209):
194+
* [PR #209](https://github.com/rust-lang/regex/pull/209):
100195
Release 0.1.66 was semver incompatible since it required a newer version
101196
of Rust than previous releases. This PR fixes that. (And `0.1.66` was
102197
yanked.)
@@ -110,11 +205,11 @@
110205
complexity. It was replaced with a more limited optimization where, given any
111206
regex of the form `re$`, it will be matched in reverse from the end of the
112207
haystack.
113-
* [PR #202](https://github.com/rust-lang-nursery/regex/pull/202):
208+
* [PR #202](https://github.com/rust-lang/regex/pull/202):
114209
The inner loop of the DFA was heavily optimized to improve cache locality
115210
and reduce the overall number of instructions run on each iteration. This
116211
represents the first use of `unsafe` in `regex` (to elide bounds checks).
117-
* [PR #200](https://github.com/rust-lang-nursery/regex/pull/200):
212+
* [PR #200](https://github.com/rust-lang/regex/pull/200):
118213
Use of the `mempool` crate (which used thread local storage) was replaced
119214
with a faster version of a similar API in @Amanieu's `thread_local` crate.
120215
It should reduce contention when using a regex from multiple threads
@@ -124,5 +219,5 @@
124219
(Includes a comparison with PCRE1's JIT and Oniguruma.)
125220
* A bug where word boundaries weren't being matched correctly in the DFA was
126221
fixed. This only affected use of `bytes::Regex`.
127-
* [#160](https://github.com/rust-lang-nursery/regex/issues/160):
222+
* [#160](https://github.com/rust-lang/regex/issues/160):
128223
`Captures` now has a `Debug` impl.

Diff for: Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "regex"
3-
version = "0.1.80" #:version
3+
version = "0.2.0" #:version
44
authors = ["The Rust Project Developers"]
55
license = "MIT/Apache-2.0"
66
readme = "README.md"
@@ -16,23 +16,23 @@ finite automata and guarantees linear time matching on all inputs.
1616
# For very fast prefix literal matching.
1717
aho-corasick = "0.5.3"
1818
# For skipping along search text quickly when a leading byte is known.
19-
memchr = "0.1.9"
19+
memchr = "1"
2020
# For managing regex caches quickly across multiple threads.
21-
thread_local = "0.2.4"
21+
thread_local = "0.3.2"
2222
# For parsing regular expressions.
23-
regex-syntax = { path = "regex-syntax", version = "0.3.8" }
23+
regex-syntax = { path = "regex-syntax", version = "0.4.0" }
2424
# For accelerating text search.
2525
simd = { version = "0.1.0", optional = true }
2626
# For compiling UTF-8 decoding into automata.
27-
utf8-ranges = "0.1.3"
27+
utf8-ranges = "1"
2828

2929
[dev-dependencies]
3030
# For examples.
31-
lazy_static = "0.1"
31+
lazy_static = "0.2.2"
3232
# For property based tests.
33-
quickcheck = "0.2"
33+
quickcheck = "0.4.1"
3434
# For generating random test data.
35-
rand = "0.3"
35+
rand = "0.3.15"
3636

3737
[features]
3838
# Enable to use the unstable pattern traits defined in std.

Diff for: README.md

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
regex
22
=====
3-
4-
A Rust library for parsing, compiling, and executing regular expressions.
5-
This particular implementation of regular expressions guarantees execution
6-
in linear time with respect to the size of the regular expression and
7-
search text by using finite automata. In particular, it makes use of both
8-
NFAs and DFAs when matching. Much of the syntax and implementation is inspired
3+
A Rust library for parsing, compiling, and executing regular expressions. Its
4+
syntax is similar to Perl-style regular expressions, but lacks a few features
5+
like look around and backreferences. In exchange, all searches execute in
6+
linear time with respect to the size of the regular expression and search text.
7+
Much of the syntax and implementation is inspired
98
by [RE2](https://github.com/google/re2).
109

11-
[![Build Status](https://travis-ci.org/rust-lang-nursery/regex.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/regex)
12-
[![Build status](https://ci.appveyor.com/api/projects/status/22g48bo866qr4u77?svg=true)](https://ci.appveyor.com/project/alexcrichton/regex)
13-
[![Coverage Status](https://coveralls.io/repos/github/rust-lang-nursery/regex/badge.svg?branch=master)](https://coveralls.io/github/rust-lang-nursery/regex?branch=master)
10+
[![Build Status](https://travis-ci.org/rust-lang/regex.svg?branch=master)](https://travis-ci.org/rust-lang/regex)
11+
[![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/regex?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/regex)
12+
[![Coverage Status](https://coveralls.io/repos/github/rust-lang/regex/badge.svg?branch=master)](https://coveralls.io/github/rust-lang/regex?branch=master)
1413
[![](http://meritbadge.herokuapp.com/regex)](https://crates.io/crates/regex)
1514

1615
### Documentation
@@ -29,7 +28,7 @@ Add this to your `Cargo.toml`:
2928

3029
```toml
3130
[dependencies]
32-
regex = "0.1"
31+
regex = "0.2"
3332
```
3433

3534
and this to your crate root:
@@ -56,9 +55,9 @@ fn main() {
5655
").unwrap();
5756
let caps = re.captures("2010-03-14").unwrap();
5857

59-
assert_eq!("2010", caps.name("year").unwrap());
60-
assert_eq!("03", caps.name("month").unwrap());
61-
assert_eq!("14", caps.name("day").unwrap());
58+
assert_eq!("2010", caps["year"]);
59+
assert_eq!("03", caps["month"]);
60+
assert_eq!("14", caps["day"]);
6261
}
6362
```
6463

@@ -82,9 +81,9 @@ fn main() {
8281
// because the only way for the regex to match is if all of the
8382
// capture groups match. This is not true in general though!
8483
println!("year: {}, month: {}, day: {}",
85-
caps.at(1).unwrap(),
86-
caps.at(2).unwrap(),
87-
caps.at(3).unwrap());
84+
caps.get(1).unwrap().as_str(),
85+
caps.get(2).unwrap().as_str(),
86+
caps.get(3).unwrap().as_str());
8887
}
8988
}
9089
```
@@ -137,8 +136,8 @@ means the main API can't be used for searching arbitrary bytes.
137136
To match on arbitrary bytes, use the `regex::bytes::Regex` API. The API
138137
is identical to the main API, except that it takes an `&[u8]` to search
139138
on instead of an `&str`. By default, `.` will match any *byte* using
140-
`regex::bytes::Regex`, while `.` will match any encoded Unicode *codepoint*
141-
using the main API.
139+
`regex::bytes::Regex`, while `.` will match any *UTF-8 encoded Unicode scalar
140+
value* using the main API.
142141

143142
This example shows how to find all null-terminated strings in a slice of bytes:
144143

@@ -152,7 +151,7 @@ let text = b"foo\x00bar\x00baz\x00";
152151
// The unwrap is OK here since a match requires the `cstr` capture to match.
153152
let cstrs: Vec<&[u8]> =
154153
re.captures_iter(text)
155-
.map(|c| c.name("cstr").unwrap())
154+
.map(|c| c.name("cstr").unwrap().as_bytes())
156155
.collect();
157156
assert_eq!(vec![&b"foo"[..], &b"bar"[..], &b"baz"[..]], cstrs);
158157
```
@@ -211,9 +210,9 @@ fn main() {
211210
let re = regex!(r"(\d{4})-(\d{2})-(\d{2})");
212211
let caps = re.captures("2010-03-14").unwrap();
213212

214-
assert_eq!("2010", caps.at(1).unwrap());
215-
assert_eq!("03", caps.at(2).unwrap());
216-
assert_eq!("14", caps.at(3).unwrap());
213+
assert_eq!("2010", caps[1]);
214+
assert_eq!("03", caps[2]);
215+
assert_eq!("14", caps[3]);
217216
}
218217
```
219218

Diff for: bench/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ libc = "0.2"
1717
onig = { version = "0.4", optional = true }
1818
libpcre-sys = { version = "0.2", optional = true }
1919
memmap = "0.2"
20-
regex = { version = "0.1", path = "..", features = ["simd-accel"] }
21-
regex_macros = { version = "0.1", path = "../regex_macros", optional = true }
22-
regex-syntax = { version = "0.3", path = "../regex-syntax" }
20+
regex = { version = "0.2.0", path = "..", features = ["simd-accel"] }
21+
regex_macros = { version = "0.2.0", path = "../regex_macros", optional = true }
22+
regex-syntax = { version = "0.4.0", path = "../regex-syntax" }
2323
rustc-serialize = "0.3"
2424

2525
[build-dependencies]

0 commit comments

Comments
 (0)