Show More
@@ -8,7 +8,7 b' use utils::files::get_path_from_bytes;' | |||||
8 | use utils::{replace_slice, SliceExt}; |
|
8 | use utils::{replace_slice, SliceExt}; | |
9 |
|
9 | |||
10 | lazy_static! { |
|
10 | lazy_static! { | |
11 |
static ref |
|
11 | static ref RE_ESCAPE: Vec<Vec<u8>> = { | |
12 | let mut v: Vec<Vec<u8>> = (0..=255).map(|byte| vec![byte]).collect(); |
|
12 | let mut v: Vec<Vec<u8>> = (0..=255).map(|byte| vec![byte]).collect(); | |
13 | let to_escape = b"()[]{}?*+-|^$\\.&~# \t\n\r\x0b\x0c"; |
|
13 | let to_escape = b"()[]{}?*+-|^$\\.&~# \t\n\r\x0b\x0c"; | |
14 | for byte in to_escape { |
|
14 | for byte in to_escape { | |
@@ -99,9 +99,9 b' fn glob_to_re(pat: &[u8]) -> Vec<u8> {' | |||||
99 | c |
|
99 | c | |
100 | } |
|
100 | } | |
101 | }; |
|
101 | }; | |
102 |
res.extend(& |
|
102 | res.extend(&RE_ESCAPE[*c as usize]) | |
103 | } |
|
103 | } | |
104 |
_ => res.extend(& |
|
104 | _ => res.extend(&RE_ESCAPE[*c as usize]), | |
105 | } |
|
105 | } | |
106 | } |
|
106 | } | |
107 | res |
|
107 | res | |
@@ -110,7 +110,7 b' fn glob_to_re(pat: &[u8]) -> Vec<u8> {' | |||||
110 | fn escape_pattern(pattern: &[u8]) -> Vec<u8> { |
|
110 | fn escape_pattern(pattern: &[u8]) -> Vec<u8> { | |
111 | pattern |
|
111 | pattern | |
112 | .iter() |
|
112 | .iter() | |
113 |
.flat_map(|c| |
|
113 | .flat_map(|c| RE_ESCAPE[*c as usize].clone()) | |
114 | .collect() |
|
114 | .collect() | |
115 | } |
|
115 | } | |
116 |
|
116 |
General Comments 0
You need to be logged in to leave comments.
Login now