diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-23 15:01:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-23 15:01:06 +0100 |
commit | a832a2f7dd22c93bc69a7be5d24799bb042b8129 (patch) | |
tree | 15f55b3eab48c3d0bbb1975fbd4db7cbb56d3e3e /crates/ra_parser/src/grammar/items/nominal.rs | |
parent | c12dce0073c1766f7d2b10a69f8526a8093e70dc (diff) | |
parent | 5b18a4eef9e69260ce2f105b33553c929cb7d827 (diff) |
Merge #1731
1731: rename pos_field -> tuple_field r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/grammar/items/nominal.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/items/nominal.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_parser/src/grammar/items/nominal.rs b/crates/ra_parser/src/grammar/items/nominal.rs index bd4edab89..54f02c7c9 100644 --- a/crates/ra_parser/src/grammar/items/nominal.rs +++ b/crates/ra_parser/src/grammar/items/nominal.rs | |||
@@ -13,7 +13,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
13 | T![;] => { | 13 | T![;] => { |
14 | p.bump(); | 14 | p.bump(); |
15 | } | 15 | } |
16 | T!['{'] => named_field_def_list(p), | 16 | T!['{'] => record_field_def_list(p), |
17 | _ => { | 17 | _ => { |
18 | //FIXME: special case `(` error message | 18 | //FIXME: special case `(` error message |
19 | p.error("expected `;` or `{`"); | 19 | p.error("expected `;` or `{`"); |
@@ -23,9 +23,9 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
23 | T![;] if kind == T![struct] => { | 23 | T![;] if kind == T![struct] => { |
24 | p.bump(); | 24 | p.bump(); |
25 | } | 25 | } |
26 | T!['{'] => named_field_def_list(p), | 26 | T!['{'] => record_field_def_list(p), |
27 | T!['('] if kind == T![struct] => { | 27 | T!['('] if kind == T![struct] => { |
28 | pos_field_def_list(p); | 28 | tuple_field_def_list(p); |
29 | // test tuple_struct_where | 29 | // test tuple_struct_where |
30 | // struct Test<T>(T) where T: Clone; | 30 | // struct Test<T>(T) where T: Clone; |
31 | // struct Test<T>(T); | 31 | // struct Test<T>(T); |
@@ -70,8 +70,8 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
70 | if p.at(IDENT) { | 70 | if p.at(IDENT) { |
71 | name(p); | 71 | name(p); |
72 | match p.current() { | 72 | match p.current() { |
73 | T!['{'] => named_field_def_list(p), | 73 | T!['{'] => record_field_def_list(p), |
74 | T!['('] => pos_field_def_list(p), | 74 | T!['('] => tuple_field_def_list(p), |
75 | T![=] => { | 75 | T![=] => { |
76 | p.bump(); | 76 | p.bump(); |
77 | expressions::expr(p); | 77 | expressions::expr(p); |
@@ -91,7 +91,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
91 | m.complete(p, ENUM_VARIANT_LIST); | 91 | m.complete(p, ENUM_VARIANT_LIST); |
92 | } | 92 | } |
93 | 93 | ||
94 | pub(crate) fn named_field_def_list(p: &mut Parser) { | 94 | pub(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(); |
@@ -100,17 +100,17 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { | |||
100 | error_block(p, "expected field"); | 100 | error_block(p, "expected field"); |
101 | continue; | 101 | continue; |
102 | } | 102 | } |
103 | named_field_def(p); | 103 | record_field_def(p); |
104 | if !p.at(T!['}']) { | 104 | if !p.at(T!['}']) { |
105 | p.expect(T![,]); | 105 | p.expect(T![,]); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | p.expect(T!['}']); | 108 | p.expect(T!['}']); |
109 | m.complete(p, NAMED_FIELD_DEF_LIST); | 109 | m.complete(p, RECORD_FIELD_DEF_LIST); |
110 | 110 | ||
111 | fn named_field_def(p: &mut Parser) { | 111 | fn record_field_def(p: &mut Parser) { |
112 | let m = p.start(); | 112 | let m = p.start(); |
113 | // test field_attrs | 113 | // test record_field_attrs |
114 | // struct S { | 114 | // struct S { |
115 | // #[serde(with = "url_serde")] | 115 | // #[serde(with = "url_serde")] |
116 | // pub uri: Uri, | 116 | // pub uri: Uri, |
@@ -121,7 +121,7 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { | |||
121 | name(p); | 121 | name(p); |
122 | p.expect(T![:]); | 122 | p.expect(T![:]); |
123 | types::type_(p); | 123 | types::type_(p); |
124 | m.complete(p, NAMED_FIELD_DEF); | 124 | m.complete(p, RECORD_FIELD_DEF); |
125 | } else { | 125 | } else { |
126 | m.abandon(p); | 126 | m.abandon(p); |
127 | p.err_and_bump("expected field declaration"); | 127 | p.err_and_bump("expected field declaration"); |
@@ -129,7 +129,7 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { | |||
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | fn pos_field_def_list(p: &mut Parser) { | 132 | fn tuple_field_def_list(p: &mut Parser) { |
133 | assert!(p.at(T!['('])); | 133 | assert!(p.at(T!['('])); |
134 | let m = p.start(); | 134 | let m = p.start(); |
135 | if !p.expect(T!['(']) { | 135 | if !p.expect(T!['(']) { |
@@ -137,7 +137,7 @@ fn pos_field_def_list(p: &mut Parser) { | |||
137 | } | 137 | } |
138 | while !p.at(T![')']) && !p.at(EOF) { | 138 | while !p.at(T![')']) && !p.at(EOF) { |
139 | let m = p.start(); | 139 | let m = p.start(); |
140 | // test pos_field_attrs | 140 | // test tuple_field_attrs |
141 | // struct S ( | 141 | // struct S ( |
142 | // #[serde(with = "url_serde")] | 142 | // #[serde(with = "url_serde")] |
143 | // pub Uri, | 143 | // pub Uri, |
@@ -154,12 +154,12 @@ fn pos_field_def_list(p: &mut Parser) { | |||
154 | break; | 154 | break; |
155 | } | 155 | } |
156 | types::type_(p); | 156 | types::type_(p); |
157 | m.complete(p, POS_FIELD_DEF); | 157 | m.complete(p, TUPLE_FIELD_DEF); |
158 | 158 | ||
159 | if !p.at(T![')']) { | 159 | if !p.at(T![')']) { |
160 | p.expect(T![,]); | 160 | p.expect(T![,]); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | p.expect(T![')']); | 163 | p.expect(T![')']); |
164 | m.complete(p, POS_FIELD_DEF_LIST); | 164 | m.complete(p, TUPLE_FIELD_DEF_LIST); |
165 | } | 165 | } |