aboutsummaryrefslogtreecommitdiff
path: root/src/boot/fe
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/fe')
-rw-r--r--src/boot/fe/ast.ml6
-rw-r--r--src/boot/fe/item.ml9
-rw-r--r--src/boot/fe/lexer.mll2
-rw-r--r--src/boot/fe/token.ml4
4 files changed, 20 insertions, 1 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index 54c48f7d..46a87dfe 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -207,6 +207,8 @@ and stmt' =
| STMT_put_each of (lval * (atom array))
| STMT_ret of (atom option)
| STMT_be of (lval * (atom array))
+ | STMT_break
+ | STMT_cont
| STMT_alt_tag of stmt_alt_tag
| STMT_alt_type of stmt_alt_type
| STMT_alt_port of stmt_alt_port
@@ -1228,6 +1230,10 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
fmt_atoms ff az;
fmt ff ";";
+ | STMT_break -> fmt ff "break;";
+
+ | STMT_cont -> fmt ff "cont;";
+
| STMT_block b -> fmt_block ff b.node
| STMT_copy (lv, ex) ->
diff --git a/src/boot/fe/item.ml b/src/boot/fe/item.ml
index 3d3bf84f..c1746cc2 100644
--- a/src/boot/fe/item.ml
+++ b/src/boot/fe/item.ml
@@ -188,7 +188,14 @@ and parse_stmts_including_none (ps:pstate) : Ast.stmt array =
let (stmts, atom) = ctxt "stmts: log value" parse_expr_atom ps in
expect ps SEMI;
spans ps stmts apos (Ast.STMT_log atom)
-
+ | BREAK ->
+ bump ps;
+ expect ps SEMI;
+ [| span ps apos (lexpos ps) Ast.STMT_break |]
+ | CONT ->
+ bump ps;
+ expect ps SEMI;
+ [| span ps apos (lexpos ps) Ast.STMT_cont |]
| CHECK ->
bump ps;
begin
diff --git a/src/boot/fe/lexer.mll b/src/boot/fe/lexer.mll
index 763b50c9..151af827 100644
--- a/src/boot/fe/lexer.mll
+++ b/src/boot/fe/lexer.mll
@@ -113,6 +113,8 @@
("const", CONST);
("log", LOG);
+ ("break", BREAK);
+ ("cont", CONT);
("spawn", SPAWN);
("thread", THREAD);
("yield", YIELD);
diff --git a/src/boot/fe/token.ml b/src/boot/fe/token.ml
index 85dd2a13..cd41ec2f 100644
--- a/src/boot/fe/token.ml
+++ b/src/boot/fe/token.ml
@@ -71,6 +71,8 @@ type token =
| PUT
| RET
| BE
+ | BREAK
+ | CONT
(* Type and type-state keywords *)
| TYPE
@@ -226,6 +228,8 @@ let rec string_of_tok t =
| PUT -> "put"
| RET -> "ret"
| BE -> "be"
+ | BREAK -> "break"
+ | CONT -> "cont"
(* Type and type-state keywords *)
| TYPE -> "type"