aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/front')
-rw-r--r--src/comp/front/ast.rs2
-rw-r--r--src/comp/front/lexer.rs2
-rw-r--r--src/comp/front/parser.rs10
-rw-r--r--src/comp/front/token.rs6
4 files changed, 20 insertions, 0 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index c1e363b7..b1dbd80e 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -246,6 +246,8 @@ tag expr_ {
expr_path(path, option.t[def], ann);
expr_ext(path, vec[@expr], option.t[@expr], @expr, ann);
expr_fail;
+ expr_break;
+ expr_cont;
expr_ret(option.t[@expr]);
expr_put(option.t[@expr]);
expr_be(@expr);
diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs
index a793a920..878940b7 100644
--- a/src/comp/front/lexer.rs
+++ b/src/comp/front/lexer.rs
@@ -111,6 +111,8 @@ impure fn new_reader(io.reader rdr, str filename) -> reader
keywords.insert("for", token.FOR);
keywords.insert("each", token.EACH);
+ keywords.insert("break", token.BREAK);
+ keywords.insert("cont", token.CONT);
keywords.insert("put", token.PUT);
keywords.insert("ret", token.RET);
keywords.insert("be", token.BE);
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index dad41e2e..c8130b0b 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -829,6 +829,16 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
}
}
+ case (token.BREAK) {
+ p.bump();
+ ex = ast.expr_break;
+ }
+
+ case (token.CONT) {
+ p.bump();
+ ex = ast.expr_cont;
+ }
+
case (token.PUT) {
p.bump();
alt (p.peek()) {
diff --git a/src/comp/front/token.rs b/src/comp/front/token.rs
index 9d5f0dfd..bb0cea80 100644
--- a/src/comp/front/token.rs
+++ b/src/comp/front/token.rs
@@ -74,6 +74,9 @@ tag token {
ALT;
CASE;
+ BREAK;
+ CONT;
+
FAIL;
DROP;
@@ -242,6 +245,9 @@ fn to_str(token t) -> str {
case (ALT) { ret "alt"; }
case (CASE) { ret "case"; }
+ case (BREAK) { ret "break"; }
+ case (CONT) { ret "cont"; }
+
case (FAIL) { ret "fail"; }
case (DROP) { ret "drop"; }