diff options
| author | Graydon Hoare <[email protected]> | 2011-02-14 17:58:32 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-02-14 17:58:32 -0800 |
| commit | 15a01f5c3691a152793d8933a7be9d16a0fc7030 (patch) | |
| tree | ef18ede583e4aae92360e5e2dc033f6c9ffc865f /src/comp/front | |
| parent | Move all non-decl/non-expr stmts to exprs. (diff) | |
| download | rust-15a01f5c3691a152793d8933a7be9d16a0fc7030.tar.xz rust-15a01f5c3691a152793d8933a7be9d16a0fc7030.zip | |
Add basic front-end support for expr_put.
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 1 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 53ffdd87..cb2df2a5 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -162,6 +162,7 @@ tag expr_ { expr_ext(vec[@expr], option.t[@expr], ann); expr_fail; expr_ret(option.t[@expr]); + expr_put(option.t[@expr]); expr_be(@expr); expr_log(@expr); expr_check_expr(@expr); diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 5ffaca19..a779d013 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -638,6 +638,20 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr { } } + case (token.PUT) { + p.bump(); + alt (p.peek()) { + case (token.SEMI) { + ex = ast.expr_put(none[@ast.expr]); + } + case (_) { + auto e = parse_expr(p); + hi = e.span; + ex = ast.expr_put(some[@ast.expr](e)); + } + } + } + case (token.BE) { p.bump(); auto e = parse_expr(p); @@ -1420,6 +1434,7 @@ fn stmt_ends_with_semi(@ast.stmt stmt) -> bool { case (ast.expr_path(_,_,_)) { ret true; } case (ast.expr_fail) { ret true; } case (ast.expr_ret(_)) { ret true; } + case (ast.expr_put(_)) { ret true; } case (ast.expr_be(_)) { ret true; } case (ast.expr_log(_)) { ret true; } case (ast.expr_check_expr(_)) { ret true; } |