Skip to content

Commit 433a806

Browse files
committed
Fix backslash escape
1 parent 3b2ba59 commit 433a806

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/ra_syntax/src/validation.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn validate_char(node: ast::Char, errors: &mut Vec<SyntaxError>) {
148148

149149
fn is_ascii_escape(code: char) -> bool {
150150
match code {
151-
'\'' | '"' | 'n' | 'r' | 't' | '0' => true,
151+
'\\' | '\'' | '"' | 'n' | 'r' | 't' | '0' => true,
152152
_ => false,
153153
}
154154
}
@@ -206,7 +206,9 @@ mod test {
206206

207207
#[test]
208208
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+
];
210212
for c in &valid {
211213
assert_valid_char(c);
212214
}

0 commit comments

Comments
 (0)