mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
dedupe literal parsers
This commit is contained in:
parent
dbf03b674e
commit
73ded3c63c
10 changed files with 220 additions and 374 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::{
|
||||
ast::{self, AstNode},
|
||||
string_lexing::{self, CharComponentKind},
|
||||
string_lexing::{self, StringComponentKind},
|
||||
TextRange,
|
||||
validation::char,
|
||||
yellow::{
|
||||
|
@ -38,11 +38,11 @@ pub(super) fn validate_byte_node(node: ast::Byte, errors: &mut Vec<SyntaxError>)
|
|||
|
||||
pub(super) fn validate_byte_component(
|
||||
text: &str,
|
||||
kind: CharComponentKind,
|
||||
kind: StringComponentKind,
|
||||
range: TextRange,
|
||||
errors: &mut Vec<SyntaxError>,
|
||||
) {
|
||||
use self::CharComponentKind::*;
|
||||
use self::StringComponentKind::*;
|
||||
match kind {
|
||||
AsciiEscape => validate_byte_escape(text, range, errors),
|
||||
AsciiCodeEscape => validate_byte_code_escape(text, range, errors),
|
||||
|
@ -63,6 +63,7 @@ pub(super) fn validate_byte_component(
|
|||
errors.push(SyntaxError::new(ByteOutOfRange, range));
|
||||
}
|
||||
}
|
||||
IgnoreNewline => { /* always valid */ }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue