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/patterns.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/patterns.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/patterns.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 1f6a6fd48..8979aa499 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -127,8 +127,8 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { | |||
127 | TUPLE_STRUCT_PAT | 127 | TUPLE_STRUCT_PAT |
128 | } | 128 | } |
129 | T!['{'] => { | 129 | T!['{'] => { |
130 | field_pat_list(p); | 130 | record_field_pat_list(p); |
131 | STRUCT_PAT | 131 | RECORD_PAT |
132 | } | 132 | } |
133 | _ => PATH_PAT, | 133 | _ => PATH_PAT, |
134 | }; | 134 | }; |
@@ -149,21 +149,21 @@ fn tuple_pat_fields(p: &mut Parser) { | |||
149 | p.expect(T![')']); | 149 | p.expect(T![')']); |
150 | } | 150 | } |
151 | 151 | ||
152 | // test field_pat_list | 152 | // test record_field_pat_list |
153 | // fn foo() { | 153 | // fn foo() { |
154 | // let S {} = (); | 154 | // let S {} = (); |
155 | // let S { f, ref mut g } = (); | 155 | // let S { f, ref mut g } = (); |
156 | // let S { h: _, ..} = (); | 156 | // let S { h: _, ..} = (); |
157 | // let S { h: _, } = (); | 157 | // let S { h: _, } = (); |
158 | // } | 158 | // } |
159 | fn field_pat_list(p: &mut Parser) { | 159 | fn record_field_pat_list(p: &mut Parser) { |
160 | assert!(p.at(T!['{'])); | 160 | assert!(p.at(T!['{'])); |
161 | let m = p.start(); | 161 | let m = p.start(); |
162 | p.bump(); | 162 | p.bump(); |
163 | while !p.at(EOF) && !p.at(T!['}']) { | 163 | while !p.at(EOF) && !p.at(T!['}']) { |
164 | match p.current() { | 164 | match p.current() { |
165 | T![..] => p.bump(), | 165 | T![..] => p.bump(), |
166 | IDENT if p.nth(1) == T![:] => field_pat(p), | 166 | IDENT if p.nth(1) == T![:] => record_field_pat(p), |
167 | T!['{'] => error_block(p, "expected ident"), | 167 | T!['{'] => error_block(p, "expected ident"), |
168 | _ => { | 168 | _ => { |
169 | bind_pat(p, false); | 169 | bind_pat(p, false); |
@@ -174,10 +174,10 @@ fn field_pat_list(p: &mut Parser) { | |||
174 | } | 174 | } |
175 | } | 175 | } |
176 | p.expect(T!['}']); | 176 | p.expect(T!['}']); |
177 | m.complete(p, FIELD_PAT_LIST); | 177 | m.complete(p, RECORD_FIELD_PAT_LIST); |
178 | } | 178 | } |
179 | 179 | ||
180 | fn field_pat(p: &mut Parser) { | 180 | fn record_field_pat(p: &mut Parser) { |
181 | assert!(p.at(IDENT)); | 181 | assert!(p.at(IDENT)); |
182 | assert!(p.nth(1) == T![:]); | 182 | assert!(p.nth(1) == T![:]); |
183 | 183 | ||
@@ -185,7 +185,7 @@ fn field_pat(p: &mut Parser) { | |||
185 | name(p); | 185 | name(p); |
186 | p.bump(); | 186 | p.bump(); |
187 | pattern(p); | 187 | pattern(p); |
188 | m.complete(p, FIELD_PAT); | 188 | m.complete(p, RECORD_FIELD_PAT); |
189 | } | 189 | } |
190 | 190 | ||
191 | // test placeholder_pat | 191 | // test placeholder_pat |