From 7053b6010aa35580c051b334920a4bba3ffbec1a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 19 Aug 2011 12:01:01 -0700 Subject: Parse x[y] as indexes --- src/comp/syntax/parse/parser.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 5361a686814..2d11ae974d3 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -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() { -- cgit 1.4.1-3-g733a5