diff options
author | Dmitry <[email protected]> | 2020-08-09 14:35:51 +0100 |
---|---|---|
committer | Dmitry <[email protected]> | 2020-08-09 14:39:32 +0100 |
commit | 8068302fefc75440b823f4bf1731a5f347d7c767 (patch) | |
tree | 251b967182e79bc82a58c2fb208c688f6152df1f /crates/ra_parser/src/grammar/items | |
parent | 1a43a0f63e0008787225abb6fb2baef97b6a39e0 (diff) | |
parent | 8a57afe5a4bfab40072a83f7dc4ca560bf860919 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'crates/ra_parser/src/grammar/items')
-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/items/traits.rs | 4 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/use_item.rs | 2 |
4 files changed, 14 insertions, 14 deletions
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/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs index c819e33be..ef9c8ff5b 100644 --- a/crates/ra_parser/src/grammar/items/traits.rs +++ b/crates/ra_parser/src/grammar/items/traits.rs | |||
@@ -50,7 +50,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) { | |||
50 | item_or_macro(p, true, ItemFlavor::Trait); | 50 | item_or_macro(p, true, ItemFlavor::Trait); |
51 | } | 51 | } |
52 | p.expect(T!['}']); | 52 | p.expect(T!['}']); |
53 | m.complete(p, ITEM_LIST); | 53 | m.complete(p, ASSOC_ITEM_LIST); |
54 | } | 54 | } |
55 | 55 | ||
56 | // test impl_def | 56 | // test impl_def |
@@ -107,7 +107,7 @@ pub(crate) fn impl_item_list(p: &mut Parser) { | |||
107 | item_or_macro(p, true, ItemFlavor::Mod); | 107 | item_or_macro(p, true, ItemFlavor::Mod); |
108 | } | 108 | } |
109 | p.expect(T!['}']); | 109 | p.expect(T!['}']); |
110 | m.complete(p, ITEM_LIST); | 110 | m.complete(p, ASSOC_ITEM_LIST); |
111 | } | 111 | } |
112 | 112 | ||
113 | // test impl_type_params | 113 | // test impl_type_params |
diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/ra_parser/src/grammar/items/use_item.rs index 3a0c7a31a..8e836a77e 100644 --- a/crates/ra_parser/src/grammar/items/use_item.rs +++ b/crates/ra_parser/src/grammar/items/use_item.rs | |||
@@ -7,7 +7,7 @@ pub(super) fn use_item(p: &mut Parser, m: Marker) { | |||
7 | p.bump(T![use]); | 7 | p.bump(T![use]); |
8 | use_tree(p, true); | 8 | use_tree(p, true); |
9 | p.expect(T![;]); | 9 | p.expect(T![;]); |
10 | m.complete(p, USE_ITEM); | 10 | m.complete(p, USE); |
11 | } | 11 | } |
12 | 12 | ||
13 | /// Parse a use 'tree', such as `some::path` in `use some::path;` | 13 | /// Parse a use 'tree', such as `some::path` in `use some::path;` |