Parse x[y] as indexes

This commit is contained in:
Brian Anderson 2011-08-19 12:01:01 -07:00
parent 325ea41a1e
commit 7053b6010a
4 changed files with 26 additions and 19 deletions

View file

@ -1109,6 +1109,13 @@ fn parse_dot_or_call_expr_with(p: &parser, e: @ast::expr) -> @ast::expr {
e = mk_expr(p, lo, hi, ast::expr_call(e, es.node));
}
}
token::LBRACKET. {
p.bump();
let ix = parse_expr(p);
hi = ix.span.hi;
expect(p, token::RBRACKET);
e = mk_expr(p, lo, hi, ast::expr_index(e, ix));
}
token::DOT. {
p.bump();
alt p.peek() {