aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
authorrobojumper <[email protected]>2019-04-05 21:34:45 +0100
committerrobojumper <[email protected]>2019-04-06 00:07:35 +0100
commitca40ca93a55ffa08d3e699fc877e7e189b526c66 (patch)
tree8b56a9250db5c713da3fc14758c0583bbb029638 /crates/ra_parser/src
parent0372eca5b2e6dade5132a08db46992ca73a25188 (diff)
Parse and infer tuple indices
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs13
1 files changed, 12 insertions, 1 deletions
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 {
379// fn foo() { 379// fn foo() {
380// x.foo; 380// x.foo;
381// x.0.bar; 381// x.0.bar;
382// x.0();
383// }
384
385// test_err bad_tuple_index_expr
386// fn foo() {
387// x.0.;
388// x.1i32;
389// x.0x01;
382// } 390// }
383fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { 391fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
384 assert!(p.at(DOT)); 392 assert!(p.at(DOT));
@@ -387,7 +395,10 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
387 if p.at(IDENT) { 395 if p.at(IDENT) {
388 name_ref(p) 396 name_ref(p)
389 } else if p.at(INT_NUMBER) { 397 } else if p.at(INT_NUMBER) {
390 p.bump() 398 p.bump();
399 } else if p.at(FLOAT_NUMBER) {
400 // FIXME: How to recover and instead parse INT + DOT?
401 p.bump();
391 } else { 402 } else {
392 p.error("expected field name or number") 403 p.error("expected field name or number")
393 } 404 }