diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-13 16:59:50 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-13 16:59:50 +0100 |
commit | 018a6cac072767dfd630c22e6d9ce134b7bb09af (patch) | |
tree | 4293492e643f9a604c5f30e051289bcea182694c /crates/parser/src/grammar/items/adt.rs | |
parent | 00fb411f3edea72a1a9739f7df6f21cca045730b (diff) | |
parent | 6bc2633c90cedad057c5201d1ab7f67b57247004 (diff) |
Merge #5750
5750: Rename ra_ide -> ide
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/parser/src/grammar/items/adt.rs')
-rw-r--r-- | crates/parser/src/grammar/items/adt.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/crates/parser/src/grammar/items/adt.rs b/crates/parser/src/grammar/items/adt.rs index addfb59d4..67c0c5697 100644 --- a/crates/parser/src/grammar/items/adt.rs +++ b/crates/parser/src/grammar/items/adt.rs | |||
@@ -2,13 +2,13 @@ | |||
2 | 2 | ||
3 | use super::*; | 3 | use super::*; |
4 | 4 | ||
5 | pub(super) fn struct_def(p: &mut Parser, m: Marker) { | 5 | pub(super) fn strukt(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); | 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(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); | 14 | struct_or_union(p, m, T![union], UNION); |
@@ -16,7 +16,7 @@ pub(super) fn union_def(p: &mut Parser, m: Marker) { | |||
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) { |
18 | name_r(p, ITEM_RECOVERY_SET); | 18 | name_r(p, ITEM_RECOVERY_SET); |
19 | type_params::opt_type_param_list(p); | 19 | type_params::opt_generic_param_list(p); |
20 | match p.current() { | 20 | match p.current() { |
21 | T![where] => { | 21 | T![where] => { |
22 | type_params::opt_where_clause(p); | 22 | type_params::opt_where_clause(p); |
@@ -24,7 +24,7 @@ fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | |||
24 | T![;] => { | 24 | T![;] => { |
25 | p.bump(T![;]); | 25 | p.bump(T![;]); |
26 | } | 26 | } |
27 | T!['{'] => record_field_def_list(p), | 27 | T!['{'] => record_field_list(p), |
28 | _ => { | 28 | _ => { |
29 | //FIXME: special case `(` error message | 29 | //FIXME: special case `(` error message |
30 | p.error("expected `;` or `{`"); | 30 | p.error("expected `;` or `{`"); |
@@ -34,9 +34,9 @@ fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | |||
34 | T![;] if kw == T![struct] => { | 34 | T![;] if kw == T![struct] => { |
35 | p.bump(T![;]); | 35 | p.bump(T![;]); |
36 | } | 36 | } |
37 | T!['{'] => record_field_def_list(p), | 37 | T!['{'] => record_field_list(p), |
38 | T!['('] if kw == T![struct] => { | 38 | T!['('] if kw == T![struct] => { |
39 | tuple_field_def_list(p); | 39 | tuple_field_list(p); |
40 | // test tuple_struct_where | 40 | // test tuple_struct_where |
41 | // struct Test<T>(T) where T: Clone; | 41 | // struct Test<T>(T) where T: Clone; |
42 | // struct Test<T>(T); | 42 | // struct Test<T>(T); |
@@ -53,21 +53,21 @@ fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | |||
53 | m.complete(p, def); | 53 | m.complete(p, def); |
54 | } | 54 | } |
55 | 55 | ||
56 | pub(super) fn enum_def(p: &mut Parser, m: Marker) { | 56 | pub(super) fn enum_(p: &mut Parser, m: Marker) { |
57 | assert!(p.at(T![enum])); | 57 | assert!(p.at(T![enum])); |
58 | p.bump(T![enum]); | 58 | p.bump(T![enum]); |
59 | name_r(p, ITEM_RECOVERY_SET); | 59 | name_r(p, ITEM_RECOVERY_SET); |
60 | type_params::opt_type_param_list(p); | 60 | type_params::opt_generic_param_list(p); |
61 | type_params::opt_where_clause(p); | 61 | type_params::opt_where_clause(p); |
62 | if p.at(T!['{']) { | 62 | if p.at(T!['{']) { |
63 | enum_variant_list(p); | 63 | variant_list(p); |
64 | } else { | 64 | } else { |
65 | p.error("expected `{`") | 65 | p.error("expected `{`") |
66 | } | 66 | } |
67 | m.complete(p, ENUM); | 67 | m.complete(p, ENUM); |
68 | } | 68 | } |
69 | 69 | ||
70 | pub(crate) fn enum_variant_list(p: &mut Parser) { | 70 | pub(crate) fn variant_list(p: &mut Parser) { |
71 | assert!(p.at(T!['{'])); | 71 | assert!(p.at(T!['{'])); |
72 | let m = p.start(); | 72 | let m = p.start(); |
73 | p.bump(T!['{']); | 73 | p.bump(T!['{']); |
@@ -77,12 +77,12 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
77 | continue; | 77 | continue; |
78 | } | 78 | } |
79 | let var = p.start(); | 79 | let var = p.start(); |
80 | attributes::outer_attributes(p); | 80 | attributes::outer_attrs(p); |
81 | if p.at(IDENT) { | 81 | if p.at(IDENT) { |
82 | name(p); | 82 | name(p); |
83 | match p.current() { | 83 | match p.current() { |
84 | T!['{'] => record_field_def_list(p), | 84 | T!['{'] => record_field_list(p), |
85 | T!['('] => tuple_field_def_list(p), | 85 | T!['('] => tuple_field_list(p), |
86 | _ => (), | 86 | _ => (), |
87 | } | 87 | } |
88 | 88 | ||
@@ -104,7 +104,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
104 | m.complete(p, 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_list(p: &mut Parser) { |
108 | assert!(p.at(T!['{'])); | 108 | assert!(p.at(T!['{'])); |
109 | let m = p.start(); | 109 | let m = p.start(); |
110 | p.bump(T!['{']); | 110 | p.bump(T!['{']); |
@@ -128,7 +128,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
128 | // #[serde(with = "url_serde")] | 128 | // #[serde(with = "url_serde")] |
129 | // pub uri: Uri, | 129 | // pub uri: Uri, |
130 | // } | 130 | // } |
131 | attributes::outer_attributes(p); | 131 | attributes::outer_attrs(p); |
132 | opt_visibility(p); | 132 | opt_visibility(p); |
133 | if p.at(IDENT) { | 133 | if p.at(IDENT) { |
134 | name(p); | 134 | name(p); |
@@ -142,7 +142,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | fn tuple_field_def_list(p: &mut Parser) { | 145 | fn tuple_field_list(p: &mut Parser) { |
146 | assert!(p.at(T!['('])); | 146 | assert!(p.at(T!['('])); |
147 | let m = p.start(); | 147 | let m = p.start(); |
148 | if !p.expect(T!['(']) { | 148 | if !p.expect(T!['(']) { |
@@ -159,7 +159,7 @@ fn tuple_field_def_list(p: &mut Parser) { | |||
159 | // enum S { | 159 | // enum S { |
160 | // Uri(#[serde(with = "url_serde")] Uri), | 160 | // Uri(#[serde(with = "url_serde")] Uri), |
161 | // } | 161 | // } |
162 | attributes::outer_attributes(p); | 162 | attributes::outer_attrs(p); |
163 | opt_visibility(p); | 163 | opt_visibility(p); |
164 | if !p.at_ts(types::TYPE_FIRST) { | 164 | if !p.at_ts(types::TYPE_FIRST) { |
165 | p.error("expected a type"); | 165 | p.error("expected a type"); |