@@ -8,41 +8,86 @@ repository = "https://github.com/rust-lang/regex"
8
8
documentation = " https://doc.rust-lang.org/regex"
9
9
homepage = " https://github.com/rust-lang/regex"
10
10
description = """
11
- An implementation of regular expressions for Rust.
11
+ An implementation of regular expressions for Rust. This implementation uses
12
+ finite automata and guarantees linear time matching on all inputs.
12
13
"""
13
14
15
+ [dependencies ]
16
+ # For very fast prefix literal matching.
17
+ aho-corasick = " 0.5"
18
+ # For skipping along search text quickly when a leading byte is known.
19
+ memchr = " 0.1"
20
+ # For parsing regular expressions.
21
+ regex-syntax = { path = " regex-syntax" , version = " 0.2" }
22
+ # For compiling UTF-8 decoding into automata.
23
+ utf8-ranges = " 0.1"
24
+
25
+ [dev-dependencies ]
26
+ # To prevent the benchmarking harness from running setup code more than once.
27
+ # Why? Because it takes too long.
28
+ lazy_static = " 0.1"
29
+ # For generating random text to test/benchmark with.
30
+ rand = " 0.3"
31
+
32
+ [features ]
33
+ # Enable to use the unstable pattern traits defined in std.
34
+ pattern = []
35
+
36
+ # Runs unit tests defined inside the regex package.
37
+ # Generally these tests specific pieces of the regex implementation.
14
38
[[test ]]
15
39
path = " src/lib.rs"
16
40
name = " regex"
17
41
42
+ # Run the test suite on the default behavior of Regex::new.
43
+ # This includes a mish mash of NFAs and DFAs, which are chosen automatically
44
+ # based on the regex. We test both of the NFA implementations by forcing their
45
+ # usage with the test definitions below. (We can't test the DFA implementations
46
+ # in the same way since they can't be used for every regex tested.)
18
47
[[test ]]
19
- path = " regex_macros/ tests/test_dynamic.rs"
48
+ path = " tests/test_dynamic.rs"
20
49
name = " dynamic"
21
50
51
+ # Run the test suite on the NFA algorithm over Unicode codepoints.
52
+ [[test ]]
53
+ path = " tests/test_dynamic_nfa.rs"
54
+ name = " dynamic-nfa"
55
+
56
+ # Run the test suite on the NFA algorithm over bytes.
57
+ [[test ]]
58
+ path = " tests/test_dynamic_nfa_bytes.rs"
59
+ name = " dynamic-nfa-bytes"
60
+
61
+ # Run the test suite on the backtracking engine over Unicode codepoints.
22
62
[[test ]]
23
- path = " regex_macros/ tests/test_dynamic_nfa .rs"
24
- name = " dynamic_nfa "
63
+ path = " tests/test_dynamic_backtrack .rs"
64
+ name = " dynamic-backtrack "
25
65
66
+ # Run the test suite on the backtracking engine over bytes.
26
67
[[test ]]
27
- path = " regex_macros/ tests/test_dynamic_backtrack .rs"
28
- name = " dynamic_backtrack "
68
+ path = " tests/test_dynamic_backtrack_bytes .rs"
69
+ name = " dynamic-backtrack-bytes "
29
70
71
+ # Run the benchmarks on the default behavior of Regex::new.
72
+ #
73
+ # N.B. These benchmarks were originally taken from Russ Cox.
30
74
[[bench ]]
31
- name = " all "
32
- path = " regex_macros/ benches/bench_dynamic.rs"
75
+ name = " dynamic "
76
+ path = " benches/bench_dynamic.rs"
33
77
test = false
34
78
bench = true
35
79
36
- [dependencies ]
37
- aho-corasick = " 0.4"
38
- memchr = " 0.1"
39
- regex-syntax = { path = " regex-syntax" , version = " 0.2" }
40
-
41
- [dev-dependencies ]
42
- rand = " 0.3"
43
-
44
- [features ]
45
- pattern = []
80
+ # Run the benchmarks on the NFA algorithm. We avoid chasing other permutations.
81
+ #
82
+ # N.B. These can take a *loong* time to run.
83
+ [[bench ]]
84
+ name = " dynamic-nfa"
85
+ path = " benches/bench_dynamic_nfa.rs"
86
+ test = false
87
+ bench = true
46
88
47
89
[profile .bench ]
48
- lto = true
90
+ debug = true
91
+
92
+ [profile .test ]
93
+ debug = true
0 commit comments