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/parser/src/grammar.rs | 5 +---- crates/parser/src/grammar/expressions/atom.rs | 14 ++------------ crates/parser/src/grammar/items.rs | 4 +--- crates/parser/src/syntax_kind/generated.rs | 5 +---- 4 files changed, 5 insertions(+), 23 deletions(-) (limited to 'crates/parser/src') diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index 4ab206a83..116b991a8 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -236,10 +236,7 @@ fn abi(p: &mut Parser) { assert!(p.at(T![extern])); let abi = p.start(); p.bump(T![extern]); - match p.current() { - STRING | RAW_STRING => p.bump_any(), - _ => (), - } + p.eat(STRING); abi.complete(p, ABI); } diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 66a92a4e1..31f42f161 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -15,18 +15,8 @@ use super::*; // let _ = b"e"; // let _ = br"f"; // } -pub(crate) const LITERAL_FIRST: TokenSet = TokenSet::new(&[ - TRUE_KW, - FALSE_KW, - INT_NUMBER, - FLOAT_NUMBER, - BYTE, - CHAR, - STRING, - RAW_STRING, - BYTE_STRING, - RAW_BYTE_STRING, -]); +pub(crate) const LITERAL_FIRST: TokenSet = + TokenSet::new(&[TRUE_KW, FALSE_KW, INT_NUMBER, FLOAT_NUMBER, BYTE, CHAR, STRING, BYTE_STRING]); pub(crate) fn literal(p: &mut Parser) -> Option { if !p.at_ts(LITERAL_FIRST) { diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs index 22810e6fb..780bc470a 100644 --- a/crates/parser/src/grammar/items.rs +++ b/crates/parser/src/grammar/items.rs @@ -239,9 +239,7 @@ fn items_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> { T![static] => consts::static_(p, m), // test extern_block // extern {} - T![extern] - if la == T!['{'] || ((la == STRING || la == RAW_STRING) && p.nth(2) == T!['{']) => - { + T![extern] if la == T!['{'] || (la == STRING && p.nth(2) == T!['{']) => { abi(p); extern_item_list(p); m.complete(p, EXTERN_BLOCK); diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs index 935bd2c5e..8bc6688f3 100644 --- a/crates/parser/src/syntax_kind/generated.rs +++ b/crates/parser/src/syntax_kind/generated.rs @@ -111,9 +111,7 @@ pub enum SyntaxKind { CHAR, BYTE, STRING, - RAW_STRING, BYTE_STRING, - RAW_BYTE_STRING, ERROR, IDENT, WHITESPACE, @@ -277,8 +275,7 @@ impl SyntaxKind { } pub fn is_literal(self) -> bool { match self { - INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | RAW_STRING | BYTE_STRING - | RAW_BYTE_STRING => true, + INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | BYTE_STRING => true, _ => false, } } -- cgit v1.2.3