Fold operation (code/docs/test)

This commit is contained in:
Stephen Dolan committed 2012-12-28 15:05:34 +00:00
1 parent 9302b16247
commit 417899f9a0
6 files changed
+61 -1

No files matched your search

+6
View File
@@ -58,6 +58,7 @@ struct lexer_param;
%token THEN "then"
%token ELSE "else"
%token ELSE_IF "elif"
%token FOLD "fold"
%token END "end"
%token AND "and"
%token OR "or"
@@ -201,6 +202,11 @@ Term "as" '$' IDENT '|' Exp {
jv_free($4);
} |
"fold" Term "as" '$' IDENT '(' Exp ')' {
$$ = gen_fold(jv_string_value($5), $2, $7);
jv_free($5);
} |
"if" Exp "then" Exp ElseBody {
$$ = gen_cond($2, $4, $5);
} |