From 89694ec8f685e545585b96b2db6e5410ba117527 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 Mar 2020 08:50:34 +0100 Subject: Support arbitrary discriminants Closes #3661 --- crates/ra_parser/src/grammar/items/adt.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'crates/ra_parser/src/grammar') diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index c777bc9d0..74b9f514b 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs @@ -83,12 +83,14 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { match p.current() { T!['{'] => record_field_def_list(p), T!['('] => tuple_field_def_list(p), - T![=] => { - p.bump(T![=]); - expressions::expr(p); - } _ => (), } + + // test variant_discriminant + // enum E { X(i32) = 10 } + if p.eat(T![=]) { + expressions::expr(p); + } var.complete(p, ENUM_VARIANT); } else { var.abandon(p); -- cgit v1.2.3