aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
authorEvgenii P <[email protected]>2019-08-09 09:38:52 +0100
committerEvgenii P <[email protected]>2019-08-09 09:38:52 +0100
commit957b5ed23a4860fe3c9b80687a801b5d7870fe00 (patch)
tree2aee1c7a0bd9a0160182a7525ef036c2c111f187 /crates/ra_parser/src
parent2fbec23d9990147e09a3b819c37dc1467a5e95d4 (diff)
Parse tuple struct field initialization
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/grammar.rs2
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs3
2 files changed, 3 insertions, 2 deletions
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) {
274} 274}
275 275
276fn name_ref(p: &mut Parser) { 276fn name_ref(p: &mut Parser) {
277 if p.at(IDENT) { 277 if p.at(IDENT) || p.at(INT_NUMBER) {
278 let m = p.start(); 278 let m = p.start();
279 p.bump(); 279 p.bump();
280 m.complete(p, NAME_REF); 280 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) {
572// S {}; 572// S {};
573// S { x, y: 32, }; 573// S { x, y: 32, };
574// S { x, y: 32, ..Default::default() }; 574// S { x, y: 32, ..Default::default() };
575// TupleStruct { 0: 1 };
575// } 576// }
576pub(crate) fn named_field_list(p: &mut Parser) { 577pub(crate) fn named_field_list(p: &mut Parser) {
577 assert!(p.at(T!['{'])); 578 assert!(p.at(T!['{']));
@@ -583,7 +584,7 @@ pub(crate) fn named_field_list(p: &mut Parser) {
583 // fn main() { 584 // fn main() {
584 // S { #[cfg(test)] field: 1 } 585 // S { #[cfg(test)] field: 1 }
585 // } 586 // }
586 IDENT | T![#] => { 587 IDENT | INT_NUMBER | T![#] => {
587 let m = p.start(); 588 let m = p.start();
588 attributes::outer_attributes(p); 589 attributes::outer_attributes(p);
589 name_ref(p); 590 name_ref(p);