| assertParserOutput(
new ForStatement(
null,
null,
new IncrementExpression(
new Identifier("x"),
+1,
true
),
new EmptyStatement()
),
"for (;; x++);"
);
assertParserOutput(
new ForStatement(
null,
new BinaryOperatorExpression(
new Identifier("x"),
new NumberLiteral(4.0),
Token.OPERATOR_LESSTHAN
),
null,
new EmptyStatement()
),
"for (; x < 4;);"
);
assertParserOutput(
new ForStatement(
null,
new BinaryOperatorExpression(
new Identifier("x"),
new NumberLiteral(4.0),
Token.OPERATOR_LESSTHAN
),
new IncrementExpression(
new Identifier("x"), +1, true
),
new EmptyStatement()
),
"for (; x < 4; x++);"
);
assertParserOutput(
new ForStatement(
new AssignmentExpression(
new Identifier("x"),
new NumberLiteral(0.0)
),
new BinaryOperatorExpression(
new Identifier("x"),
new NumberLiteral(4.0),
Token.OPERATOR_LESSTHAN
),
new IncrementExpression(
new Identifier("x"), +1, true
),
new EmptyStatement()
),
"for (x = 0; x < 4; x++);"
);
assertParserOutput(
new ForStatement(
new VariableExpression(
new VariableDeclaration[] {
new VariableDeclaration(
new Identifier("x"),
new NumberLiteral(0.0)
),
}
),
new BinaryOperatorExpression(
new Identifier("x"),
new NumberLiteral(4.0),
Token.OPERATOR_LESSTHAN
),
new IncrementExpression(
new Identifier("x"), +1, true
),
new EmptyStatement()
),
"for (var x = 0; x < 4; x++);"
);
assertParserOutput(
new ForStatement(
new VariableExpression(
new VariableDeclaration[] {
new VariableDeclaration(
new Identifier("x"),
new NumberLiteral(0.0)
),
new VariableDeclaration(
new Identifier("y"),
new NumberLiteral(8.0)
)
}
),
new BinaryOperatorExpression(
new Identifier("x"),
new NumberLiteral(4.0),
Token.OPERATOR_LESSTHAN
),
new BinaryOperatorExpression(
new IncrementExpression(
new Identifier("x"), +1, true
),
new IncrementExpression(
new Identifier("y"), -1, true
),
Token.OPERATOR_COMMA
),
new EmptyStatement()
),
|