diff options
Diffstat (limited to 'crates/ra_syntax/src/validation/byte.rs')
-rw-r--r-- | crates/ra_syntax/src/validation/byte.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/validation/byte.rs b/crates/ra_syntax/src/validation/byte.rs index 43c0d7edd..d0897eeed 100644 --- a/crates/ra_syntax/src/validation/byte.rs +++ b/crates/ra_syntax/src/validation/byte.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | ast::{self, AstNode}, | 4 | ast::{self, AstNode}, |
5 | string_lexing::{self, CharComponentKind}, | 5 | string_lexing::{self, StringComponentKind}, |
6 | TextRange, | 6 | TextRange, |
7 | validation::char, | 7 | validation::char, |
8 | yellow::{ | 8 | yellow::{ |
@@ -27,6 +27,13 @@ pub(super) fn validate_byte_node(node: ast::Byte, errors: &mut Vec<SyntaxError>) | |||
27 | errors.push(SyntaxError::new(UnclosedByte, literal_range)); | 27 | errors.push(SyntaxError::new(UnclosedByte, literal_range)); |
28 | } | 28 | } |
29 | 29 | ||
30 | if let Some(range) = components.suffix { | ||
31 | errors.push(SyntaxError::new( | ||
32 | InvalidSuffix, | ||
33 | range + literal_range.start(), | ||
34 | )); | ||
35 | } | ||
36 | |||
30 | if len == 0 { | 37 | if len == 0 { |
31 | errors.push(SyntaxError::new(EmptyByte, literal_range)); | 38 | errors.push(SyntaxError::new(EmptyByte, literal_range)); |
32 | } | 39 | } |
@@ -38,11 +45,11 @@ pub(super) fn validate_byte_node(node: ast::Byte, errors: &mut Vec<SyntaxError>) | |||
38 | 45 | ||
39 | pub(super) fn validate_byte_component( | 46 | pub(super) fn validate_byte_component( |
40 | text: &str, | 47 | text: &str, |
41 | kind: CharComponentKind, | 48 | kind: StringComponentKind, |
42 | range: TextRange, | 49 | range: TextRange, |
43 | errors: &mut Vec<SyntaxError>, | 50 | errors: &mut Vec<SyntaxError>, |
44 | ) { | 51 | ) { |
45 | use self::CharComponentKind::*; | 52 | use self::StringComponentKind::*; |
46 | match kind { | 53 | match kind { |
47 | AsciiEscape => validate_byte_escape(text, range, errors), | 54 | AsciiEscape => validate_byte_escape(text, range, errors), |
48 | AsciiCodeEscape => validate_byte_code_escape(text, range, errors), | 55 | AsciiCodeEscape => validate_byte_code_escape(text, range, errors), |
@@ -63,6 +70,7 @@ pub(super) fn validate_byte_component( | |||
63 | errors.push(SyntaxError::new(ByteOutOfRange, range)); | 70 | errors.push(SyntaxError::new(ByteOutOfRange, range)); |
64 | } | 71 | } |
65 | } | 72 | } |
73 | IgnoreNewline => { /* always valid */ } | ||
66 | } | 74 | } |
67 | } | 75 | } |
68 | 76 | ||