aboutsummaryrefslogtreecommitdiff
path: root/crates/parser
diff options
context:
space:
mode:
Diffstat (limited to 'crates/parser')
-rw-r--r--crates/parser/src/grammar.rs5
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs14
-rw-r--r--crates/parser/src/grammar/items.rs4
-rw-r--r--crates/parser/src/syntax_kind/generated.rs5
4 files changed, 5 insertions, 23 deletions
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) {
236 assert!(p.at(T![extern])); 236 assert!(p.at(T![extern]));
237 let abi = p.start(); 237 let abi = p.start();
238 p.bump(T![extern]); 238 p.bump(T![extern]);
239 match p.current() { 239 p.eat(STRING);
240 STRING | RAW_STRING => p.bump_any(),
241 _ => (),
242 }
243 abi.complete(p, ABI); 240 abi.complete(p, ABI);
244} 241}
245 242
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::*;
15// let _ = b"e"; 15// let _ = b"e";
16// let _ = br"f"; 16// let _ = br"f";
17// } 17// }
18pub(crate) const LITERAL_FIRST: TokenSet = TokenSet::new(&[ 18pub(crate) const LITERAL_FIRST: TokenSet =
19 TRUE_KW, 19 TokenSet::new(&[TRUE_KW, FALSE_KW, INT_NUMBER, FLOAT_NUMBER, BYTE, CHAR, STRING, BYTE_STRING]);
20 FALSE_KW,
21 INT_NUMBER,
22 FLOAT_NUMBER,
23 BYTE,
24 CHAR,
25 STRING,
26 RAW_STRING,
27 BYTE_STRING,
28 RAW_BYTE_STRING,
29]);
30 20
31pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> { 21pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> {
32 if !p.at_ts(LITERAL_FIRST) { 22 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> {
239 T![static] => consts::static_(p, m), 239 T![static] => consts::static_(p, m),
240 // test extern_block 240 // test extern_block
241 // extern {} 241 // extern {}
242 T![extern] 242 T![extern] if la == T!['{'] || (la == STRING && p.nth(2) == T!['{']) => {
243 if la == T!['{'] || ((la == STRING || la == RAW_STRING) && p.nth(2) == T!['{']) =>
244 {
245 abi(p); 243 abi(p);
246 extern_item_list(p); 244 extern_item_list(p);
247 m.complete(p, EXTERN_BLOCK); 245 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 {
111 CHAR, 111 CHAR,
112 BYTE, 112 BYTE,
113 STRING, 113 STRING,
114 RAW_STRING,
115 BYTE_STRING, 114 BYTE_STRING,
116 RAW_BYTE_STRING,
117 ERROR, 115 ERROR,
118 IDENT, 116 IDENT,
119 WHITESPACE, 117 WHITESPACE,
@@ -277,8 +275,7 @@ impl SyntaxKind {
277 } 275 }
278 pub fn is_literal(self) -> bool { 276 pub fn is_literal(self) -> bool {
279 match self { 277 match self {
280 INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | RAW_STRING | BYTE_STRING 278 INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | BYTE_STRING => true,
281 | RAW_BYTE_STRING => true,
282 _ => false, 279 _ => false,
283 } 280 }
284 } 281 }