diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-09 23:06:25 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-09 23:06:25 +0100 |
commit | e2ebb467bdf3ebb7d29260adb95c56594c6db282 (patch) | |
tree | e0c25226d8a13b3ff2a13d1100315e8455ea98bd /crates/ra_parser/src/grammar/patterns.rs | |
parent | c3d96f64ef1b2a5ded9cf5950f8e0f5798de4e1b (diff) | |
parent | d8aa9a1d81529cdc39e8353f2915c3c4d04ac263 (diff) |
Merge #1803
1803: introduce bump as a better-checked alternative to bump_any 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 | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 32cde7de6..d2f4296f8 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -36,7 +36,7 @@ pub(super) fn pattern_r(p: &mut Parser, recovery_set: TokenSet) { | |||
36 | // } | 36 | // } |
37 | if p.at(T![...]) || p.at(T![..=]) || p.at(T![..]) { | 37 | if p.at(T![...]) || p.at(T![..=]) || p.at(T![..]) { |
38 | let m = lhs.precede(p); | 38 | let m = lhs.precede(p); |
39 | p.bump(); | 39 | p.bump_any(); |
40 | atom_pat(p, recovery_set); | 40 | atom_pat(p, recovery_set); |
41 | m.complete(p, RANGE_PAT); | 41 | m.complete(p, RANGE_PAT); |
42 | } | 42 | } |
@@ -100,7 +100,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker { | |||
100 | assert!(is_literal_pat_start(p)); | 100 | assert!(is_literal_pat_start(p)); |
101 | let m = p.start(); | 101 | let m = p.start(); |
102 | if p.at(T![-]) { | 102 | if p.at(T![-]) { |
103 | p.bump(); | 103 | p.bump_any(); |
104 | } | 104 | } |
105 | expressions::literal(p); | 105 | expressions::literal(p); |
106 | m.complete(p, LITERAL_PAT) | 106 | m.complete(p, LITERAL_PAT) |
@@ -140,7 +140,7 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { | |||
140 | // } | 140 | // } |
141 | fn tuple_pat_fields(p: &mut Parser) { | 141 | fn tuple_pat_fields(p: &mut Parser) { |
142 | assert!(p.at(T!['('])); | 142 | assert!(p.at(T!['('])); |
143 | p.bump(); | 143 | p.bump_any(); |
144 | pat_list(p, T![')']); | 144 | pat_list(p, T![')']); |
145 | p.expect(T![')']); | 145 | p.expect(T![')']); |
146 | } | 146 | } |
@@ -155,10 +155,10 @@ fn tuple_pat_fields(p: &mut Parser) { | |||
155 | fn record_field_pat_list(p: &mut Parser) { | 155 | fn record_field_pat_list(p: &mut Parser) { |
156 | assert!(p.at(T!['{'])); | 156 | assert!(p.at(T!['{'])); |
157 | let m = p.start(); | 157 | let m = p.start(); |
158 | p.bump(); | 158 | p.bump_any(); |
159 | while !p.at(EOF) && !p.at(T!['}']) { | 159 | while !p.at(EOF) && !p.at(T!['}']) { |
160 | match p.current() { | 160 | match p.current() { |
161 | T![..] => p.bump(), | 161 | T![..] => p.bump_any(), |
162 | IDENT if p.nth(1) == T![:] => record_field_pat(p), | 162 | IDENT if p.nth(1) == T![:] => record_field_pat(p), |
163 | T!['{'] => error_block(p, "expected ident"), | 163 | T!['{'] => error_block(p, "expected ident"), |
164 | T![box] => { | 164 | T![box] => { |
@@ -182,7 +182,7 @@ fn record_field_pat(p: &mut Parser) { | |||
182 | 182 | ||
183 | let m = p.start(); | 183 | let m = p.start(); |
184 | name(p); | 184 | name(p); |
185 | p.bump(); | 185 | p.bump_any(); |
186 | pattern(p); | 186 | pattern(p); |
187 | m.complete(p, RECORD_FIELD_PAT); | 187 | m.complete(p, RECORD_FIELD_PAT); |
188 | } | 188 | } |
@@ -192,7 +192,7 @@ fn record_field_pat(p: &mut Parser) { | |||
192 | fn placeholder_pat(p: &mut Parser) -> CompletedMarker { | 192 | fn placeholder_pat(p: &mut Parser) -> CompletedMarker { |
193 | assert!(p.at(T![_])); | 193 | assert!(p.at(T![_])); |
194 | let m = p.start(); | 194 | let m = p.start(); |
195 | p.bump(); | 195 | p.bump_any(); |
196 | m.complete(p, PLACEHOLDER_PAT) | 196 | m.complete(p, PLACEHOLDER_PAT) |
197 | } | 197 | } |
198 | 198 | ||
@@ -204,7 +204,7 @@ fn placeholder_pat(p: &mut Parser) -> CompletedMarker { | |||
204 | fn ref_pat(p: &mut Parser) -> CompletedMarker { | 204 | fn ref_pat(p: &mut Parser) -> CompletedMarker { |
205 | assert!(p.at(T![&])); | 205 | assert!(p.at(T![&])); |
206 | let m = p.start(); | 206 | let m = p.start(); |
207 | p.bump(); | 207 | p.bump_any(); |
208 | p.eat(T![mut]); | 208 | p.eat(T![mut]); |
209 | pattern(p); | 209 | pattern(p); |
210 | m.complete(p, REF_PAT) | 210 | m.complete(p, REF_PAT) |
@@ -228,7 +228,7 @@ fn tuple_pat(p: &mut Parser) -> CompletedMarker { | |||
228 | fn slice_pat(p: &mut Parser) -> CompletedMarker { | 228 | fn slice_pat(p: &mut Parser) -> CompletedMarker { |
229 | assert!(p.at(T!['['])); | 229 | assert!(p.at(T!['['])); |
230 | let m = p.start(); | 230 | let m = p.start(); |
231 | p.bump(); | 231 | p.bump_any(); |
232 | pat_list(p, T![']']); | 232 | pat_list(p, T![']']); |
233 | p.expect(T![']']); | 233 | p.expect(T![']']); |
234 | m.complete(p, SLICE_PAT) | 234 | m.complete(p, SLICE_PAT) |
@@ -237,7 +237,7 @@ fn slice_pat(p: &mut Parser) -> CompletedMarker { | |||
237 | fn pat_list(p: &mut Parser, ket: SyntaxKind) { | 237 | fn pat_list(p: &mut Parser, ket: SyntaxKind) { |
238 | while !p.at(EOF) && !p.at(ket) { | 238 | while !p.at(EOF) && !p.at(ket) { |
239 | match p.current() { | 239 | match p.current() { |
240 | T![..] => p.bump(), | 240 | T![..] => p.bump_any(), |
241 | _ => { | 241 | _ => { |
242 | if !p.at_ts(PATTERN_FIRST) { | 242 | if !p.at_ts(PATTERN_FIRST) { |
243 | p.error("expected a pattern"); | 243 | p.error("expected a pattern"); |
@@ -281,7 +281,7 @@ fn bind_pat(p: &mut Parser, with_at: bool) -> CompletedMarker { | |||
281 | fn box_pat(p: &mut Parser) -> CompletedMarker { | 281 | fn box_pat(p: &mut Parser) -> CompletedMarker { |
282 | assert!(p.at(T![box])); | 282 | assert!(p.at(T![box])); |
283 | let m = p.start(); | 283 | let m = p.start(); |
284 | p.bump(); | 284 | p.bump_any(); |
285 | pattern(p); | 285 | pattern(p); |
286 | m.complete(p, BOX_PAT) | 286 | m.complete(p, BOX_PAT) |
287 | } | 287 | } |