Add foreach EXP as $var (INIT; UPDATE) form

This commit is contained in:
Nicolas Williams committed 2014-07-09 00:43:06 -05:00
1 parent 10477fc2d4
commit 5be80b81eb
2 files changed
+9

No files matched your search

+5
View File
@@ -243,6 +243,11 @@ Term "as" '$' IDENT '|' Exp {
jv_free($5);
} |
"foreach" Term "as" '$' IDENT '(' Exp ';' Exp ')' {
$$ = gen_foreach(jv_string_value($5), $2, $7, $9, gen_noop());
jv_free($5);
} |
"if" Exp "then" Exp ElseBody {
$$ = gen_cond($2, $4, $5);
} |
+4
View File
@@ -234,6 +234,10 @@ null
[11,22,33,44,55,66,77,88,99]
[11,22,33]
[foreach range(5) as $item (0; $item)]
null
[0,1,2,3,4]
[limit(3; .[])]
[11,22,33,44,55,66,77,88,99]
[11,22,33]