From 957b5ed23a4860fe3c9b80687a801b5d7870fe00 Mon Sep 17 00:00:00 2001 From: Evgenii P Date: Fri, 9 Aug 2019 15:38:52 +0700 Subject: Parse tuple struct field initialization --- crates/ra_parser/src/grammar.rs | 2 +- crates/ra_parser/src/grammar/expressions.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_parser/src') diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 658034097..00fb1bac9 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs @@ -274,7 +274,7 @@ fn name(p: &mut Parser) { } fn name_ref(p: &mut Parser) { - if p.at(IDENT) { + if p.at(IDENT) || p.at(INT_NUMBER) { let m = p.start(); p.bump(); m.complete(p, NAME_REF); diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 3e49e70c7..50c938a23 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs @@ -572,6 +572,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { // S {}; // S { x, y: 32, }; // S { x, y: 32, ..Default::default() }; +// TupleStruct { 0: 1 }; // } pub(crate) fn named_field_list(p: &mut Parser) { assert!(p.at(T!['{'])); @@ -583,7 +584,7 @@ pub(crate) fn named_field_list(p: &mut Parser) { // fn main() { // S { #[cfg(test)] field: 1 } // } - IDENT | T![#] => { + IDENT | INT_NUMBER | T![#] => { let m = p.start(); attributes::outer_attributes(p); name_ref(p); -- cgit v1.2.3