FORを実�
This commit is contained in:
@@ -21,6 +21,7 @@ enum NodeType
|
||||
Label,
|
||||
Goto,
|
||||
If,
|
||||
For,
|
||||
}
|
||||
abstract class Node
|
||||
{
|
||||
@@ -209,3 +210,26 @@ class If : Statement
|
||||
return !(else_ is null) && else_.statements.length != 0;
|
||||
}
|
||||
}
|
||||
class For : Statement
|
||||
{
|
||||
Assign initExpression;
|
||||
Expression toExpression;
|
||||
Expression stepExpression;
|
||||
Statements statements;
|
||||
this(Assign assign, Expression toExpression, Expression stepExpression, Statements statements)
|
||||
{
|
||||
this.type = NodeType.For;
|
||||
this.initExpression = assign;
|
||||
this.toExpression = toExpression;
|
||||
this.stepExpression = stepExpression;
|
||||
this.statements = statements;
|
||||
}
|
||||
this(Assign assign, Expression toExpression, Statements statements)
|
||||
{
|
||||
this.type = NodeType.For;
|
||||
this.initExpression = assign;
|
||||
this.toExpression = toExpression;
|
||||
this.stepExpression = null;
|
||||
this.statements = statements;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user