Support for two-argument functions.

Should probably support n args instead. This is a quick hack.
Also, ';' is a slightly ugly argument separator.
This commit is contained in:
Stephen Dolan committed 2012-12-28 15:07:27 +00:00
1 parent 417899f9a0
commit f1e23448e7
1 file changed
+16
+16
View File
@@ -319,9 +319,20 @@ FuncDef:
$7);
jv_free($2);
jv_free($4);
} |
"def" IDENT '(' IDENT ';' IDENT ')' ':' Exp ';' {
$$ = gen_function(jv_string_value($2),
BLOCK(gen_op_block_unbound(CLOSURE_PARAM, jv_string_value($4)),
gen_op_block_unbound(CLOSURE_PARAM, jv_string_value($6))),
$9);
jv_free($2);
jv_free($4);
jv_free($6);
}
String:
QQSTRING_START { $<literal>$ = jv_string("text"); } QQString QQSTRING_END {
$$ = $3;
@@ -414,6 +425,11 @@ IDENT '(' Exp ')' {
$$ = gen_location(@1, $$);
jv_free($1);
} |
IDENT '(' Exp ';' Exp ')' {
$$ = gen_call(jv_string_value($1), BLOCK(gen_lambda($3), gen_lambda($5)));
$$ = gen_location(@1, $$);
jv_free($1);
} |
'(' error ')' { $$ = gen_noop(); } |
'[' error ']' { $$ = gen_noop(); } |
Term '[' error ']' { $$ = $1; } |