Upgrade regex-syntax

This fixes a bug where some regexes are not correctly printed as string literals.
This commit is contained in:
Peter Wagenet 2017-03-27 18:54:57 -07:00
parent b78b2aaaa1
commit b12643d413
3 changed files with 11 additions and 3 deletions

View File

@ -22,7 +22,7 @@ docopt = "0.7"
ena = "0.5"
itertools = "0.5.9"
regex = "0.2.1"
regex-syntax = "0.2"
regex-syntax = "0.4.0"
petgraph = "0.3.2"
rustc-serialize = "0.3"
term = "0.4.5"

View File

@ -360,7 +360,15 @@ impl NFA {
self.push_edge(s0, Noop, target);
}
Ok(s0)
}
},
// FIXME: Figure out what these should do
Expr::AnyByte => panic!("Unsupported"),
Expr::AnyByteNoNL => panic!("Unsupported"),
Expr::WordBoundaryAscii => panic!("Unsupported"),
Expr::NotWordBoundaryAscii => panic!("Unsupported"),
Expr::ClassBytes(_) => panic!("Unsupported"),
Expr::LiteralBytes { .. } => panic!("Unsupported")
}
}

View File

@ -10,7 +10,7 @@ pub type RegexError = Error;
/// Convert a string literal into a parsed regular expression.
pub fn parse_literal(s: &str) -> Regex {
match parse_regex(&regex_syntax::quote(s)) {
match parse_regex(&regex_syntax::escape(s)) {
Ok(v) => v,
Err(_) => panic!("failed to parse literal regular expression")
}