From ebc4df3c7add208195e84940f69648be793b328f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 24 Mar 2011 21:54:19 -0400 Subject: Implement local declarations with receive. Un-XFAIL decl-with-recv.rs. --- src/comp/front/parser.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/comp/front/parser.rs') diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 23b4a936..a903124d 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1365,13 +1365,21 @@ impure fn parse_expr_inner(parser p) -> @ast.expr { } impure fn parse_initializer(parser p) -> option.t[ast.initializer] { - if (p.peek() == token.EQ) { - p.bump(); - ret some(rec(op = ast.init_assign, - expr = parse_expr(p))); + alt (p.peek()) { + case (token.EQ) { + p.bump(); + ret some(rec(op = ast.init_assign, + expr = parse_expr(p))); + } + case (token.LARROW) { + p.bump(); + ret some(rec(op = ast.init_recv, + expr = parse_expr(p))); + } + case (_) { + ret none[ast.initializer]; + } } - - ret none[ast.initializer]; } impure fn parse_pat(parser p) -> @ast.pat { -- cgit v1.2.3