1
1
[package ]
2
2
name = " regex"
3
3
version = " 1.8.1" # :version
4
- authors = [" The Rust Project Developers" ]
4
+ authors = [
" The Rust Project Developers" , " Andrew Gallant <[email protected] > " ]
5
5
license = " MIT OR Apache-2.0"
6
6
readme = " README.md"
7
7
repository = " https://github.com/rust-lang/regex"
@@ -19,7 +19,12 @@ rust-version = "1.60.0"
19
19
20
20
[workspace ]
21
21
members = [
22
- " bench" , " regex-capi" , " regex-syntax" ,
22
+ " bench" ,
23
+ " regex-automata" ,
24
+ " regex-capi" ,
25
+ " regex-cli" ,
26
+ " regex-syntax" ,
27
+ " regex-test" ,
23
28
]
24
29
25
30
[lib ]
@@ -42,27 +47,53 @@ default = ["std", "perf", "unicode", "regex-syntax/default"]
42
47
# to compile without std, and instead just rely on 'core' and 'alloc' (for
43
48
# example). Currently, this isn't supported, and removing the 'std' feature
44
49
# will prevent regex from compiling.
45
- std = []
50
+ std = [
51
+ " aho-corasick?/std" ,
52
+ " memchr?/std" ,
53
+ " regex-automata/std" ,
54
+ " regex-syntax/std" ,
55
+ ]
46
56
# The 'use_std' feature is DEPRECATED. It will be removed in regex 2. Until
47
57
# then, it is an alias for the 'std' feature.
48
58
use_std = [" std" ]
49
59
50
60
51
61
# PERFORMANCE FEATURES
52
62
53
- # Enables all performance features.
54
- perf = [" perf-cache" , " perf-dfa" , " perf-inline" , " perf-literal" ]
63
+ # Enables all default performance features. Note that this specifically does
64
+ # not include perf-dfa-full, because it leads to higher compile times and
65
+ # bigger binaries, and the runtime performance improvement is not obviously
66
+ # worth it.
67
+ perf = [
68
+ " perf-cache" ,
69
+ " perf-dfa" ,
70
+ " perf-onepass" ,
71
+ " perf-backtrack" ,
72
+ " perf-inline" ,
73
+ " perf-literal" ,
74
+ ]
55
75
# Enables fast caching. (If disabled, caching is still used, but is slower.)
56
76
# Currently, this feature has no effect. It used to remove the thread_local
57
77
# dependency and use a slower internal cache, but now the default cache has
58
78
# been improved and thread_local is no longer a dependency at all.
59
79
perf-cache = []
60
80
# Enables use of a lazy DFA when possible.
61
- perf-dfa = []
81
+ perf-dfa = [" regex-automata/hybrid" ]
82
+ # Enables use of a fully compiled DFA when possible.
83
+ perf-dfa-full = [" regex-automata/dfa-build" , " regex-automata/dfa-search" ]
84
+ # Enables use of the one-pass regex matcher, which speeds up capture searches
85
+ # even beyond the backtracker.
86
+ perf-onepass = [" regex-automata/dfa-onepass" ]
87
+ # Enables use of a bounded backtracker, which speeds up capture searches.
88
+ perf-backtrack = [" regex-automata/nfa-backtrack" ]
62
89
# Enables aggressive use of inlining.
63
- perf-inline = []
90
+ perf-inline = [" regex-automata/perf-inline " ]
64
91
# Enables literal optimizations.
65
- perf-literal = [" aho-corasick" , " memchr" ]
92
+ perf-literal = [
93
+ " dep:aho-corasick" ,
94
+ " dep:memchr" ,
95
+ " regex-automata/perf-literal" ,
96
+ ]
66
97
67
98
68
99
# UNICODE DATA FEATURES
@@ -76,22 +107,45 @@ unicode = [
76
107
" unicode-perl" ,
77
108
" unicode-script" ,
78
109
" unicode-segment" ,
110
+ " regex-automata/unicode" ,
79
111
" regex-syntax/unicode" ,
80
112
]
81
113
# Enables use of the `Age` property, e.g., `\p{Age:3.0}`.
82
- unicode-age = [" regex-syntax/unicode-age" ]
114
+ unicode-age = [
115
+ " regex-automata/unicode-age" ,
116
+ " regex-syntax/unicode-age" ,
117
+ ]
83
118
# Enables use of a smattering of boolean properties, e.g., `\p{Emoji}`.
84
- unicode-bool = [" regex-syntax/unicode-bool" ]
119
+ unicode-bool = [
120
+ " regex-automata/unicode-bool" ,
121
+ " regex-syntax/unicode-bool" ,
122
+ ]
85
123
# Enables Unicode-aware case insensitive matching, e.g., `(?i)β`.
86
- unicode-case = [" regex-syntax/unicode-case" ]
124
+ unicode-case = [
125
+ " regex-automata/unicode-case" ,
126
+ " regex-syntax/unicode-case" ,
127
+ ]
87
128
# Enables Unicode general categories, e.g., `\p{Letter}` or `\pL`.
88
- unicode-gencat = [" regex-syntax/unicode-gencat" ]
129
+ unicode-gencat = [
130
+ " regex-automata/unicode-gencat" ,
131
+ " regex-syntax/unicode-gencat" ,
132
+ ]
89
133
# Enables Unicode-aware Perl classes corresponding to `\w`, `\s` and `\d`.
90
- unicode-perl = [" regex-syntax/unicode-perl" ]
134
+ unicode-perl = [
135
+ " regex-automata/unicode-perl" ,
136
+ " regex-automata/unicode-word-boundary" ,
137
+ " regex-syntax/unicode-perl" ,
138
+ ]
91
139
# Enables Unicode scripts and script extensions, e.g., `\p{Greek}`.
92
- unicode-script = [" regex-syntax/unicode-script" ]
140
+ unicode-script = [
141
+ " regex-automata/unicode-script" ,
142
+ " regex-syntax/unicode-script" ,
143
+ ]
93
144
# Enables Unicode segmentation properties, e.g., `\p{gcb=Extend}`.
94
- unicode-segment = [" regex-syntax/unicode-segment" ]
145
+ unicode-segment = [
146
+ " regex-automata/unicode-segment" ,
147
+ " regex-syntax/unicode-segment" ,
148
+ ]
95
149
96
150
97
151
# UNSTABLE FEATURES (requires Rust nightly)
@@ -121,6 +175,13 @@ path = "regex-syntax"
121
175
version = " 0.7.1"
122
176
default-features = false
123
177
178
+ # For the actual regex engines.
179
+ [dependencies .regex-automata ]
180
+ path = " regex-automata"
181
+ version = " 0.3.0"
182
+ default-features = false
183
+ features = [" alloc" , " syntax" , " meta" , " nfa-pikevm" ]
184
+
124
185
[dev-dependencies ]
125
186
# For examples.
126
187
lazy_static = " 1"
@@ -129,10 +190,39 @@ quickcheck = { version = "1.0.3", default-features = false }
129
190
# For generating random test data.
130
191
rand = { version = " 0.8.3" , default-features = false , features = [" getrandom" , " small_rng" ] }
131
192
# To check README's example
132
- # TODO: Re-enable this once the MSRV is 1.43 or greater.
133
- # See: https://github.com/rust-lang/regex/issues/684
134
- # See: https://github.com/rust-lang/regex/issues/685
135
- # doc-comment = "0.3"
193
+ doc-comment = " 0.3"
194
+ # For easy error handling in integration tests.
195
+ anyhow = " 1.0.69"
196
+ # A library for testing regex engines.
197
+ regex-test = { path = " regex-test" , version = " 0.1.0" }
198
+
199
+ [dev-dependencies .env_logger ]
200
+ # Note that this is currently using an older version because of the dependency
201
+ # tree explosion that happened in 0.10.
202
+ version = " 0.9.3"
203
+ default-features = false
204
+ features = [" atty" , " humantime" , " termcolor" ]
205
+
206
+ # This test suite reads a whole boatload of tests from the top-level testdata
207
+ # directory, and then runs them against the regex crate API.
208
+ #
209
+ # regex-automata has its own version of them, and runs them against each
210
+ # internal regex engine individually.
211
+ #
212
+ # This means that if you're seeing a failure in this test suite, you should
213
+ # try running regex-automata's tests:
214
+ #
215
+ # cargo test --manifest-path regex-automata/Cargo.toml --test integration
216
+ #
217
+ # That *might* give you a more targeted test failure. i.e., "only the
218
+ # PikeVM fails this test." Which gives you a narrower place to search. If
219
+ # regex-automata's test suite passes, then the bug might be in the integration
220
+ # of the regex crate and regex-automata. But generally speaking, a failure
221
+ # in this test suite *should* mean there is a corresponding failure in
222
+ # regex-automata's test suite.
223
+ [[test ]]
224
+ path = " newtests/tests.rs"
225
+ name = " integration"
136
226
137
227
# Run the test suite on the default behavior of Regex::new.
138
228
# This includes a mish mash of NFAs and DFAs, which are chosen automatically
@@ -185,11 +275,36 @@ name = "backtrack-bytes"
185
275
path = " tests/test_crates_regex.rs"
186
276
name = " crates-regex"
187
277
278
+ [package .metadata .docs .rs ]
279
+ # We want to document all features.
280
+ all-features = true
281
+ # Since this crate's feature setup is pretty complicated, it is worth opting
282
+ # into a nightly unstable option to show the features that need to be enabled
283
+ # for public API items. To do that, we set 'docsrs', and when that's enabled,
284
+ # we enable the 'doc_auto_cfg' feature.
285
+ #
286
+ # To test this locally, run:
287
+ #
288
+ # RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
289
+ rustdoc-args = [" --cfg" , " docsrs" ]
290
+
188
291
[profile .release ]
189
292
debug = true
190
293
191
294
[profile .bench ]
192
295
debug = true
193
296
297
+ [profile .dev ]
298
+ # Running tests takes too long in debug mode, so we forcefully always build
299
+ # with optimizations. Unfortunate, but, ¯\_(ツ)_/¯.
300
+ #
301
+ # It's counter-intuitive that this needs to be set on dev *and* test, but
302
+ # it's because the tests that take a long time to run are run as integration
303
+ # tests in a separate crate. The test.opt-level setting won't apply there, so
304
+ # we need to set the opt-level across the entire build.
305
+ opt-level = 3
306
+ debug = true
307
+
194
308
[profile .test ]
309
+ opt-level = 3
195
310
debug = true
0 commit comments