Fix the same bug as #396 but for bytes too

This commit is contained in:
DJMcNab 2019-01-01 12:10:21 +00:00
parent 5a866a772c
commit 0ddeb3b824
2 changed files with 4 additions and 1 deletions

View file

@ -88,7 +88,9 @@ fn validate_byte_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxErr
fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) {
// A ByteCodeEscape has 4 chars, example: `\xDD`
if text.len() < 4 {
if !text.is_ascii() {
errors.push(SyntaxError::new(MalformedByteCodeEscape, range));
} else if text.chars().count() < 4 {
errors.push(SyntaxError::new(TooShortByteCodeEscape, range));
} else {
assert!(