diff options
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r-- | crates/ra_parser/src/grammar/attributes.rs | 4 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 20 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 32 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items.rs | 18 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/consts.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/nominal.rs | 12 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/traits.rs | 8 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/use_item.rs | 6 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/params.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/patterns.rs | 14 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/type_args.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/type_params.rs | 18 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/types.rs | 22 |
13 files changed, 80 insertions, 80 deletions
diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/ra_parser/src/grammar/attributes.rs index 81a363a57..1cfd301b5 100644 --- a/crates/ra_parser/src/grammar/attributes.rs +++ b/crates/ra_parser/src/grammar/attributes.rs | |||
@@ -15,11 +15,11 @@ pub(super) fn outer_attributes(p: &mut Parser) { | |||
15 | fn attribute(p: &mut Parser, inner: bool) { | 15 | fn attribute(p: &mut Parser, inner: bool) { |
16 | let attr = p.start(); | 16 | let attr = p.start(); |
17 | assert!(p.at(T![#])); | 17 | assert!(p.at(T![#])); |
18 | p.bump_any(); | 18 | p.bump(T![#]); |
19 | 19 | ||
20 | if inner { | 20 | if inner { |
21 | assert!(p.at(T![!])); | 21 | assert!(p.at(T![!])); |
22 | p.bump_any(); | 22 | p.bump(T![!]); |
23 | } | 23 | } |
24 | 24 | ||
25 | if p.at(T!['[']) { | 25 | if p.at(T!['[']) { |
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 1dd9a586c..80b085280 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -43,7 +43,7 @@ pub(crate) fn block(p: &mut Parser) { | |||
43 | pub(crate) fn naked_block(p: &mut Parser) { | 43 | pub(crate) fn naked_block(p: &mut Parser) { |
44 | assert!(p.at(T!['{'])); | 44 | assert!(p.at(T!['{'])); |
45 | let m = p.start(); | 45 | let m = p.start(); |
46 | p.bump_any(); | 46 | p.bump(T!['{']); |
47 | expr_block_contents(p); | 47 | expr_block_contents(p); |
48 | p.expect(T!['}']); | 48 | p.expect(T!['}']); |
49 | m.complete(p, BLOCK); | 49 | m.complete(p, BLOCK); |
@@ -150,7 +150,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) { | |||
150 | // } | 150 | // } |
151 | fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) { | 151 | fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) { |
152 | assert!(p.at(T![let])); | 152 | assert!(p.at(T![let])); |
153 | p.bump_any(); | 153 | p.bump(T![let]); |
154 | patterns::pattern(p); | 154 | patterns::pattern(p); |
155 | if p.at(T![:]) { | 155 | if p.at(T![:]) { |
156 | types::ascription(p); | 156 | types::ascription(p); |
@@ -195,7 +195,7 @@ pub(crate) fn expr_block_contents(p: &mut Parser) { | |||
195 | // } | 195 | // } |
196 | 196 | ||
197 | if p.at(T![;]) { | 197 | if p.at(T![;]) { |
198 | p.bump_any(); | 198 | p.bump(T![;]); |
199 | continue; | 199 | continue; |
200 | } | 200 | } |
201 | 201 | ||
@@ -297,7 +297,7 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> | |||
297 | // } | 297 | // } |
298 | T![&] => { | 298 | T![&] => { |
299 | m = p.start(); | 299 | m = p.start(); |
300 | p.bump_any(); | 300 | p.bump(T![&]); |
301 | p.eat(T![mut]); | 301 | p.eat(T![mut]); |
302 | REF_EXPR | 302 | REF_EXPR |
303 | } | 303 | } |
@@ -438,7 +438,7 @@ fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
438 | fn index_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 438 | fn index_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
439 | assert!(p.at(T!['['])); | 439 | assert!(p.at(T!['['])); |
440 | let m = lhs.precede(p); | 440 | let m = lhs.precede(p); |
441 | p.bump_any(); | 441 | p.bump(T!['[']); |
442 | expr(p); | 442 | expr(p); |
443 | p.expect(T![']']); | 443 | p.expect(T![']']); |
444 | m.complete(p, INDEX_EXPR) | 444 | m.complete(p, INDEX_EXPR) |
@@ -478,7 +478,7 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
478 | fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 478 | fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
479 | assert!(p.at(T![.])); | 479 | assert!(p.at(T![.])); |
480 | let m = lhs.precede(p); | 480 | let m = lhs.precede(p); |
481 | p.bump_any(); | 481 | p.bump(T![.]); |
482 | if p.at(IDENT) || p.at(INT_NUMBER) { | 482 | if p.at(IDENT) || p.at(INT_NUMBER) { |
483 | name_ref_or_index(p) | 483 | name_ref_or_index(p) |
484 | } else if p.at(FLOAT_NUMBER) { | 484 | } else if p.at(FLOAT_NUMBER) { |
@@ -497,7 +497,7 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
497 | fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 497 | fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
498 | assert!(p.at(T![?])); | 498 | assert!(p.at(T![?])); |
499 | let m = lhs.precede(p); | 499 | let m = lhs.precede(p); |
500 | p.bump_any(); | 500 | p.bump(T![?]); |
501 | m.complete(p, TRY_EXPR) | 501 | m.complete(p, TRY_EXPR) |
502 | } | 502 | } |
503 | 503 | ||
@@ -511,7 +511,7 @@ fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
511 | fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 511 | fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
512 | assert!(p.at(T![as])); | 512 | assert!(p.at(T![as])); |
513 | let m = lhs.precede(p); | 513 | let m = lhs.precede(p); |
514 | p.bump_any(); | 514 | p.bump(T![as]); |
515 | // Use type_no_bounds(), because cast expressions are not | 515 | // Use type_no_bounds(), because cast expressions are not |
516 | // allowed to have bounds. | 516 | // allowed to have bounds. |
517 | types::type_no_bounds(p); | 517 | types::type_no_bounds(p); |
@@ -521,7 +521,7 @@ fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
521 | fn arg_list(p: &mut Parser) { | 521 | fn arg_list(p: &mut Parser) { |
522 | assert!(p.at(T!['('])); | 522 | assert!(p.at(T!['('])); |
523 | let m = p.start(); | 523 | let m = p.start(); |
524 | p.bump_any(); | 524 | p.bump(T!['(']); |
525 | while !p.at(T![')']) && !p.at(EOF) { | 525 | while !p.at(T![')']) && !p.at(EOF) { |
526 | if !p.at_ts(EXPR_FIRST) { | 526 | if !p.at_ts(EXPR_FIRST) { |
527 | p.error("expected expression"); | 527 | p.error("expected expression"); |
@@ -570,7 +570,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { | |||
570 | pub(crate) fn record_field_list(p: &mut Parser) { | 570 | pub(crate) fn record_field_list(p: &mut Parser) { |
571 | assert!(p.at(T!['{'])); | 571 | assert!(p.at(T!['{'])); |
572 | let m = p.start(); | 572 | let m = p.start(); |
573 | p.bump_any(); | 573 | p.bump(T!['{']); |
574 | while !p.at(EOF) && !p.at(T!['}']) { | 574 | while !p.at(EOF) && !p.at(T!['}']) { |
575 | match p.current() { | 575 | match p.current() { |
576 | // test record_literal_field_with_attr | 576 | // test record_literal_field_with_attr |
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 6e295fbf9..6c7fdc2cd 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -101,14 +101,14 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
101 | } | 101 | } |
102 | T![async] if la == T!['{'] || (la == T![move] && p.nth(2) == T!['{']) => { | 102 | T![async] if la == T!['{'] || (la == T![move] && p.nth(2) == T!['{']) => { |
103 | let m = p.start(); | 103 | let m = p.start(); |
104 | p.bump_any(); | 104 | p.bump(T![async]); |
105 | p.eat(T![move]); | 105 | p.eat(T![move]); |
106 | block_expr(p, Some(m)) | 106 | block_expr(p, Some(m)) |
107 | } | 107 | } |
108 | T![match] => match_expr(p), | 108 | T![match] => match_expr(p), |
109 | T![unsafe] if la == T!['{'] => { | 109 | T![unsafe] if la == T!['{'] => { |
110 | let m = p.start(); | 110 | let m = p.start(); |
111 | p.bump_any(); | 111 | p.bump(T![unsafe]); |
112 | block_expr(p, Some(m)) | 112 | block_expr(p, Some(m)) |
113 | } | 113 | } |
114 | T!['{'] => { | 114 | T!['{'] => { |
@@ -180,7 +180,7 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { | |||
180 | fn array_expr(p: &mut Parser) -> CompletedMarker { | 180 | fn array_expr(p: &mut Parser) -> CompletedMarker { |
181 | assert!(p.at(T!['['])); | 181 | assert!(p.at(T!['['])); |
182 | let m = p.start(); | 182 | let m = p.start(); |
183 | p.bump_any(); | 183 | p.bump(T!['[']); |
184 | if p.eat(T![']']) { | 184 | if p.eat(T![']']) { |
185 | return m.complete(p, ARRAY_EXPR); | 185 | return m.complete(p, ARRAY_EXPR); |
186 | } | 186 | } |
@@ -262,11 +262,11 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { | |||
262 | fn if_expr(p: &mut Parser) -> CompletedMarker { | 262 | fn if_expr(p: &mut Parser) -> CompletedMarker { |
263 | assert!(p.at(T![if])); | 263 | assert!(p.at(T![if])); |
264 | let m = p.start(); | 264 | let m = p.start(); |
265 | p.bump_any(); | 265 | p.bump(T![if]); |
266 | cond(p); | 266 | cond(p); |
267 | block(p); | 267 | block(p); |
268 | if p.at(T![else]) { | 268 | if p.at(T![else]) { |
269 | p.bump_any(); | 269 | p.bump(T![else]); |
270 | if p.at(T![if]) { | 270 | if p.at(T![if]) { |
271 | if_expr(p); | 271 | if_expr(p); |
272 | } else { | 272 | } else { |
@@ -285,7 +285,7 @@ fn if_expr(p: &mut Parser) -> CompletedMarker { | |||
285 | fn label(p: &mut Parser) { | 285 | fn label(p: &mut Parser) { |
286 | assert!(p.at(LIFETIME) && p.nth(1) == T![:]); | 286 | assert!(p.at(LIFETIME) && p.nth(1) == T![:]); |
287 | let m = p.start(); | 287 | let m = p.start(); |
288 | p.bump_any(); | 288 | p.bump(LIFETIME); |
289 | p.bump_any(); | 289 | p.bump_any(); |
290 | m.complete(p, LABEL); | 290 | m.complete(p, LABEL); |
291 | } | 291 | } |
@@ -297,7 +297,7 @@ fn label(p: &mut Parser) { | |||
297 | fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 297 | fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
298 | assert!(p.at(T![loop])); | 298 | assert!(p.at(T![loop])); |
299 | let m = m.unwrap_or_else(|| p.start()); | 299 | let m = m.unwrap_or_else(|| p.start()); |
300 | p.bump_any(); | 300 | p.bump(T![loop]); |
301 | block(p); | 301 | block(p); |
302 | m.complete(p, LOOP_EXPR) | 302 | m.complete(p, LOOP_EXPR) |
303 | } | 303 | } |
@@ -310,7 +310,7 @@ fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
310 | fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 310 | fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
311 | assert!(p.at(T![while])); | 311 | assert!(p.at(T![while])); |
312 | let m = m.unwrap_or_else(|| p.start()); | 312 | let m = m.unwrap_or_else(|| p.start()); |
313 | p.bump_any(); | 313 | p.bump(T![while]); |
314 | cond(p); | 314 | cond(p); |
315 | block(p); | 315 | block(p); |
316 | m.complete(p, WHILE_EXPR) | 316 | m.complete(p, WHILE_EXPR) |
@@ -323,7 +323,7 @@ fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
323 | fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 323 | fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
324 | assert!(p.at(T![for])); | 324 | assert!(p.at(T![for])); |
325 | let m = m.unwrap_or_else(|| p.start()); | 325 | let m = m.unwrap_or_else(|| p.start()); |
326 | p.bump_any(); | 326 | p.bump(T![for]); |
327 | patterns::pattern(p); | 327 | patterns::pattern(p); |
328 | p.expect(T![in]); | 328 | p.expect(T![in]); |
329 | expr_no_struct(p); | 329 | expr_no_struct(p); |
@@ -357,7 +357,7 @@ fn cond(p: &mut Parser) { | |||
357 | fn match_expr(p: &mut Parser) -> CompletedMarker { | 357 | fn match_expr(p: &mut Parser) -> CompletedMarker { |
358 | assert!(p.at(T![match])); | 358 | assert!(p.at(T![match])); |
359 | let m = p.start(); | 359 | let m = p.start(); |
360 | p.bump_any(); | 360 | p.bump(T![match]); |
361 | expr_no_struct(p); | 361 | expr_no_struct(p); |
362 | if p.at(T!['{']) { | 362 | if p.at(T!['{']) { |
363 | match_arm_list(p); | 363 | match_arm_list(p); |
@@ -453,7 +453,7 @@ fn match_arm(p: &mut Parser) -> BlockLike { | |||
453 | fn match_guard(p: &mut Parser) -> CompletedMarker { | 453 | fn match_guard(p: &mut Parser) -> CompletedMarker { |
454 | assert!(p.at(T![if])); | 454 | assert!(p.at(T![if])); |
455 | let m = p.start(); | 455 | let m = p.start(); |
456 | p.bump_any(); | 456 | p.bump(T![if]); |
457 | expr(p); | 457 | expr(p); |
458 | m.complete(p, MATCH_GUARD) | 458 | m.complete(p, MATCH_GUARD) |
459 | } | 459 | } |
@@ -479,7 +479,7 @@ pub(super) fn block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
479 | fn return_expr(p: &mut Parser) -> CompletedMarker { | 479 | fn return_expr(p: &mut Parser) -> CompletedMarker { |
480 | assert!(p.at(T![return])); | 480 | assert!(p.at(T![return])); |
481 | let m = p.start(); | 481 | let m = p.start(); |
482 | p.bump_any(); | 482 | p.bump(T![return]); |
483 | if p.at_ts(EXPR_FIRST) { | 483 | if p.at_ts(EXPR_FIRST) { |
484 | expr(p); | 484 | expr(p); |
485 | } | 485 | } |
@@ -496,7 +496,7 @@ fn return_expr(p: &mut Parser) -> CompletedMarker { | |||
496 | fn continue_expr(p: &mut Parser) -> CompletedMarker { | 496 | fn continue_expr(p: &mut Parser) -> CompletedMarker { |
497 | assert!(p.at(T![continue])); | 497 | assert!(p.at(T![continue])); |
498 | let m = p.start(); | 498 | let m = p.start(); |
499 | p.bump_any(); | 499 | p.bump(T![continue]); |
500 | p.eat(LIFETIME); | 500 | p.eat(LIFETIME); |
501 | m.complete(p, CONTINUE_EXPR) | 501 | m.complete(p, CONTINUE_EXPR) |
502 | } | 502 | } |
@@ -513,7 +513,7 @@ fn continue_expr(p: &mut Parser) -> CompletedMarker { | |||
513 | fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { | 513 | fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { |
514 | assert!(p.at(T![break])); | 514 | assert!(p.at(T![break])); |
515 | let m = p.start(); | 515 | let m = p.start(); |
516 | p.bump_any(); | 516 | p.bump(T![break]); |
517 | p.eat(LIFETIME); | 517 | p.eat(LIFETIME); |
518 | // test break_ambiguity | 518 | // test break_ambiguity |
519 | // fn foo(){ | 519 | // fn foo(){ |
@@ -535,7 +535,7 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { | |||
535 | fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 535 | fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
536 | assert!(p.at(T![try])); | 536 | assert!(p.at(T![try])); |
537 | let m = m.unwrap_or_else(|| p.start()); | 537 | let m = m.unwrap_or_else(|| p.start()); |
538 | p.bump_any(); | 538 | p.bump(T![try]); |
539 | block(p); | 539 | block(p); |
540 | m.complete(p, TRY_EXPR) | 540 | m.complete(p, TRY_EXPR) |
541 | } | 541 | } |
@@ -549,7 +549,7 @@ fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
549 | fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 549 | fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
550 | assert!(p.at(T![box])); | 550 | assert!(p.at(T![box])); |
551 | let m = m.unwrap_or_else(|| p.start()); | 551 | let m = m.unwrap_or_else(|| p.start()); |
552 | p.bump_any(); | 552 | p.bump(T![box]); |
553 | if p.at_ts(EXPR_FIRST) { | 553 | if p.at_ts(EXPR_FIRST) { |
554 | expr(p); | 554 | expr(p); |
555 | } | 555 | } |
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 4dd80d443..4c67a5c2e 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -64,7 +64,7 @@ pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemF | |||
64 | } else if p.at(T!['}']) && !stop_on_r_curly { | 64 | } else if p.at(T!['}']) && !stop_on_r_curly { |
65 | let e = p.start(); | 65 | let e = p.start(); |
66 | p.error("unmatched `}`"); | 66 | p.error("unmatched `}`"); |
67 | p.bump_any(); | 67 | p.bump(T!['}']); |
68 | e.complete(p, ERROR); | 68 | e.complete(p, ERROR); |
69 | } else if !p.at(EOF) && !p.at(T!['}']) { | 69 | } else if !p.at(EOF) && !p.at(T!['}']) { |
70 | p.err_and_bump("expected an item"); | 70 | p.err_and_bump("expected an item"); |
@@ -276,9 +276,9 @@ fn items_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> { | |||
276 | 276 | ||
277 | fn extern_crate_item(p: &mut Parser, m: Marker) { | 277 | fn extern_crate_item(p: &mut Parser, m: Marker) { |
278 | assert!(p.at(T![extern])); | 278 | assert!(p.at(T![extern])); |
279 | p.bump_any(); | 279 | p.bump(T![extern]); |
280 | assert!(p.at(T![crate])); | 280 | assert!(p.at(T![crate])); |
281 | p.bump_any(); | 281 | p.bump(T![crate]); |
282 | name_ref(p); | 282 | name_ref(p); |
283 | opt_alias(p); | 283 | opt_alias(p); |
284 | p.expect(T![;]); | 284 | p.expect(T![;]); |
@@ -288,7 +288,7 @@ fn extern_crate_item(p: &mut Parser, m: Marker) { | |||
288 | pub(crate) fn extern_item_list(p: &mut Parser) { | 288 | pub(crate) fn extern_item_list(p: &mut Parser) { |
289 | assert!(p.at(T!['{'])); | 289 | assert!(p.at(T!['{'])); |
290 | let m = p.start(); | 290 | let m = p.start(); |
291 | p.bump_any(); | 291 | p.bump(T!['{']); |
292 | mod_contents(p, true); | 292 | mod_contents(p, true); |
293 | p.expect(T!['}']); | 293 | p.expect(T!['}']); |
294 | m.complete(p, EXTERN_ITEM_LIST); | 294 | m.complete(p, EXTERN_ITEM_LIST); |
@@ -296,7 +296,7 @@ pub(crate) fn extern_item_list(p: &mut Parser) { | |||
296 | 296 | ||
297 | fn fn_def(p: &mut Parser, flavor: ItemFlavor) { | 297 | fn fn_def(p: &mut Parser, flavor: ItemFlavor) { |
298 | assert!(p.at(T![fn])); | 298 | assert!(p.at(T![fn])); |
299 | p.bump_any(); | 299 | p.bump(T![fn]); |
300 | 300 | ||
301 | name_r(p, ITEM_RECOVERY_SET); | 301 | name_r(p, ITEM_RECOVERY_SET); |
302 | // test function_type_params | 302 | // test function_type_params |
@@ -323,7 +323,7 @@ fn fn_def(p: &mut Parser, flavor: ItemFlavor) { | |||
323 | // test fn_decl | 323 | // test fn_decl |
324 | // trait T { fn foo(); } | 324 | // trait T { fn foo(); } |
325 | if p.at(T![;]) { | 325 | if p.at(T![;]) { |
326 | p.bump_any(); | 326 | p.bump(T![;]); |
327 | } else { | 327 | } else { |
328 | expressions::block(p) | 328 | expressions::block(p) |
329 | } | 329 | } |
@@ -333,7 +333,7 @@ fn fn_def(p: &mut Parser, flavor: ItemFlavor) { | |||
333 | // type Foo = Bar; | 333 | // type Foo = Bar; |
334 | fn type_def(p: &mut Parser, m: Marker) { | 334 | fn type_def(p: &mut Parser, m: Marker) { |
335 | assert!(p.at(T![type])); | 335 | assert!(p.at(T![type])); |
336 | p.bump_any(); | 336 | p.bump(T![type]); |
337 | 337 | ||
338 | name(p); | 338 | name(p); |
339 | 339 | ||
@@ -357,7 +357,7 @@ fn type_def(p: &mut Parser, m: Marker) { | |||
357 | 357 | ||
358 | pub(crate) fn mod_item(p: &mut Parser, m: Marker) { | 358 | pub(crate) fn mod_item(p: &mut Parser, m: Marker) { |
359 | assert!(p.at(T![mod])); | 359 | assert!(p.at(T![mod])); |
360 | p.bump_any(); | 360 | p.bump(T![mod]); |
361 | 361 | ||
362 | name(p); | 362 | name(p); |
363 | if p.at(T!['{']) { | 363 | if p.at(T!['{']) { |
@@ -371,7 +371,7 @@ pub(crate) fn mod_item(p: &mut Parser, m: Marker) { | |||
371 | pub(crate) fn mod_item_list(p: &mut Parser) { | 371 | pub(crate) fn mod_item_list(p: &mut Parser) { |
372 | assert!(p.at(T!['{'])); | 372 | assert!(p.at(T!['{'])); |
373 | let m = p.start(); | 373 | let m = p.start(); |
374 | p.bump_any(); | 374 | p.bump(T!['{']); |
375 | mod_contents(p, true); | 375 | mod_contents(p, true); |
376 | p.expect(T!['}']); | 376 | p.expect(T!['}']); |
377 | m.complete(p, ITEM_LIST); | 377 | m.complete(p, ITEM_LIST); |
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs index 63e0e6e0c..310260689 100644 --- a/crates/ra_parser/src/grammar/items/consts.rs +++ b/crates/ra_parser/src/grammar/items/consts.rs | |||
@@ -10,7 +10,7 @@ pub(super) fn const_def(p: &mut Parser, m: Marker) { | |||
10 | 10 | ||
11 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | 11 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { |
12 | assert!(p.at(kw)); | 12 | assert!(p.at(kw)); |
13 | p.bump_any(); | 13 | p.bump(kw); |
14 | p.eat(T![mut]); // FIXME: validator to forbid const mut | 14 | p.eat(T![mut]); // FIXME: validator to forbid const mut |
15 | 15 | ||
16 | // Allow `_` in place of an identifier in a `const`. | 16 | // Allow `_` in place of an identifier in a `const`. |
diff --git a/crates/ra_parser/src/grammar/items/nominal.rs b/crates/ra_parser/src/grammar/items/nominal.rs index 460acd65e..bede3b692 100644 --- a/crates/ra_parser/src/grammar/items/nominal.rs +++ b/crates/ra_parser/src/grammar/items/nominal.rs | |||
@@ -11,7 +11,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
11 | type_params::opt_where_clause(p); | 11 | type_params::opt_where_clause(p); |
12 | match p.current() { | 12 | match p.current() { |
13 | T![;] => { | 13 | T![;] => { |
14 | p.bump_any(); | 14 | p.bump(T![;]); |
15 | } | 15 | } |
16 | T!['{'] => record_field_def_list(p), | 16 | T!['{'] => record_field_def_list(p), |
17 | _ => { | 17 | _ => { |
@@ -21,7 +21,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
21 | } | 21 | } |
22 | } | 22 | } |
23 | T![;] if kind == T![struct] => { | 23 | T![;] if kind == T![struct] => { |
24 | p.bump_any(); | 24 | p.bump(T![;]); |
25 | } | 25 | } |
26 | T!['{'] => record_field_def_list(p), | 26 | T!['{'] => record_field_def_list(p), |
27 | T!['('] if kind == T![struct] => { | 27 | T!['('] if kind == T![struct] => { |
@@ -44,7 +44,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
44 | 44 | ||
45 | pub(super) fn enum_def(p: &mut Parser, m: Marker) { | 45 | pub(super) fn enum_def(p: &mut Parser, m: Marker) { |
46 | assert!(p.at(T![enum])); | 46 | assert!(p.at(T![enum])); |
47 | p.bump_any(); | 47 | p.bump(T![enum]); |
48 | name_r(p, ITEM_RECOVERY_SET); | 48 | name_r(p, ITEM_RECOVERY_SET); |
49 | type_params::opt_type_param_list(p); | 49 | type_params::opt_type_param_list(p); |
50 | type_params::opt_where_clause(p); | 50 | type_params::opt_where_clause(p); |
@@ -59,7 +59,7 @@ pub(super) fn enum_def(p: &mut Parser, m: Marker) { | |||
59 | pub(crate) fn enum_variant_list(p: &mut Parser) { | 59 | pub(crate) fn enum_variant_list(p: &mut Parser) { |
60 | assert!(p.at(T!['{'])); | 60 | assert!(p.at(T!['{'])); |
61 | let m = p.start(); | 61 | let m = p.start(); |
62 | p.bump_any(); | 62 | p.bump(T!['{']); |
63 | while !p.at(EOF) && !p.at(T!['}']) { | 63 | while !p.at(EOF) && !p.at(T!['}']) { |
64 | if p.at(T!['{']) { | 64 | if p.at(T!['{']) { |
65 | error_block(p, "expected enum variant"); | 65 | error_block(p, "expected enum variant"); |
@@ -73,7 +73,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
73 | T!['{'] => record_field_def_list(p), | 73 | T!['{'] => record_field_def_list(p), |
74 | T!['('] => tuple_field_def_list(p), | 74 | T!['('] => tuple_field_def_list(p), |
75 | T![=] => { | 75 | T![=] => { |
76 | p.bump_any(); | 76 | p.bump(T![=]); |
77 | expressions::expr(p); | 77 | expressions::expr(p); |
78 | } | 78 | } |
79 | _ => (), | 79 | _ => (), |
@@ -94,7 +94,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
94 | pub(crate) fn record_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_any(); | 97 | p.bump(T!['{']); |
98 | while !p.at(T!['}']) && !p.at(EOF) { | 98 | while !p.at(T!['}']) && !p.at(EOF) { |
99 | if p.at(T!['{']) { | 99 | if p.at(T!['{']) { |
100 | error_block(p, "expected field"); | 100 | error_block(p, "expected field"); |
diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs index b49221a4b..3742fd197 100644 --- a/crates/ra_parser/src/grammar/items/traits.rs +++ b/crates/ra_parser/src/grammar/items/traits.rs | |||
@@ -5,7 +5,7 @@ use super::*; | |||
5 | // trait X<U: Debug + Display>: Hash + Clone where U: Copy {} | 5 | // trait X<U: Debug + Display>: Hash + Clone where U: Copy {} |
6 | pub(super) fn trait_def(p: &mut Parser) { | 6 | pub(super) fn trait_def(p: &mut Parser) { |
7 | assert!(p.at(T![trait])); | 7 | assert!(p.at(T![trait])); |
8 | p.bump_any(); | 8 | p.bump(T![trait]); |
9 | name_r(p, ITEM_RECOVERY_SET); | 9 | name_r(p, ITEM_RECOVERY_SET); |
10 | type_params::opt_type_param_list(p); | 10 | type_params::opt_type_param_list(p); |
11 | if p.at(T![:]) { | 11 | if p.at(T![:]) { |
@@ -29,7 +29,7 @@ pub(super) fn trait_def(p: &mut Parser) { | |||
29 | pub(crate) fn trait_item_list(p: &mut Parser) { | 29 | pub(crate) fn trait_item_list(p: &mut Parser) { |
30 | assert!(p.at(T!['{'])); | 30 | assert!(p.at(T!['{'])); |
31 | let m = p.start(); | 31 | let m = p.start(); |
32 | p.bump_any(); | 32 | p.bump(T!['{']); |
33 | while !p.at(EOF) && !p.at(T!['}']) { | 33 | while !p.at(EOF) && !p.at(T!['}']) { |
34 | if p.at(T!['{']) { | 34 | if p.at(T!['{']) { |
35 | error_block(p, "expected an item"); | 35 | error_block(p, "expected an item"); |
@@ -45,7 +45,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) { | |||
45 | // impl Foo {} | 45 | // impl Foo {} |
46 | pub(super) fn impl_block(p: &mut Parser) { | 46 | pub(super) fn impl_block(p: &mut Parser) { |
47 | assert!(p.at(T![impl])); | 47 | assert!(p.at(T![impl])); |
48 | p.bump_any(); | 48 | p.bump(T![impl]); |
49 | if choose_type_params_over_qpath(p) { | 49 | if choose_type_params_over_qpath(p) { |
50 | type_params::opt_type_param_list(p); | 50 | type_params::opt_type_param_list(p); |
51 | } | 51 | } |
@@ -78,7 +78,7 @@ pub(super) fn impl_block(p: &mut Parser) { | |||
78 | pub(crate) fn impl_item_list(p: &mut Parser) { | 78 | pub(crate) fn impl_item_list(p: &mut Parser) { |
79 | assert!(p.at(T!['{'])); | 79 | assert!(p.at(T!['{'])); |
80 | let m = p.start(); | 80 | let m = p.start(); |
81 | p.bump_any(); | 81 | p.bump(T!['{']); |
82 | // test impl_inner_attributes | 82 | // test impl_inner_attributes |
83 | // enum F{} | 83 | // enum F{} |
84 | // impl F { | 84 | // impl F { |
diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/ra_parser/src/grammar/items/use_item.rs index f28f522b8..2af2ad315 100644 --- a/crates/ra_parser/src/grammar/items/use_item.rs +++ b/crates/ra_parser/src/grammar/items/use_item.rs | |||
@@ -2,7 +2,7 @@ use super::*; | |||
2 | 2 | ||
3 | pub(super) fn use_item(p: &mut Parser, m: Marker) { | 3 | pub(super) fn use_item(p: &mut Parser, m: Marker) { |
4 | assert!(p.at(T![use])); | 4 | assert!(p.at(T![use])); |
5 | p.bump_any(); | 5 | p.bump(T![use]); |
6 | use_tree(p); | 6 | use_tree(p); |
7 | p.expect(T![;]); | 7 | p.expect(T![;]); |
8 | m.complete(p, USE_ITEM); | 8 | m.complete(p, USE_ITEM); |
@@ -84,7 +84,7 @@ fn use_tree(p: &mut Parser) { | |||
84 | p.bump(T![::]); | 84 | p.bump(T![::]); |
85 | match p.current() { | 85 | match p.current() { |
86 | T![*] => { | 86 | T![*] => { |
87 | p.bump_any(); | 87 | p.bump(T![*]); |
88 | } | 88 | } |
89 | // test use_tree_list_after_path | 89 | // test use_tree_list_after_path |
90 | // use crate::{Item}; | 90 | // use crate::{Item}; |
@@ -114,7 +114,7 @@ fn use_tree(p: &mut Parser) { | |||
114 | pub(crate) fn use_tree_list(p: &mut Parser) { | 114 | pub(crate) fn use_tree_list(p: &mut Parser) { |
115 | assert!(p.at(T!['{'])); | 115 | assert!(p.at(T!['{'])); |
116 | let m = p.start(); | 116 | let m = p.start(); |
117 | p.bump_any(); | 117 | p.bump(T!['{']); |
118 | while !p.at(EOF) && !p.at(T!['}']) { | 118 | while !p.at(EOF) && !p.at(T!['}']) { |
119 | use_tree(p); | 119 | use_tree(p); |
120 | if !p.at(T!['}']) { | 120 | if !p.at(T!['}']) { |
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs index 5893b22fd..efc329243 100644 --- a/crates/ra_parser/src/grammar/params.rs +++ b/crates/ra_parser/src/grammar/params.rs | |||
@@ -39,7 +39,7 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
39 | let (bra, ket) = if flavor.type_required() { (T!['('], T![')']) } else { (T![|], T![|]) }; | 39 | let (bra, ket) = if flavor.type_required() { (T!['('], T![')']) } else { (T![|], T![|]) }; |
40 | assert!(p.at(bra)); | 40 | assert!(p.at(bra)); |
41 | let m = p.start(); | 41 | let m = p.start(); |
42 | p.bump_any(); | 42 | p.bump(bra); |
43 | if flavor.type_required() { | 43 | if flavor.type_required() { |
44 | // test self_param_outer_attr | 44 | // test self_param_outer_attr |
45 | // fn f(#[must_use] self) {} | 45 | // fn f(#[must_use] self) {} |
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 919b0f37d..a4ffd6960 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -106,7 +106,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker { | |||
106 | assert!(is_literal_pat_start(p)); | 106 | assert!(is_literal_pat_start(p)); |
107 | let m = p.start(); | 107 | let m = p.start(); |
108 | if p.at(T![-]) { | 108 | if p.at(T![-]) { |
109 | p.bump_any(); | 109 | p.bump(T![-]); |
110 | } | 110 | } |
111 | expressions::literal(p); | 111 | expressions::literal(p); |
112 | m.complete(p, LITERAL_PAT) | 112 | m.complete(p, LITERAL_PAT) |
@@ -146,7 +146,7 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { | |||
146 | // } | 146 | // } |
147 | fn tuple_pat_fields(p: &mut Parser) { | 147 | fn tuple_pat_fields(p: &mut Parser) { |
148 | assert!(p.at(T!['('])); | 148 | assert!(p.at(T!['('])); |
149 | p.bump_any(); | 149 | p.bump(T!['(']); |
150 | pat_list(p, T![')']); | 150 | pat_list(p, T![')']); |
151 | p.expect(T![')']); | 151 | p.expect(T![')']); |
152 | } | 152 | } |
@@ -161,7 +161,7 @@ fn tuple_pat_fields(p: &mut Parser) { | |||
161 | fn record_field_pat_list(p: &mut Parser) { | 161 | fn record_field_pat_list(p: &mut Parser) { |
162 | assert!(p.at(T!['{'])); | 162 | assert!(p.at(T!['{'])); |
163 | let m = p.start(); | 163 | let m = p.start(); |
164 | p.bump_any(); | 164 | p.bump(T!['{']); |
165 | while !p.at(EOF) && !p.at(T!['}']) { | 165 | while !p.at(EOF) && !p.at(T!['}']) { |
166 | match p.current() { | 166 | match p.current() { |
167 | // A trailing `..` is *not* treated as a DOT_DOT_PAT. | 167 | // A trailing `..` is *not* treated as a DOT_DOT_PAT. |
@@ -200,7 +200,7 @@ fn record_field_pat(p: &mut Parser) { | |||
200 | fn placeholder_pat(p: &mut Parser) -> CompletedMarker { | 200 | fn placeholder_pat(p: &mut Parser) -> CompletedMarker { |
201 | assert!(p.at(T![_])); | 201 | assert!(p.at(T![_])); |
202 | let m = p.start(); | 202 | let m = p.start(); |
203 | p.bump_any(); | 203 | p.bump(T![_]); |
204 | m.complete(p, PLACEHOLDER_PAT) | 204 | m.complete(p, PLACEHOLDER_PAT) |
205 | } | 205 | } |
206 | 206 | ||
@@ -245,7 +245,7 @@ fn dot_dot_pat(p: &mut Parser) -> CompletedMarker { | |||
245 | fn ref_pat(p: &mut Parser) -> CompletedMarker { | 245 | fn ref_pat(p: &mut Parser) -> CompletedMarker { |
246 | assert!(p.at(T![&])); | 246 | assert!(p.at(T![&])); |
247 | let m = p.start(); | 247 | let m = p.start(); |
248 | p.bump_any(); | 248 | p.bump(T![&]); |
249 | p.eat(T![mut]); | 249 | p.eat(T![mut]); |
250 | pattern(p); | 250 | pattern(p); |
251 | m.complete(p, REF_PAT) | 251 | m.complete(p, REF_PAT) |
@@ -269,7 +269,7 @@ fn tuple_pat(p: &mut Parser) -> CompletedMarker { | |||
269 | fn slice_pat(p: &mut Parser) -> CompletedMarker { | 269 | fn slice_pat(p: &mut Parser) -> CompletedMarker { |
270 | assert!(p.at(T!['['])); | 270 | assert!(p.at(T!['['])); |
271 | let m = p.start(); | 271 | let m = p.start(); |
272 | p.bump_any(); | 272 | p.bump(T!['[']); |
273 | pat_list(p, T![']']); | 273 | pat_list(p, T![']']); |
274 | p.expect(T![']']); | 274 | p.expect(T![']']); |
275 | m.complete(p, SLICE_PAT) | 275 | m.complete(p, SLICE_PAT) |
@@ -318,7 +318,7 @@ fn bind_pat(p: &mut Parser, with_at: bool) -> CompletedMarker { | |||
318 | fn box_pat(p: &mut Parser) -> CompletedMarker { | 318 | fn box_pat(p: &mut Parser) -> CompletedMarker { |
319 | assert!(p.at(T![box])); | 319 | assert!(p.at(T![box])); |
320 | let m = p.start(); | 320 | let m = p.start(); |
321 | p.bump_any(); | 321 | p.bump(T![box]); |
322 | pattern(p); | 322 | pattern(p); |
323 | m.complete(p, BOX_PAT) | 323 | m.complete(p, BOX_PAT) |
324 | } | 324 | } |
diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/ra_parser/src/grammar/type_args.rs index edc7d4ff2..8e97fe03c 100644 --- a/crates/ra_parser/src/grammar/type_args.rs +++ b/crates/ra_parser/src/grammar/type_args.rs | |||
@@ -29,7 +29,7 @@ fn type_arg(p: &mut Parser) { | |||
29 | let m = p.start(); | 29 | let m = p.start(); |
30 | match p.current() { | 30 | match p.current() { |
31 | LIFETIME => { | 31 | LIFETIME => { |
32 | p.bump_any(); | 32 | p.bump(LIFETIME); |
33 | m.complete(p, LIFETIME_ARG); | 33 | m.complete(p, LIFETIME_ARG); |
34 | } | 34 | } |
35 | // test associated_type_bounds | 35 | // test associated_type_bounds |
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs index 31d709d81..7071c70ea 100644 --- a/crates/ra_parser/src/grammar/type_params.rs +++ b/crates/ra_parser/src/grammar/type_params.rs | |||
@@ -10,7 +10,7 @@ pub(super) fn opt_type_param_list(p: &mut Parser) { | |||
10 | fn type_param_list(p: &mut Parser) { | 10 | fn type_param_list(p: &mut Parser) { |
11 | assert!(p.at(T![<])); | 11 | assert!(p.at(T![<])); |
12 | let m = p.start(); | 12 | let m = p.start(); |
13 | p.bump_any(); | 13 | p.bump(T![<]); |
14 | 14 | ||
15 | while !p.at(EOF) && !p.at(T![>]) { | 15 | while !p.at(EOF) && !p.at(T![>]) { |
16 | let m = p.start(); | 16 | let m = p.start(); |
@@ -38,7 +38,7 @@ fn type_param_list(p: &mut Parser) { | |||
38 | 38 | ||
39 | fn lifetime_param(p: &mut Parser, m: Marker) { | 39 | fn lifetime_param(p: &mut Parser, m: Marker) { |
40 | assert!(p.at(LIFETIME)); | 40 | assert!(p.at(LIFETIME)); |
41 | p.bump_any(); | 41 | p.bump(LIFETIME); |
42 | if p.at(T![:]) { | 42 | if p.at(T![:]) { |
43 | lifetime_bounds(p); | 43 | lifetime_bounds(p); |
44 | } | 44 | } |
@@ -54,7 +54,7 @@ fn type_param(p: &mut Parser, m: Marker) { | |||
54 | // test type_param_default | 54 | // test type_param_default |
55 | // struct S<T = i32>; | 55 | // struct S<T = i32>; |
56 | if p.at(T![=]) { | 56 | if p.at(T![=]) { |
57 | p.bump_any(); | 57 | p.bump(T![=]); |
58 | types::type_(p) | 58 | types::type_(p) |
59 | } | 59 | } |
60 | m.complete(p, TYPE_PARAM); | 60 | m.complete(p, TYPE_PARAM); |
@@ -64,15 +64,15 @@ fn type_param(p: &mut Parser, m: Marker) { | |||
64 | // struct S<T: 'a + ?Sized + (Copy)>; | 64 | // struct S<T: 'a + ?Sized + (Copy)>; |
65 | pub(super) fn bounds(p: &mut Parser) { | 65 | pub(super) fn bounds(p: &mut Parser) { |
66 | assert!(p.at(T![:])); | 66 | assert!(p.at(T![:])); |
67 | p.bump_any(); | 67 | p.bump(T![:]); |
68 | bounds_without_colon(p); | 68 | bounds_without_colon(p); |
69 | } | 69 | } |
70 | 70 | ||
71 | fn lifetime_bounds(p: &mut Parser) { | 71 | fn lifetime_bounds(p: &mut Parser) { |
72 | assert!(p.at(T![:])); | 72 | assert!(p.at(T![:])); |
73 | p.bump_any(); | 73 | p.bump(T![:]); |
74 | while p.at(LIFETIME) { | 74 | while p.at(LIFETIME) { |
75 | p.bump_any(); | 75 | p.bump(LIFETIME); |
76 | if !p.eat(T![+]) { | 76 | if !p.eat(T![+]) { |
77 | break; | 77 | break; |
78 | } | 78 | } |
@@ -99,7 +99,7 @@ fn type_bound(p: &mut Parser) -> bool { | |||
99 | let has_paren = p.eat(T!['(']); | 99 | let has_paren = p.eat(T!['(']); |
100 | p.eat(T![?]); | 100 | p.eat(T![?]); |
101 | match p.current() { | 101 | match p.current() { |
102 | LIFETIME => p.bump_any(), | 102 | LIFETIME => p.bump(LIFETIME), |
103 | T![for] => types::for_type(p), | 103 | T![for] => types::for_type(p), |
104 | _ if paths::is_use_path_start(p) => types::path_type_(p, false), | 104 | _ if paths::is_use_path_start(p) => types::path_type_(p, false), |
105 | _ => { | 105 | _ => { |
@@ -128,7 +128,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) { | |||
128 | return; | 128 | return; |
129 | } | 129 | } |
130 | let m = p.start(); | 130 | let m = p.start(); |
131 | p.bump_any(); | 131 | p.bump(T![where]); |
132 | 132 | ||
133 | while is_where_predicate(p) { | 133 | while is_where_predicate(p) { |
134 | where_predicate(p); | 134 | where_predicate(p); |
@@ -166,7 +166,7 @@ fn where_predicate(p: &mut Parser) { | |||
166 | let m = p.start(); | 166 | let m = p.start(); |
167 | match p.current() { | 167 | match p.current() { |
168 | LIFETIME => { | 168 | LIFETIME => { |
169 | p.bump_any(); | 169 | p.bump(LIFETIME); |
170 | if p.at(T![:]) { | 170 | if p.at(T![:]) { |
171 | bounds(p); | 171 | bounds(p); |
172 | } else { | 172 | } else { |
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 0eb28ef09..bd3829f41 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs | |||
@@ -44,7 +44,7 @@ pub(super) fn ascription(p: &mut Parser) { | |||
44 | fn paren_or_tuple_type(p: &mut Parser) { | 44 | fn paren_or_tuple_type(p: &mut Parser) { |
45 | assert!(p.at(T!['('])); | 45 | assert!(p.at(T!['('])); |
46 | let m = p.start(); | 46 | let m = p.start(); |
47 | p.bump_any(); | 47 | p.bump(T!['(']); |
48 | let mut n_types: u32 = 0; | 48 | let mut n_types: u32 = 0; |
49 | let mut trailing_comma: bool = false; | 49 | let mut trailing_comma: bool = false; |
50 | while !p.at(EOF) && !p.at(T![')']) { | 50 | while !p.at(EOF) && !p.at(T![')']) { |
@@ -79,14 +79,14 @@ fn paren_or_tuple_type(p: &mut Parser) { | |||
79 | fn never_type(p: &mut Parser) { | 79 | fn never_type(p: &mut Parser) { |
80 | assert!(p.at(T![!])); | 80 | assert!(p.at(T![!])); |
81 | let m = p.start(); | 81 | let m = p.start(); |
82 | p.bump_any(); | 82 | p.bump(T![!]); |
83 | m.complete(p, NEVER_TYPE); | 83 | m.complete(p, NEVER_TYPE); |
84 | } | 84 | } |
85 | 85 | ||
86 | fn pointer_type(p: &mut Parser) { | 86 | fn pointer_type(p: &mut Parser) { |
87 | assert!(p.at(T![*])); | 87 | assert!(p.at(T![*])); |
88 | let m = p.start(); | 88 | let m = p.start(); |
89 | p.bump_any(); | 89 | p.bump(T![*]); |
90 | 90 | ||
91 | match p.current() { | 91 | match p.current() { |
92 | // test pointer_type_mut | 92 | // test pointer_type_mut |
@@ -110,21 +110,21 @@ fn pointer_type(p: &mut Parser) { | |||
110 | fn array_or_slice_type(p: &mut Parser) { | 110 | fn array_or_slice_type(p: &mut Parser) { |
111 | assert!(p.at(T!['['])); | 111 | assert!(p.at(T!['['])); |
112 | let m = p.start(); | 112 | let m = p.start(); |
113 | p.bump_any(); | 113 | p.bump(T!['[']); |
114 | 114 | ||
115 | type_(p); | 115 | type_(p); |
116 | let kind = match p.current() { | 116 | let kind = match p.current() { |
117 | // test slice_type | 117 | // test slice_type |
118 | // type T = [()]; | 118 | // type T = [()]; |
119 | T![']'] => { | 119 | T![']'] => { |
120 | p.bump_any(); | 120 | p.bump(T![']']); |
121 | SLICE_TYPE | 121 | SLICE_TYPE |
122 | } | 122 | } |
123 | 123 | ||
124 | // test array_type | 124 | // test array_type |
125 | // type T = [(); 92]; | 125 | // type T = [(); 92]; |
126 | T![;] => { | 126 | T![;] => { |
127 | p.bump_any(); | 127 | p.bump(T![;]); |
128 | expressions::expr(p); | 128 | expressions::expr(p); |
129 | p.expect(T![']']); | 129 | p.expect(T![']']); |
130 | ARRAY_TYPE | 130 | ARRAY_TYPE |
@@ -146,7 +146,7 @@ fn array_or_slice_type(p: &mut Parser) { | |||
146 | fn reference_type(p: &mut Parser) { | 146 | fn reference_type(p: &mut Parser) { |
147 | assert!(p.at(T![&])); | 147 | assert!(p.at(T![&])); |
148 | let m = p.start(); | 148 | let m = p.start(); |
149 | p.bump_any(); | 149 | p.bump(T![&]); |
150 | p.eat(LIFETIME); | 150 | p.eat(LIFETIME); |
151 | p.eat(T![mut]); | 151 | p.eat(T![mut]); |
152 | type_no_bounds(p); | 152 | type_no_bounds(p); |
@@ -158,7 +158,7 @@ fn reference_type(p: &mut Parser) { | |||
158 | fn placeholder_type(p: &mut Parser) { | 158 | fn placeholder_type(p: &mut Parser) { |
159 | assert!(p.at(T![_])); | 159 | assert!(p.at(T![_])); |
160 | let m = p.start(); | 160 | let m = p.start(); |
161 | p.bump_any(); | 161 | p.bump(T![_]); |
162 | m.complete(p, PLACEHOLDER_TYPE); | 162 | m.complete(p, PLACEHOLDER_TYPE); |
163 | } | 163 | } |
164 | 164 | ||
@@ -193,7 +193,7 @@ fn fn_pointer_type(p: &mut Parser) { | |||
193 | 193 | ||
194 | pub(super) fn for_binder(p: &mut Parser) { | 194 | pub(super) fn for_binder(p: &mut Parser) { |
195 | assert!(p.at(T![for])); | 195 | assert!(p.at(T![for])); |
196 | p.bump_any(); | 196 | p.bump(T![for]); |
197 | if p.at(T![<]) { | 197 | if p.at(T![<]) { |
198 | type_params::opt_type_param_list(p); | 198 | type_params::opt_type_param_list(p); |
199 | } else { | 199 | } else { |
@@ -224,7 +224,7 @@ pub(super) fn for_type(p: &mut Parser) { | |||
224 | fn impl_trait_type(p: &mut Parser) { | 224 | fn impl_trait_type(p: &mut Parser) { |
225 | assert!(p.at(T![impl])); | 225 | assert!(p.at(T![impl])); |
226 | let m = p.start(); | 226 | let m = p.start(); |
227 | p.bump_any(); | 227 | p.bump(T![impl]); |
228 | type_params::bounds_without_colon(p); | 228 | type_params::bounds_without_colon(p); |
229 | m.complete(p, IMPL_TRAIT_TYPE); | 229 | m.complete(p, IMPL_TRAIT_TYPE); |
230 | } | 230 | } |
@@ -234,7 +234,7 @@ fn impl_trait_type(p: &mut Parser) { | |||
234 | fn dyn_trait_type(p: &mut Parser) { | 234 | fn dyn_trait_type(p: &mut Parser) { |
235 | assert!(p.at(T![dyn ])); | 235 | assert!(p.at(T![dyn ])); |
236 | let m = p.start(); | 236 | let m = p.start(); |
237 | p.bump_any(); | 237 | p.bump(T![dyn ]); |
238 | type_params::bounds_without_colon(p); | 238 | type_params::bounds_without_colon(p); |
239 | m.complete(p, DYN_TRAIT_TYPE); | 239 | m.complete(p, DYN_TRAIT_TYPE); |
240 | } | 240 | } |