diff options
author | Josh Robson Chase <[email protected]> | 2019-01-23 17:15:47 +0000 |
---|---|---|
committer | Josh Robson Chase <[email protected]> | 2019-01-23 18:17:41 +0000 |
commit | 1cd6d6539a9d85bc44db364bb9165e6d9253790d (patch) | |
tree | 9700b48ecbf34496d45c5e08e27c113698fb1452 /crates/ra_syntax/src/grammar/items.rs | |
parent | 0b942cbcb071811a811aa35feaa80950c2415075 (diff) |
Add raw idents to lexer and parser
Diffstat (limited to 'crates/ra_syntax/src/grammar/items.rs')
-rw-r--r-- | crates/ra_syntax/src/grammar/items.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs index 265e84570..c49798444 100644 --- a/crates/ra_syntax/src/grammar/items.rs +++ b/crates/ra_syntax/src/grammar/items.rs | |||
@@ -99,11 +99,11 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem { | |||
99 | has_mods = true; | 99 | has_mods = true; |
100 | abi(p); | 100 | abi(p); |
101 | } | 101 | } |
102 | if p.at(IDENT) && p.at_contextual_kw("auto") && p.nth(1) == TRAIT_KW { | 102 | if p.current().is_ident() && p.at_contextual_kw("auto") && p.nth(1) == TRAIT_KW { |
103 | p.bump_remap(AUTO_KW); | 103 | p.bump_remap(AUTO_KW); |
104 | has_mods = true; | 104 | has_mods = true; |
105 | } | 105 | } |
106 | if p.at(IDENT) && p.at_contextual_kw("default") && p.nth(1) == IMPL_KW { | 106 | if p.current().is_ident() && p.at_contextual_kw("default") && p.nth(1) == IMPL_KW { |
107 | p.bump_remap(DEFAULT_KW); | 107 | p.bump_remap(DEFAULT_KW); |
108 | has_mods = true; | 108 | has_mods = true; |
109 | } | 109 | } |
@@ -202,7 +202,7 @@ fn items_without_modifiers(p: &mut Parser) -> Option<SyntaxKind> { | |||
202 | } | 202 | } |
203 | STRUCT_DEF | 203 | STRUCT_DEF |
204 | } | 204 | } |
205 | IDENT if p.at_contextual_kw("union") && p.nth(1) == IDENT => { | 205 | IDENT | RAW_IDENT if p.at_contextual_kw("union") && p.nth(1).is_ident() => { |
206 | // test union_items | 206 | // test union_items |
207 | // union Foo {} | 207 | // union Foo {} |
208 | // union Foo { | 208 | // union Foo { |
@@ -220,7 +220,7 @@ fn items_without_modifiers(p: &mut Parser) -> Option<SyntaxKind> { | |||
220 | use_item::use_item(p); | 220 | use_item::use_item(p); |
221 | USE_ITEM | 221 | USE_ITEM |
222 | } | 222 | } |
223 | CONST_KW if (la == IDENT || la == MUT_KW) => { | 223 | CONST_KW if (la.is_ident() || la == MUT_KW) => { |
224 | consts::const_def(p); | 224 | consts::const_def(p); |
225 | CONST_DEF | 225 | CONST_DEF |
226 | } | 226 | } |
@@ -351,7 +351,7 @@ fn macro_call(p: &mut Parser) -> BlockLike { | |||
351 | 351 | ||
352 | pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike { | 352 | pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike { |
353 | p.expect(EXCL); | 353 | p.expect(EXCL); |
354 | p.eat(IDENT); | 354 | p.eat_one(&[IDENT, RAW_IDENT]); |
355 | match p.current() { | 355 | match p.current() { |
356 | L_CURLY => { | 356 | L_CURLY => { |
357 | token_tree(p); | 357 | token_tree(p); |