diff options
author | Adolfo OchagavĂa <[email protected]> | 2018-11-07 11:03:02 +0000 |
---|---|---|
committer | Adolfo OchagavĂa <[email protected]> | 2018-11-07 11:04:26 +0000 |
commit | 433a8061910a388f777b839eb67f2582f91b6c7a (patch) | |
tree | 2b2e5ec96b4890507a1a8313297ef33eaaa260ea /crates | |
parent | 3b2ba59526f8e524aa3c1526dda2828a93653ed2 (diff) |
Fix backslash escape
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/validation.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 61cf83c84..9cb9ccc41 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs | |||
@@ -148,7 +148,7 @@ fn validate_char(node: ast::Char, errors: &mut Vec<SyntaxError>) { | |||
148 | 148 | ||
149 | fn is_ascii_escape(code: char) -> bool { | 149 | fn is_ascii_escape(code: char) -> bool { |
150 | match code { | 150 | match code { |
151 | '\'' | '"' | 'n' | 'r' | 't' | '0' => true, | 151 | '\\' | '\'' | '"' | 'n' | 'r' | 't' | '0' => true, |
152 | _ => false, | 152 | _ => false, |
153 | } | 153 | } |
154 | } | 154 | } |
@@ -206,7 +206,9 @@ mod test { | |||
206 | 206 | ||
207 | #[test] | 207 | #[test] |
208 | fn test_valid_ascii_escape() { | 208 | fn test_valid_ascii_escape() { |
209 | let valid = [r"\'", "\"", "\\\"", r"\n", r"\r", r"\t", r"\0", "a", "b"]; | 209 | let valid = [ |
210 | r"\'", "\"", "\\\\", "\\\"", r"\n", r"\r", r"\t", r"\0", "a", "b", | ||
211 | ]; | ||
210 | for c in &valid { | 212 | for c in &valid { |
211 | assert_valid_char(c); | 213 | assert_valid_char(c); |
212 | } | 214 | } |