From 5ba4f949c23dcf53f34995c90b7c01e6c641b1f0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Nov 2020 22:21:56 +0100 Subject: Kill RAW_ literals Syntactically, they are indistinguishable from non-raw versions, so it doesn't make sense to separate then *at the syntax* level. --- crates/syntax/src/ast/expr_ext.rs | 11 ++++- crates/syntax/src/ast/generated/tokens.rs | 8 ++-- crates/syntax/src/ast/node_ext.rs | 8 +--- crates/syntax/src/ast/token_ext.rs | 52 +++++++++------------- crates/syntax/src/parsing/lexer.rs | 4 +- crates/syntax/src/parsing/reparsing.rs | 2 +- crates/syntax/src/validation.rs | 41 +++++++++-------- .../lexer/err/0033_unclosed_raw_string_at_eof.txt | 2 +- .../err/0034_unclosed_raw_string_with_ferris.txt | 2 +- .../0035_unclosed_raw_string_with_ascii_escape.txt | 2 +- ...036_unclosed_raw_string_with_unicode_escape.txt | 2 +- .../err/0037_unclosed_raw_string_with_space.txt | 2 +- .../err/0038_unclosed_raw_string_with_slash.txt | 2 +- .../err/0039_unclosed_raw_string_with_slash_n.txt | 2 +- .../err/0040_unclosed_raw_byte_string_at_eof.txt | 2 +- .../0041_unclosed_raw_byte_string_with_ferris.txt | 2 +- ..._unclosed_raw_byte_string_with_ascii_escape.txt | 2 +- ...nclosed_raw_byte_string_with_unicode_escape.txt | 2 +- .../0044_unclosed_raw_byte_string_with_space.txt | 2 +- .../0045_unclosed_raw_byte_string_with_slash.txt | 2 +- .../0046_unclosed_raw_byte_string_with_slash_n.txt | 2 +- .../lexer/err/0047_unstarted_raw_string_at_eof.txt | 2 +- .../err/0048_unstarted_raw_byte_string_at_eof.txt | 2 +- .../err/0049_unstarted_raw_string_with_ascii.txt | 2 +- .../0050_unstarted_raw_byte_string_with_ascii.txt | 2 +- .../test_data/lexer/ok/0008_byte_strings.txt | 4 +- crates/syntax/test_data/lexer/ok/0009_strings.txt | 2 +- .../syntax/test_data/lexer/ok/0013_raw_strings.txt | 2 +- .../parser/inline/ok/0085_expr_literals.rast | 4 +- 29 files changed, 85 insertions(+), 89 deletions(-) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/expr_ext.rs b/crates/syntax/src/ast/expr_ext.rs index 3d33cd1cf..eb44bb2ab 100644 --- a/crates/syntax/src/ast/expr_ext.rs +++ b/crates/syntax/src/ast/expr_ext.rs @@ -320,6 +320,13 @@ impl ast::Literal { ast::IntNumber::cast(self.token()) } + pub fn as_string(&self) -> Option { + ast::String::cast(self.token()) + } + pub fn as_byte_string(&self) -> Option { + ast::ByteString::cast(self.token()) + } + fn find_suffix(text: &str, possible_suffixes: &[&str]) -> Option { possible_suffixes .iter() @@ -351,10 +358,10 @@ impl ast::Literal { suffix: Self::find_suffix(&text, &ast::FloatNumber::SUFFIXES), } } - STRING | RAW_STRING => LiteralKind::String, + STRING => LiteralKind::String, T![true] => LiteralKind::Bool(true), T![false] => LiteralKind::Bool(false), - BYTE_STRING | RAW_BYTE_STRING => LiteralKind::ByteString, + BYTE_STRING => LiteralKind::ByteString, CHAR => LiteralKind::Char, BYTE => LiteralKind::Byte, _ => unreachable!(), diff --git a/crates/syntax/src/ast/generated/tokens.rs b/crates/syntax/src/ast/generated/tokens.rs index 1b8449221..728b72cd7 100644 --- a/crates/syntax/src/ast/generated/tokens.rs +++ b/crates/syntax/src/ast/generated/tokens.rs @@ -70,16 +70,16 @@ impl AstToken for String { } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RawString { +pub struct ByteString { pub(crate) syntax: SyntaxToken, } -impl std::fmt::Display for RawString { +impl std::fmt::Display for ByteString { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(&self.syntax, f) } } -impl AstToken for RawString { - fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING } +impl AstToken for ByteString { + fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE_STRING } fn cast(syntax: SyntaxToken) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index c5cd1c504..5579f72b9 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -55,13 +55,7 @@ impl ast::Attr { let key = self.simple_name()?; let value_token = lit.syntax().first_token()?; - let value: SmolStr = if let Some(s) = ast::String::cast(value_token.clone()) { - s.value()?.into() - } else if let Some(s) = ast::RawString::cast(value_token) { - s.value()?.into() - } else { - return None; - }; + let value: SmolStr = ast::String::cast(value_token.clone())?.value()?.into(); Some((key, value)) } diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs index 8d3fad5a6..6cd20b6a6 100644 --- a/crates/syntax/src/ast/token_ext.rs +++ b/crates/syntax/src/ast/token_ext.rs @@ -139,14 +139,31 @@ pub trait HasQuotes: AstToken { } impl HasQuotes for ast::String {} -impl HasQuotes for ast::RawString {} pub trait HasStringValue: HasQuotes { fn value(&self) -> Option>; } +impl ast::String { + pub fn is_raw(&self) -> bool { + self.text().starts_with('r') + } + pub fn map_range_up(&self, range: TextRange) -> Option { + let contents_range = self.text_range_between_quotes()?; + assert!(TextRange::up_to(contents_range.len()).contains_range(range)); + Some(range + contents_range.start()) + } +} + impl HasStringValue for ast::String { fn value(&self) -> Option> { + if self.is_raw() { + let text = self.text().as_str(); + let text = + &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; + return Some(Cow::Borrowed(text)); + } + let text = self.text().as_str(); let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; @@ -166,20 +183,9 @@ impl HasStringValue for ast::String { } } -// FIXME: merge `ast::RawString` and `ast::String`. -impl HasStringValue for ast::RawString { - fn value(&self) -> Option> { - let text = self.text().as_str(); - let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; - Some(Cow::Borrowed(text)) - } -} - -impl ast::RawString { - pub fn map_range_up(&self, range: TextRange) -> Option { - let contents_range = self.text_range_between_quotes()?; - assert!(TextRange::up_to(contents_range.len()).contains_range(range)); - Some(range + contents_range.start()) +impl ast::ByteString { + pub fn is_raw(&self) -> bool { + self.text().starts_with("br") } } @@ -522,22 +528,6 @@ impl HasFormatSpecifier for ast::String { } } -impl HasFormatSpecifier for ast::RawString { - fn char_ranges( - &self, - ) -> Option)>> { - let text = self.text().as_str(); - let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; - let offset = self.text_range_between_quotes()?.start() - self.syntax().text_range().start(); - - let mut res = Vec::with_capacity(text.len()); - for (idx, c) in text.char_indices() { - res.push((TextRange::at(idx.try_into().unwrap(), TextSize::of(c)) + offset, Ok(c))); - } - Some(res) - } -} - impl ast::IntNumber { #[rustfmt::skip] pub(crate) const SUFFIXES: &'static [&'static str] = &[ diff --git a/crates/syntax/src/parsing/lexer.rs b/crates/syntax/src/parsing/lexer.rs index 5674ecb84..8afd7e53b 100644 --- a/crates/syntax/src/parsing/lexer.rs +++ b/crates/syntax/src/parsing/lexer.rs @@ -235,7 +235,7 @@ fn rustc_token_kind_to_syntax_kind( RawStrError::TooManyDelimiters { .. } => "Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols", }; }; - RAW_STRING + STRING } rustc_lexer::LiteralKind::RawByteStr { err: raw_str_err, .. } => { if let Some(raw_str_err) = raw_str_err { @@ -250,7 +250,7 @@ fn rustc_token_kind_to_syntax_kind( }; }; - RAW_BYTE_STRING + BYTE_STRING } }; diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs index 4149f856a..190f5f67a 100644 --- a/crates/syntax/src/parsing/reparsing.rs +++ b/crates/syntax/src/parsing/reparsing.rs @@ -44,7 +44,7 @@ fn reparse_token<'node>( let prev_token = algo::find_covering_element(root, edit.delete).as_token()?.clone(); let prev_token_kind = prev_token.kind(); match prev_token_kind { - WHITESPACE | COMMENT | IDENT | STRING | RAW_STRING => { + WHITESPACE | COMMENT | IDENT | STRING => { if prev_token_kind == WHITESPACE || prev_token_kind == COMMENT { // removing a new line may extends previous token let deleted_range = edit.delete - prev_token.text_range().start(); diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs index 0f9a5e8ae..62a37c50a 100644 --- a/crates/syntax/src/validation.rs +++ b/crates/syntax/src/validation.rs @@ -4,7 +4,7 @@ mod block; use crate::{ algo, ast, match_ast, AstNode, SyntaxError, - SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST, FN, INT_NUMBER, STRING, TYPE_ALIAS}, + SyntaxKind::{BYTE, CHAR, CONST, FN, INT_NUMBER, TYPE_ALIAS}, SyntaxNode, SyntaxToken, TextSize, T, }; use rowan::Direction; @@ -121,18 +121,19 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec) { acc.push(SyntaxError::new_at_offset(rustc_unescape_error_to_string(err), off)); }; - match token.kind() { - BYTE => { - if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape_byte) { - push_err(2, e); - } - } - CHAR => { - if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape_char) { - push_err(1, e); + if let Some(s) = literal.as_string() { + if !s.is_raw() { + if let Some(without_quotes) = unquote(text, 1, '"') { + unescape_literal(without_quotes, Mode::Str, &mut |range, char| { + if let Err(err) = char { + push_err(1, (range.start, err)); + } + }) } } - BYTE_STRING => { + } + if let Some(s) = literal.as_byte_string() { + if !s.is_raw() { if let Some(without_quotes) = unquote(text, 2, '"') { unescape_byte_literal(without_quotes, Mode::ByteStr, &mut |range, char| { if let Err(err) = char { @@ -141,13 +142,17 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec) { }) } } - STRING => { - if let Some(without_quotes) = unquote(text, 1, '"') { - unescape_literal(without_quotes, Mode::Str, &mut |range, char| { - if let Err(err) = char { - push_err(1, (range.start, err)); - } - }) + } + + match token.kind() { + BYTE => { + if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape_byte) { + push_err(2, e); + } + } + CHAR => { + if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape_char) { + push_err(1, e); } } _ => (), diff --git a/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt index 6fd59ccc0..54e707b73 100644 --- a/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt +++ b/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt @@ -1,2 +1,2 @@ -RAW_STRING 4 "r##\"" +STRING 4 "r##\"" > error0..4 token("r##\"") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt b/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt index 8d9ca0e8f..1f9889775 100644 --- a/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt +++ b/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt @@ -1,2 +1,2 @@ -RAW_STRING 8 "r##\"🦀" +STRING 8 "r##\"🦀" > error0..8 token("r##\"🦀") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt index a906380c7..93f6f72ae 100644 --- a/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt +++ b/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt @@ -1,2 +1,2 @@ -RAW_STRING 8 "r##\"\\x7f" +STRING 8 "r##\"\\x7f" > error0..8 token("r##\"\\x7f") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt index 5667c6149..1d2ebc60f 100644 --- a/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt +++ b/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt @@ -1,2 +1,2 @@ -RAW_STRING 12 "r##\"\\u{20AA}" +STRING 12 "r##\"\\u{20AA}" > error0..12 token("r##\"\\u{20AA}") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt b/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt index 141c8268e..c567ab7e2 100644 --- a/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt +++ b/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt @@ -1,2 +1,2 @@ -RAW_STRING 5 "r##\" " +STRING 5 "r##\" " > error0..5 token("r##\" ") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt b/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt index f61d4cc91..343b20323 100644 --- a/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt +++ b/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt @@ -1,2 +1,2 @@ -RAW_STRING 5 "r##\"\\" +STRING 5 "r##\"\\" > error0..5 token("r##\"\\") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt index 12e2c0fc0..041a42737 100644 --- a/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt +++ b/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt @@ -1,2 +1,2 @@ -RAW_STRING 6 "r##\"\\n" +STRING 6 "r##\"\\n" > error0..6 token("r##\"\\n") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt index fe12cb5fc..efaa1cafd 100644 --- a/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt +++ b/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 5 "br##\"" +BYTE_STRING 5 "br##\"" > error0..5 token("br##\"") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt b/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt index 5be2a7861..b6c938f94 100644 --- a/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt +++ b/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 9 "br##\"🦀" +BYTE_STRING 9 "br##\"🦀" > error0..9 token("br##\"🦀") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt index 6cbe08d07..f82efe49a 100644 --- a/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt +++ b/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 9 "br##\"\\x7f" +BYTE_STRING 9 "br##\"\\x7f" > error0..9 token("br##\"\\x7f") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt index f56a4f984..4e4a57696 100644 --- a/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt +++ b/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 13 "br##\"\\u{20AA}" +BYTE_STRING 13 "br##\"\\u{20AA}" > error0..13 token("br##\"\\u{20AA}") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt b/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt index 3d32ce34e..0018c8623 100644 --- a/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt +++ b/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 6 "br##\" " +BYTE_STRING 6 "br##\" " > error0..6 token("br##\" ") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt b/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt index 320fea177..c3ba4ae82 100644 --- a/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt +++ b/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 6 "br##\"\\" +BYTE_STRING 6 "br##\"\\" > error0..6 token("br##\"\\") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt index b3a56380c..7bda72276 100644 --- a/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt +++ b/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 7 "br##\"\\n" +BYTE_STRING 7 "br##\"\\n" > error0..7 token("br##\"\\n") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt index 5af1e2d97..ce92d2ff7 100644 --- a/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt +++ b/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt @@ -1,2 +1,2 @@ -RAW_STRING 3 "r##" +STRING 3 "r##" > error0..3 token("r##") msg(Missing `"` symbol after `#` symbols to begin the raw string literal) diff --git a/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt index aec7afd92..a75d9030c 100644 --- a/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt +++ b/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt @@ -1,2 +1,2 @@ -RAW_BYTE_STRING 4 "br##" +BYTE_STRING 4 "br##" > error0..4 token("br##") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal) diff --git a/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt b/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt index e22fe5374..516e0b78e 100644 --- a/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt +++ b/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt @@ -1,4 +1,4 @@ -RAW_STRING 4 "r## " +STRING 4 "r## " IDENT 1 "I" WHITESPACE 1 " " IDENT 4 "lack" diff --git a/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt b/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt index d74ea4c27..2f8a6f5f2 100644 --- a/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt +++ b/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt @@ -1,4 +1,4 @@ -RAW_BYTE_STRING 5 "br## " +BYTE_STRING 5 "br## " IDENT 1 "I" WHITESPACE 1 " " IDENT 4 "lack" diff --git a/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt b/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt index bc03b51a8..e61ad99be 100644 --- a/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt +++ b/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt @@ -4,13 +4,13 @@ BYTE 4 "b\'x\'" WHITESPACE 1 " " BYTE_STRING 6 "b\"foo\"" WHITESPACE 1 " " -RAW_BYTE_STRING 4 "br\"\"" +BYTE_STRING 4 "br\"\"" WHITESPACE 1 "\n" BYTE 6 "b\'\'suf" WHITESPACE 1 " " BYTE_STRING 5 "b\"\"ix" WHITESPACE 1 " " -RAW_BYTE_STRING 6 "br\"\"br" +BYTE_STRING 6 "br\"\"br" WHITESPACE 1 "\n" BYTE 5 "b\'\\n\'" WHITESPACE 1 " " diff --git a/crates/syntax/test_data/lexer/ok/0009_strings.txt b/crates/syntax/test_data/lexer/ok/0009_strings.txt index 4cb4d711d..988a8877b 100644 --- a/crates/syntax/test_data/lexer/ok/0009_strings.txt +++ b/crates/syntax/test_data/lexer/ok/0009_strings.txt @@ -1,6 +1,6 @@ STRING 7 "\"hello\"" WHITESPACE 1 " " -RAW_STRING 8 "r\"world\"" +STRING 8 "r\"world\"" WHITESPACE 1 " " STRING 17 "\"\\n\\\"\\\\no escape\"" WHITESPACE 1 " " diff --git a/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt b/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt index 9cf0957d1..db0d5ffd1 100644 --- a/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt +++ b/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt @@ -1,2 +1,2 @@ -RAW_STRING 36 "r###\"this is a r##\"raw\"## string\"###" +STRING 36 "r###\"this is a r##\"raw\"## string\"###" WHITESPACE 1 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast index 9a87b5b93..ae838105d 100644 --- a/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast +++ b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast @@ -104,7 +104,7 @@ SOURCE_FILE@0..189 EQ@142..143 "=" WHITESPACE@143..144 " " LITERAL@144..148 - RAW_STRING@144..148 "r\"d\"" + STRING@144..148 "r\"d\"" SEMICOLON@148..149 ";" WHITESPACE@149..154 "\n " LET_STMT@154..167 @@ -128,7 +128,7 @@ SOURCE_FILE@0..189 EQ@178..179 "=" WHITESPACE@179..180 " " LITERAL@180..185 - RAW_BYTE_STRING@180..185 "br\"f\"" + BYTE_STRING@180..185 "br\"f\"" SEMICOLON@185..186 ";" WHITESPACE@186..187 "\n" R_CURLY@187..188 "}" -- cgit v1.2.3