aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/items
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar/items')
-rw-r--r--crates/ra_parser/src/grammar/items/consts.rs2
-rw-r--r--crates/ra_parser/src/grammar/items/nominal.rs12
-rw-r--r--crates/ra_parser/src/grammar/items/traits.rs8
-rw-r--r--crates/ra_parser/src/grammar/items/use_item.rs16
4 files changed, 19 insertions, 19 deletions
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs
index b4908ebba..e11546333 100644
--- a/crates/ra_parser/src/grammar/items/consts.rs
+++ b/crates/ra_parser/src/grammar/items/consts.rs
@@ -10,7 +10,7 @@ pub(super) fn const_def(p: &mut Parser, m: Marker) {
10 10
11fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { 11fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) {
12 assert!(p.at(kw)); 12 assert!(p.at(kw));
13 p.bump(); 13 p.bump_any();
14 p.eat(T![mut]); // FIXME: validator to forbid const mut 14 p.eat(T![mut]); // FIXME: validator to forbid const mut
15 name(p); 15 name(p);
16 types::ascription(p); 16 types::ascription(p);
diff --git a/crates/ra_parser/src/grammar/items/nominal.rs b/crates/ra_parser/src/grammar/items/nominal.rs
index 54f02c7c9..460acd65e 100644
--- a/crates/ra_parser/src/grammar/items/nominal.rs
+++ b/crates/ra_parser/src/grammar/items/nominal.rs
@@ -11,7 +11,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) {
11 type_params::opt_where_clause(p); 11 type_params::opt_where_clause(p);
12 match p.current() { 12 match p.current() {
13 T![;] => { 13 T![;] => {
14 p.bump(); 14 p.bump_any();
15 } 15 }
16 T!['{'] => record_field_def_list(p), 16 T!['{'] => record_field_def_list(p),
17 _ => { 17 _ => {
@@ -21,7 +21,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) {
21 } 21 }
22 } 22 }
23 T![;] if kind == T![struct] => { 23 T![;] if kind == T![struct] => {
24 p.bump(); 24 p.bump_any();
25 } 25 }
26 T!['{'] => record_field_def_list(p), 26 T!['{'] => record_field_def_list(p),
27 T!['('] if kind == T![struct] => { 27 T!['('] if kind == T![struct] => {
@@ -44,7 +44,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) {
44 44
45pub(super) fn enum_def(p: &mut Parser, m: Marker) { 45pub(super) fn enum_def(p: &mut Parser, m: Marker) {
46 assert!(p.at(T![enum])); 46 assert!(p.at(T![enum]));
47 p.bump(); 47 p.bump_any();
48 name_r(p, ITEM_RECOVERY_SET); 48 name_r(p, ITEM_RECOVERY_SET);
49 type_params::opt_type_param_list(p); 49 type_params::opt_type_param_list(p);
50 type_params::opt_where_clause(p); 50 type_params::opt_where_clause(p);
@@ -59,7 +59,7 @@ pub(super) fn enum_def(p: &mut Parser, m: Marker) {
59pub(crate) fn enum_variant_list(p: &mut Parser) { 59pub(crate) fn enum_variant_list(p: &mut Parser) {
60 assert!(p.at(T!['{'])); 60 assert!(p.at(T!['{']));
61 let m = p.start(); 61 let m = p.start();
62 p.bump(); 62 p.bump_any();
63 while !p.at(EOF) && !p.at(T!['}']) { 63 while !p.at(EOF) && !p.at(T!['}']) {
64 if p.at(T!['{']) { 64 if p.at(T!['{']) {
65 error_block(p, "expected enum variant"); 65 error_block(p, "expected enum variant");
@@ -73,7 +73,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) {
73 T!['{'] => record_field_def_list(p), 73 T!['{'] => record_field_def_list(p),
74 T!['('] => tuple_field_def_list(p), 74 T!['('] => tuple_field_def_list(p),
75 T![=] => { 75 T![=] => {
76 p.bump(); 76 p.bump_any();
77 expressions::expr(p); 77 expressions::expr(p);
78 } 78 }
79 _ => (), 79 _ => (),
@@ -94,7 +94,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) {
94pub(crate) fn record_field_def_list(p: &mut Parser) { 94pub(crate) fn record_field_def_list(p: &mut Parser) {
95 assert!(p.at(T!['{'])); 95 assert!(p.at(T!['{']));
96 let m = p.start(); 96 let m = p.start();
97 p.bump(); 97 p.bump_any();
98 while !p.at(T!['}']) && !p.at(EOF) { 98 while !p.at(T!['}']) && !p.at(EOF) {
99 if p.at(T!['{']) { 99 if p.at(T!['{']) {
100 error_block(p, "expected field"); 100 error_block(p, "expected field");
diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs
index 5fcacfbff..b49221a4b 100644
--- a/crates/ra_parser/src/grammar/items/traits.rs
+++ b/crates/ra_parser/src/grammar/items/traits.rs
@@ -5,7 +5,7 @@ use super::*;
5// trait X<U: Debug + Display>: Hash + Clone where U: Copy {} 5// trait X<U: Debug + Display>: Hash + Clone where U: Copy {}
6pub(super) fn trait_def(p: &mut Parser) { 6pub(super) fn trait_def(p: &mut Parser) {
7 assert!(p.at(T![trait])); 7 assert!(p.at(T![trait]));
8 p.bump(); 8 p.bump_any();
9 name_r(p, ITEM_RECOVERY_SET); 9 name_r(p, ITEM_RECOVERY_SET);
10 type_params::opt_type_param_list(p); 10 type_params::opt_type_param_list(p);
11 if p.at(T![:]) { 11 if p.at(T![:]) {
@@ -29,7 +29,7 @@ pub(super) fn trait_def(p: &mut Parser) {
29pub(crate) fn trait_item_list(p: &mut Parser) { 29pub(crate) fn trait_item_list(p: &mut Parser) {
30 assert!(p.at(T!['{'])); 30 assert!(p.at(T!['{']));
31 let m = p.start(); 31 let m = p.start();
32 p.bump(); 32 p.bump_any();
33 while !p.at(EOF) && !p.at(T!['}']) { 33 while !p.at(EOF) && !p.at(T!['}']) {
34 if p.at(T!['{']) { 34 if p.at(T!['{']) {
35 error_block(p, "expected an item"); 35 error_block(p, "expected an item");
@@ -45,7 +45,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
45// impl Foo {} 45// impl Foo {}
46pub(super) fn impl_block(p: &mut Parser) { 46pub(super) fn impl_block(p: &mut Parser) {
47 assert!(p.at(T![impl])); 47 assert!(p.at(T![impl]));
48 p.bump(); 48 p.bump_any();
49 if choose_type_params_over_qpath(p) { 49 if choose_type_params_over_qpath(p) {
50 type_params::opt_type_param_list(p); 50 type_params::opt_type_param_list(p);
51 } 51 }
@@ -78,7 +78,7 @@ pub(super) fn impl_block(p: &mut Parser) {
78pub(crate) fn impl_item_list(p: &mut Parser) { 78pub(crate) fn impl_item_list(p: &mut Parser) {
79 assert!(p.at(T!['{'])); 79 assert!(p.at(T!['{']));
80 let m = p.start(); 80 let m = p.start();
81 p.bump(); 81 p.bump_any();
82 // test impl_inner_attributes 82 // test impl_inner_attributes
83 // enum F{} 83 // enum F{}
84 // impl F { 84 // impl F {
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
3pub(super) fn use_item(p: &mut Parser, m: Marker) { 3pub(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) {
114pub(crate) fn use_tree_list(p: &mut Parser) { 114pub(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!['}']) {