From ca40ca93a55ffa08d3e699fc877e7e189b526c66 Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 5 Apr 2019 22:34:45 +0200 Subject: Parse and infer tuple indices --- crates/ra_parser/src/grammar/expressions.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'crates/ra_parser') diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index bf5d6544d..9b38b0a31 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs @@ -379,6 +379,14 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { // fn foo() { // x.foo; // x.0.bar; +// x.0(); +// } + +// test_err bad_tuple_index_expr +// fn foo() { +// x.0.; +// x.1i32; +// x.0x01; // } fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(DOT)); @@ -387,7 +395,10 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { if p.at(IDENT) { name_ref(p) } else if p.at(INT_NUMBER) { - p.bump() + p.bump(); + } else if p.at(FLOAT_NUMBER) { + // FIXME: How to recover and instead parse INT + DOT? + p.bump(); } else { p.error("expected field name or number") } -- cgit v1.2.3