mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- allow multiple expressions in 'for' iteration part.
This commit is contained in:
parent
b38934b532
commit
3f9ad55432
2 changed files with 10 additions and 1 deletions
|
@ -1859,6 +1859,7 @@ for_init(X) ::= for_bump(A). { X = A /*X-overwrites-A*/; }
|
||||||
%type for_bump{ZCC_Statement *}
|
%type for_bump{ZCC_Statement *}
|
||||||
for_bump(X) ::= . { X = NULL; }
|
for_bump(X) ::= . { X = NULL; }
|
||||||
for_bump(X) ::= expression_statement(A). { X = A; /*X-overwrites-A*/ }
|
for_bump(X) ::= expression_statement(A). { X = A; /*X-overwrites-A*/ }
|
||||||
|
for_bump(X) ::= for_bump(A) COMMA expression_statement(B). { X = A; /*X-overwrites-A*/ AppendTreeNodeSibling(X, B); }
|
||||||
|
|
||||||
/*----- If Statements -----*/
|
/*----- If Statements -----*/
|
||||||
|
|
||||||
|
|
|
@ -3482,7 +3482,15 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
||||||
}
|
}
|
||||||
else if (iter->LoopBumper != nullptr)
|
else if (iter->LoopBumper != nullptr)
|
||||||
{
|
{
|
||||||
return new FxForLoop(nullptr, ConvertNode(iter->LoopCondition), ConvertNode(iter->LoopBumper), ConvertNode(iter->LoopStatement), *ast);
|
FArgumentList bumper;
|
||||||
|
ConvertNodeList(bumper, iter->LoopBumper);
|
||||||
|
FxCompoundStatement *bumps = new FxCompoundStatement(*ast);
|
||||||
|
for (auto &ex : bumper)
|
||||||
|
{
|
||||||
|
bumps->Add(ex);
|
||||||
|
ex = nullptr;
|
||||||
|
}
|
||||||
|
return new FxForLoop(nullptr, ConvertNode(iter->LoopCondition), bumps, ConvertNode(iter->LoopStatement), *ast);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue