mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
parent
1ba03c6995
commit
89694ec8f6
3 changed files with 37 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
enum E { X(i32) = 10 }
|
|
@ -0,0 +1,30 @@
|
|||
SOURCE_FILE@[0; 23)
|
||||
ENUM_DEF@[0; 22)
|
||||
ENUM_KW@[0; 4) "enum"
|
||||
WHITESPACE@[4; 5) " "
|
||||
NAME@[5; 6)
|
||||
IDENT@[5; 6) "E"
|
||||
WHITESPACE@[6; 7) " "
|
||||
ENUM_VARIANT_LIST@[7; 22)
|
||||
L_CURLY@[7; 8) "{"
|
||||
WHITESPACE@[8; 9) " "
|
||||
ENUM_VARIANT@[9; 20)
|
||||
NAME@[9; 10)
|
||||
IDENT@[9; 10) "X"
|
||||
TUPLE_FIELD_DEF_LIST@[10; 15)
|
||||
L_PAREN@[10; 11) "("
|
||||
TUPLE_FIELD_DEF@[11; 14)
|
||||
PATH_TYPE@[11; 14)
|
||||
PATH@[11; 14)
|
||||
PATH_SEGMENT@[11; 14)
|
||||
NAME_REF@[11; 14)
|
||||
IDENT@[11; 14) "i32"
|
||||
R_PAREN@[14; 15) ")"
|
||||
WHITESPACE@[15; 16) " "
|
||||
EQ@[16; 17) "="
|
||||
WHITESPACE@[17; 18) " "
|
||||
LITERAL@[18; 20)
|
||||
INT_NUMBER@[18; 20) "10"
|
||||
WHITESPACE@[20; 21) " "
|
||||
R_CURLY@[21; 22) "}"
|
||||
WHITESPACE@[22; 23) "\n"
|
Loading…
Reference in a new issue