File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,23 @@ use std::{collections::HashMap, u64};
7
7
pub ( crate ) struct CharacterSet {
8
8
low_mask : u64 ,
9
9
high_mask : u64 ,
10
+ any : bool ,
10
11
}
11
12
12
13
impl CharacterSet {
13
14
pub ( crate ) fn new ( ) -> Self {
14
15
Self {
15
16
low_mask : 0 ,
16
17
high_mask : 0 ,
18
+ any : false ,
17
19
}
18
20
}
19
21
20
22
pub ( crate ) fn any ( ) -> Self {
21
23
Self {
22
24
low_mask : u64:: MAX ,
23
25
high_mask : u64:: MAX ,
26
+ any : true ,
24
27
}
25
28
}
26
29
@@ -72,7 +75,7 @@ impl CharacterSet {
72
75
let bit = 1 << val - 64 ;
73
76
self . high_mask & bit != 0
74
77
}
75
- _ => false ,
78
+ _ => self . any ,
76
79
}
77
80
}
78
81
@@ -234,7 +237,7 @@ impl<T> StateMachine<T> {
234
237
pub ( crate ) fn process < ' m > ( & ' m self , input : & ' m str ) -> Option < Match < ' m , T > > {
235
238
let mut traversals = vec ! [ Traversal :: new( ) ] ;
236
239
237
- for ( i, ch) in input. chars ( ) . enumerate ( ) {
240
+ for ( i, ch) in input. char_indices ( ) {
238
241
let next_traversals = self . process_char ( traversals, ch, i) ;
239
242
traversals = next_traversals;
240
243
You can’t perform that action at this time.
0 commit comments