foreach node

This commit is contained in:
vadim
2017-12-07 18:27:56 +02:00
parent 93a46477ed
commit 4394c3997d
3 changed files with 397 additions and 362 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -377,20 +377,9 @@ statement:
| T_UNSET '(' unset_variables possible_comma ')' ';'
{ $$ = node.NewSimpleNode("Unset").Append($3); }
| T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement
{
$$ = node.NewSimpleNode("Foreach").
Append(node.NewSimpleNode("expr").Append($3)).
Append(node.NewSimpleNode("ForeachVariable").Append($5)).
Append($7);
}
{ $$ = stmt.NewForeach($1, $3, nil, $5, $7); }
| T_FOREACH '(' expr T_AS foreach_variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement
{
$$ = node.NewSimpleNode("Foreach").
Append(node.NewSimpleNode("expr").Append($3)).
Append(node.NewSimpleNode("ForeachKey").Append($5)).
Append(node.NewSimpleNode("ForeachVariable").Append($7)).
Append($9);
}
{ $$ = stmt.NewForeach($1, $3, $5, $7, $9); }
| T_DECLARE '(' const_list ')' declare_statement { $$ = stmt.NewDeclare($1, $3, $5) }
| ';' /* empty statement */ { $$ = node.NewSimpleNode(""); }
| T_TRY '{' inner_statement_list '}' catch_list finally_statement