aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-02-14 17:58:32 -0800
committerGraydon Hoare <[email protected]>2011-02-14 17:58:32 -0800
commit15a01f5c3691a152793d8933a7be9d16a0fc7030 (patch)
treeef18ede583e4aae92360e5e2dc033f6c9ffc865f /src/comp/front
parentMove all non-decl/non-expr stmts to exprs. (diff)
downloadrust-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.rs1
-rw-r--r--src/comp/front/parser.rs15
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; }