diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-20 07:51:24 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-20 07:51:24 +0000 |
commit | e0952899aee50b813379ca8e6dcab49a895ff0a0 (patch) | |
tree | ae389283c137194fdabc5e5e45b7021ac9fa3b7f /crates/ra_parser/src/grammar | |
parent | 1878fbe8bd60c7f9e58fda6dc7788e5f44ad0f89 (diff) | |
parent | 89694ec8f685e545585b96b2db6e5410ba117527 (diff) |
Merge #3662
3662: Support arbitrary discriminants r=matklad a=matklad
Closes #3661
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r-- | crates/ra_parser/src/grammar/items/adt.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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) { | |||
83 | match p.current() { | 83 | match p.current() { |
84 | T!['{'] => record_field_def_list(p), | 84 | T!['{'] => record_field_def_list(p), |
85 | T!['('] => tuple_field_def_list(p), | 85 | T!['('] => tuple_field_def_list(p), |
86 | T![=] => { | ||
87 | p.bump(T![=]); | ||
88 | expressions::expr(p); | ||
89 | } | ||
90 | _ => (), | 86 | _ => (), |
91 | } | 87 | } |
88 | |||
89 | // test variant_discriminant | ||
90 | // enum E { X(i32) = 10 } | ||
91 | if p.eat(T![=]) { | ||
92 | expressions::expr(p); | ||
93 | } | ||
92 | var.complete(p, ENUM_VARIANT); | 94 | var.complete(p, ENUM_VARIANT); |
93 | } else { | 95 | } else { |
94 | var.abandon(p); | 96 | var.abandon(p); |