diff options
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 10 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 6 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items.rs | 8 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/adt.rs | 18 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/consts.rs | 4 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/type_params.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/syntax_kind/generated.rs | 41 |
7 files changed, 45 insertions, 44 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 7dfac2813..c2e1d701e 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -142,16 +142,16 @@ pub(crate) fn reparser( | |||
142 | ) -> Option<fn(&mut Parser)> { | 142 | ) -> Option<fn(&mut Parser)> { |
143 | let res = match node { | 143 | let res = match node { |
144 | BLOCK_EXPR => expressions::block_expr, | 144 | BLOCK_EXPR => expressions::block_expr, |
145 | RECORD_FIELD_DEF_LIST => items::record_field_def_list, | 145 | RECORD_FIELD_LIST => items::record_field_def_list, |
146 | RECORD_FIELD_LIST => items::record_field_list, | 146 | RECORD_EXPR_FIELD_LIST => items::record_field_list, |
147 | ENUM_VARIANT_LIST => items::enum_variant_list, | 147 | VARIANT_LIST => items::enum_variant_list, |
148 | MATCH_ARM_LIST => items::match_arm_list, | 148 | MATCH_ARM_LIST => items::match_arm_list, |
149 | USE_TREE_LIST => items::use_tree_list, | 149 | USE_TREE_LIST => items::use_tree_list, |
150 | EXTERN_ITEM_LIST => items::extern_item_list, | 150 | EXTERN_ITEM_LIST => items::extern_item_list, |
151 | TOKEN_TREE if first_child? == T!['{'] => items::token_tree, | 151 | TOKEN_TREE if first_child? == T!['{'] => items::token_tree, |
152 | ASSOC_ITEM_LIST => match parent? { | 152 | ASSOC_ITEM_LIST => match parent? { |
153 | IMPL_DEF => items::impl_item_list, | 153 | IMPL => items::impl_item_list, |
154 | TRAIT_DEF => items::trait_item_list, | 154 | TRAIT => items::trait_item_list, |
155 | _ => return None, | 155 | _ => return None, |
156 | }, | 156 | }, |
157 | ITEM_LIST => items::mod_item_list, | 157 | ITEM_LIST => items::mod_item_list, |
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 6e72eea66..e1c25a838 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -587,7 +587,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { | |||
587 | match p.current() { | 587 | match p.current() { |
588 | T!['{'] if !r.forbid_structs => { | 588 | T!['{'] if !r.forbid_structs => { |
589 | record_field_list(p); | 589 | record_field_list(p); |
590 | (m.complete(p, RECORD_LIT), BlockLike::NotBlock) | 590 | (m.complete(p, RECORD_EXPR), BlockLike::NotBlock) |
591 | } | 591 | } |
592 | T![!] if !p.at(T![!=]) => { | 592 | T![!] if !p.at(T![!=]) => { |
593 | let block_like = items::macro_call_after_excl(p); | 593 | let block_like = items::macro_call_after_excl(p); |
@@ -627,7 +627,7 @@ pub(crate) fn record_field_list(p: &mut Parser) { | |||
627 | p.expect(T![:]); | 627 | p.expect(T![:]); |
628 | } | 628 | } |
629 | expr(p); | 629 | expr(p); |
630 | m.complete(p, RECORD_FIELD); | 630 | m.complete(p, RECORD_EXPR_FIELD); |
631 | } | 631 | } |
632 | T![.] if p.at(T![..]) => { | 632 | T![.] if p.at(T![..]) => { |
633 | m.abandon(p); | 633 | m.abandon(p); |
@@ -648,5 +648,5 @@ pub(crate) fn record_field_list(p: &mut Parser) { | |||
648 | } | 648 | } |
649 | } | 649 | } |
650 | p.expect(T!['}']); | 650 | p.expect(T!['}']); |
651 | m.complete(p, RECORD_FIELD_LIST); | 651 | m.complete(p, RECORD_EXPR_FIELD_LIST); |
652 | } | 652 | } |
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 3b73e5346..cca524cea 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -180,7 +180,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
180 | // unsafe const fn bar() {} | 180 | // unsafe const fn bar() {} |
181 | T![fn] => { | 181 | T![fn] => { |
182 | fn_def(p); | 182 | fn_def(p); |
183 | m.complete(p, FN_DEF); | 183 | m.complete(p, FN); |
184 | } | 184 | } |
185 | 185 | ||
186 | // test unsafe_trait | 186 | // test unsafe_trait |
@@ -193,7 +193,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
193 | // unsafe auto trait T {} | 193 | // unsafe auto trait T {} |
194 | T![trait] => { | 194 | T![trait] => { |
195 | traits::trait_def(p); | 195 | traits::trait_def(p); |
196 | m.complete(p, TRAIT_DEF); | 196 | m.complete(p, TRAIT); |
197 | } | 197 | } |
198 | 198 | ||
199 | // test unsafe_impl | 199 | // test unsafe_impl |
@@ -221,7 +221,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
221 | // unsafe default impl Foo {} | 221 | // unsafe default impl Foo {} |
222 | T![impl] => { | 222 | T![impl] => { |
223 | traits::impl_def(p); | 223 | traits::impl_def(p); |
224 | m.complete(p, IMPL_DEF); | 224 | m.complete(p, IMPL); |
225 | } | 225 | } |
226 | 226 | ||
227 | // test existential_type | 227 | // test existential_type |
@@ -380,7 +380,7 @@ fn type_def(p: &mut Parser, m: Marker) { | |||
380 | types::type_(p); | 380 | types::type_(p); |
381 | } | 381 | } |
382 | p.expect(T![;]); | 382 | p.expect(T![;]); |
383 | m.complete(p, TYPE_ALIAS_DEF); | 383 | m.complete(p, TYPE_ALIAS); |
384 | } | 384 | } |
385 | 385 | ||
386 | pub(crate) fn mod_item(p: &mut Parser, m: Marker) { | 386 | pub(crate) fn mod_item(p: &mut Parser, m: Marker) { |
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index 74b9f514b..addfb59d4 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs | |||
@@ -5,13 +5,13 @@ use super::*; | |||
5 | pub(super) fn struct_def(p: &mut Parser, m: Marker) { | 5 | pub(super) fn struct_def(p: &mut Parser, m: Marker) { |
6 | assert!(p.at(T![struct])); | 6 | assert!(p.at(T![struct])); |
7 | p.bump(T![struct]); | 7 | p.bump(T![struct]); |
8 | struct_or_union(p, m, T![struct], STRUCT_DEF); | 8 | struct_or_union(p, m, T![struct], STRUCT); |
9 | } | 9 | } |
10 | 10 | ||
11 | pub(super) fn union_def(p: &mut Parser, m: Marker) { | 11 | pub(super) fn union_def(p: &mut Parser, m: Marker) { |
12 | assert!(p.at_contextual_kw("union")); | 12 | assert!(p.at_contextual_kw("union")); |
13 | p.bump_remap(T![union]); | 13 | p.bump_remap(T![union]); |
14 | struct_or_union(p, m, T![union], UNION_DEF); | 14 | struct_or_union(p, m, T![union], UNION); |
15 | } | 15 | } |
16 | 16 | ||
17 | fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | 17 | fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { |
@@ -64,7 +64,7 @@ pub(super) fn enum_def(p: &mut Parser, m: Marker) { | |||
64 | } else { | 64 | } else { |
65 | p.error("expected `{`") | 65 | p.error("expected `{`") |
66 | } | 66 | } |
67 | m.complete(p, ENUM_DEF); | 67 | m.complete(p, ENUM); |
68 | } | 68 | } |
69 | 69 | ||
70 | pub(crate) fn enum_variant_list(p: &mut Parser) { | 70 | pub(crate) fn enum_variant_list(p: &mut Parser) { |
@@ -91,7 +91,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
91 | if p.eat(T![=]) { | 91 | if p.eat(T![=]) { |
92 | expressions::expr(p); | 92 | expressions::expr(p); |
93 | } | 93 | } |
94 | var.complete(p, ENUM_VARIANT); | 94 | var.complete(p, VARIANT); |
95 | } else { | 95 | } else { |
96 | var.abandon(p); | 96 | var.abandon(p); |
97 | p.err_and_bump("expected enum variant"); | 97 | p.err_and_bump("expected enum variant"); |
@@ -101,7 +101,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
101 | } | 101 | } |
102 | } | 102 | } |
103 | p.expect(T!['}']); | 103 | p.expect(T!['}']); |
104 | m.complete(p, ENUM_VARIANT_LIST); | 104 | m.complete(p, VARIANT_LIST); |
105 | } | 105 | } |
106 | 106 | ||
107 | pub(crate) fn record_field_def_list(p: &mut Parser) { | 107 | pub(crate) fn record_field_def_list(p: &mut Parser) { |
@@ -119,7 +119,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | p.expect(T!['}']); | 121 | p.expect(T!['}']); |
122 | m.complete(p, RECORD_FIELD_DEF_LIST); | 122 | m.complete(p, RECORD_FIELD_LIST); |
123 | 123 | ||
124 | fn record_field_def(p: &mut Parser) { | 124 | fn record_field_def(p: &mut Parser) { |
125 | let m = p.start(); | 125 | let m = p.start(); |
@@ -134,7 +134,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
134 | name(p); | 134 | name(p); |
135 | p.expect(T![:]); | 135 | p.expect(T![:]); |
136 | types::type_(p); | 136 | types::type_(p); |
137 | m.complete(p, RECORD_FIELD_DEF); | 137 | m.complete(p, RECORD_FIELD); |
138 | } else { | 138 | } else { |
139 | m.abandon(p); | 139 | m.abandon(p); |
140 | p.err_and_bump("expected field declaration"); | 140 | p.err_and_bump("expected field declaration"); |
@@ -167,12 +167,12 @@ fn tuple_field_def_list(p: &mut Parser) { | |||
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | types::type_(p); | 169 | types::type_(p); |
170 | m.complete(p, TUPLE_FIELD_DEF); | 170 | m.complete(p, TUPLE_FIELD); |
171 | 171 | ||
172 | if !p.at(T![')']) { | 172 | if !p.at(T![')']) { |
173 | p.expect(T![,]); | 173 | p.expect(T![,]); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | p.expect(T![')']); | 176 | p.expect(T![')']); |
177 | m.complete(p, TUPLE_FIELD_DEF_LIST); | 177 | m.complete(p, TUPLE_FIELD_LIST); |
178 | } | 178 | } |
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs index 742a7e056..35ad766dc 100644 --- a/crates/ra_parser/src/grammar/items/consts.rs +++ b/crates/ra_parser/src/grammar/items/consts.rs | |||
@@ -3,11 +3,11 @@ | |||
3 | use super::*; | 3 | use super::*; |
4 | 4 | ||
5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { | 5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { |
6 | const_or_static(p, m, T![static], STATIC_DEF) | 6 | const_or_static(p, m, T![static], STATIC) |
7 | } | 7 | } |
8 | 8 | ||
9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { | 9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { |
10 | const_or_static(p, m, T![const], CONST_DEF) | 10 | const_or_static(p, m, T![const], CONST) |
11 | } | 11 | } |
12 | 12 | ||
13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | 13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { |
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs index d1330d4b9..90dabb4c0 100644 --- a/crates/ra_parser/src/grammar/type_params.rs +++ b/crates/ra_parser/src/grammar/type_params.rs | |||
@@ -36,7 +36,7 @@ fn type_param_list(p: &mut Parser) { | |||
36 | } | 36 | } |
37 | } | 37 | } |
38 | p.expect(T![>]); | 38 | p.expect(T![>]); |
39 | m.complete(p, TYPE_PARAM_LIST); | 39 | m.complete(p, GENERIC_PARAM_LIST); |
40 | } | 40 | } |
41 | 41 | ||
42 | fn lifetime_param(p: &mut Parser, m: Marker) { | 42 | fn lifetime_param(p: &mut Parser, m: Marker) { |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 4f35e0baa..be4da67bc 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` | 1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` |
2 | 2 | ||
3 | #![allow(bad_style, missing_docs, unreachable_pub)] | 3 | #![allow(bad_style, missing_docs, unreachable_pub)] |
4 | #[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`."] | 4 | #[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`."] |
5 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] | 5 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
6 | #[repr(u16)] | 6 | #[repr(u16)] |
7 | pub enum SyntaxKind { | 7 | pub enum SyntaxKind { |
@@ -123,19 +123,19 @@ pub enum SyntaxKind { | |||
123 | L_DOLLAR, | 123 | L_DOLLAR, |
124 | R_DOLLAR, | 124 | R_DOLLAR, |
125 | SOURCE_FILE, | 125 | SOURCE_FILE, |
126 | STRUCT_DEF, | 126 | STRUCT, |
127 | UNION_DEF, | 127 | UNION, |
128 | ENUM_DEF, | 128 | ENUM, |
129 | FN_DEF, | 129 | FN, |
130 | RET_TYPE, | 130 | RET_TYPE, |
131 | EXTERN_CRATE, | 131 | EXTERN_CRATE, |
132 | MODULE, | 132 | MODULE, |
133 | USE, | 133 | USE, |
134 | STATIC_DEF, | 134 | STATIC, |
135 | CONST_DEF, | 135 | CONST, |
136 | TRAIT_DEF, | 136 | TRAIT, |
137 | IMPL_DEF, | 137 | IMPL, |
138 | TYPE_ALIAS_DEF, | 138 | TYPE_ALIAS, |
139 | MACRO_CALL, | 139 | MACRO_CALL, |
140 | TOKEN_TREE, | 140 | TOKEN_TREE, |
141 | MACRO_DEF, | 141 | MACRO_DEF, |
@@ -188,9 +188,9 @@ pub enum SyntaxKind { | |||
188 | MATCH_ARM_LIST, | 188 | MATCH_ARM_LIST, |
189 | MATCH_ARM, | 189 | MATCH_ARM, |
190 | MATCH_GUARD, | 190 | MATCH_GUARD, |
191 | RECORD_LIT, | 191 | RECORD_EXPR, |
192 | RECORD_FIELD_LIST, | 192 | RECORD_EXPR_FIELD_LIST, |
193 | RECORD_FIELD, | 193 | RECORD_EXPR_FIELD, |
194 | EFFECT_EXPR, | 194 | EFFECT_EXPR, |
195 | BOX_EXPR, | 195 | BOX_EXPR, |
196 | CALL_EXPR, | 196 | CALL_EXPR, |
@@ -206,12 +206,12 @@ pub enum SyntaxKind { | |||
206 | BIN_EXPR, | 206 | BIN_EXPR, |
207 | EXTERN_BLOCK, | 207 | EXTERN_BLOCK, |
208 | EXTERN_ITEM_LIST, | 208 | EXTERN_ITEM_LIST, |
209 | ENUM_VARIANT, | 209 | VARIANT, |
210 | RECORD_FIELD_DEF_LIST, | 210 | RECORD_FIELD_LIST, |
211 | RECORD_FIELD_DEF, | 211 | RECORD_FIELD, |
212 | TUPLE_FIELD_DEF_LIST, | 212 | TUPLE_FIELD_LIST, |
213 | TUPLE_FIELD_DEF, | 213 | TUPLE_FIELD, |
214 | ENUM_VARIANT_LIST, | 214 | VARIANT_LIST, |
215 | ITEM_LIST, | 215 | ITEM_LIST, |
216 | ASSOC_ITEM_LIST, | 216 | ASSOC_ITEM_LIST, |
217 | ATTR, | 217 | ATTR, |
@@ -230,7 +230,8 @@ pub enum SyntaxKind { | |||
230 | NAME_REF, | 230 | NAME_REF, |
231 | LET_STMT, | 231 | LET_STMT, |
232 | EXPR_STMT, | 232 | EXPR_STMT, |
233 | TYPE_PARAM_LIST, | 233 | GENERIC_PARAM_LIST, |
234 | GENERIC_PARAM, | ||
234 | LIFETIME_PARAM, | 235 | LIFETIME_PARAM, |
235 | TYPE_PARAM, | 236 | TYPE_PARAM, |
236 | CONST_PARAM, | 237 | CONST_PARAM, |