diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/items/use_item.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/items/use_item.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/ra_parser/src/grammar/items/use_item.rs index 83a65e226..7a1693a34 100644 --- a/crates/ra_parser/src/grammar/items/use_item.rs +++ b/crates/ra_parser/src/grammar/items/use_item.rs | |||
@@ -2,7 +2,7 @@ use super::*; | |||
2 | 2 | ||
3 | pub(super) fn use_item(p: &mut Parser, m: Marker) { | 3 | pub(super) fn use_item(p: &mut Parser, m: Marker) { |
4 | assert!(p.at(T![use])); | 4 | assert!(p.at(T![use])); |
5 | p.bump(); | 5 | p.bump_any(); |
6 | use_tree(p); | 6 | use_tree(p); |
7 | p.expect(T![;]); | 7 | p.expect(T![;]); |
8 | m.complete(p, USE_ITEM); | 8 | m.complete(p, USE_ITEM); |
@@ -28,15 +28,15 @@ fn use_tree(p: &mut Parser) { | |||
28 | // use ::*; | 28 | // use ::*; |
29 | // use some::path::{*}; | 29 | // use some::path::{*}; |
30 | // use some::path::{::*}; | 30 | // use some::path::{::*}; |
31 | (T![*], _) => p.bump(), | 31 | (T![*], _) => p.bump_any(), |
32 | (T![::], T![*]) => { | 32 | (T![::], T![*]) => { |
33 | // Parse `use ::*;`, which imports all from the crate root in Rust 2015 | 33 | // Parse `use ::*;`, which imports all from the crate root in Rust 2015 |
34 | // This is invalid inside a use_tree_list, (e.g. `use some::path::{::*}`) | 34 | // This is invalid inside a use_tree_list, (e.g. `use some::path::{::*}`) |
35 | // but still parses and errors later: ('crate root in paths can only be used in start position') | 35 | // but still parses and errors later: ('crate root in paths can only be used in start position') |
36 | // FIXME: Add this error (if not out of scope) | 36 | // FIXME: Add this error (if not out of scope) |
37 | // In Rust 2018, it is always invalid (see above) | 37 | // In Rust 2018, it is always invalid (see above) |
38 | p.bump(); | 38 | p.bump_any(); |
39 | p.bump(); | 39 | p.bump_any(); |
40 | } | 40 | } |
41 | // Open a use tree list | 41 | // Open a use tree list |
42 | // Handles cases such as `use {some::path};` or `{inner::path}` in | 42 | // Handles cases such as `use {some::path};` or `{inner::path}` in |
@@ -49,7 +49,7 @@ fn use_tree(p: &mut Parser) { | |||
49 | // use ::{{{crate::export}}}; // Nonsensical but perfectly legal nestnig | 49 | // use ::{{{crate::export}}}; // Nonsensical but perfectly legal nestnig |
50 | (T!['{'], _) | (T![::], T!['{']) => { | 50 | (T!['{'], _) | (T![::], T!['{']) => { |
51 | if p.at(T![::]) { | 51 | if p.at(T![::]) { |
52 | p.bump(); | 52 | p.bump_any(); |
53 | } | 53 | } |
54 | use_tree_list(p); | 54 | use_tree_list(p); |
55 | } | 55 | } |
@@ -81,10 +81,10 @@ fn use_tree(p: &mut Parser) { | |||
81 | opt_alias(p); | 81 | opt_alias(p); |
82 | } | 82 | } |
83 | T![::] => { | 83 | T![::] => { |
84 | p.bump(); | 84 | p.bump_any(); |
85 | match p.current() { | 85 | match p.current() { |
86 | T![*] => { | 86 | T![*] => { |
87 | p.bump(); | 87 | p.bump_any(); |
88 | } | 88 | } |
89 | // test use_tree_list_after_path | 89 | // test use_tree_list_after_path |
90 | // use crate::{Item}; | 90 | // use crate::{Item}; |
@@ -114,7 +114,7 @@ fn use_tree(p: &mut Parser) { | |||
114 | pub(crate) fn use_tree_list(p: &mut Parser) { | 114 | pub(crate) fn use_tree_list(p: &mut Parser) { |
115 | assert!(p.at(T!['{'])); | 115 | assert!(p.at(T!['{'])); |
116 | let m = p.start(); | 116 | let m = p.start(); |
117 | p.bump(); | 117 | p.bump_any(); |
118 | while !p.at(EOF) && !p.at(T!['}']) { | 118 | while !p.at(EOF) && !p.at(T!['}']) { |
119 | use_tree(p); | 119 | use_tree(p); |
120 | if !p.at(T!['}']) { | 120 | if !p.at(T!['}']) { |