summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y16
1 files changed, 16 insertions, 0 deletions
diff --git a/parser.y b/parser.y
index b546e2bb..bfd09d35 100644
--- a/parser.y
+++ b/parser.y
@@ -66,6 +66,8 @@ struct lexer_param;
%token END "end"
%token AND "and"
%token OR "or"
+%token TRY "try"
+%token CATCH "catch"
%token SETPIPE "|="
%token SETPLUS "+="
%token SETMINUS "-="
@@ -240,6 +242,20 @@ Term "as" '$' IDENT '|' Exp {
$$ = $2;
} |
+"try" Exp "catch" Exp {
+ //$$ = BLOCK(gen_op_target(FORK_OPT, $2), $2, $4);
+ $$ = gen_try($2, $4);
+} |
+"try" Exp {
+ //$$ = BLOCK(gen_op_target(FORK_OPT, $2), $2, gen_op_simple(BACKTRACK));
+ $$ = gen_try($2, gen_op_simple(BACKTRACK));
+} |
+"try" Exp "catch" error {
+ FAIL(@$, "Possibly unterminated 'try' statement");
+ $$ = $2;
+} |
+
+
Exp '=' Exp {
$$ = gen_call("_assign", BLOCK(gen_lambda($1), gen_lambda($3)));
} |