18 using System.Collections.Generic;
22 using ErrorManagement;
41 private List<Statement> initializer;
51 private List<Statement> iterator;
61 private List<MoveStatement> afterInit;
66 private List<ThetaStatement> beforeCondition;
71 private List<MoveStatement> afterCondition;
76 private Block auxiliarInit;
87 get {
return this.initializer.Count; }
95 get {
return condition; }
96 set { condition = value; }
104 get {
return this.iterator.Count; }
112 get {
return forStatement; }
120 get {
return this.afterInit; }
121 set { this.afterInit = value; }
129 get {
return this.afterCondition; }
130 set { this.afterCondition = value; }
138 get {
return this.beforeCondition; }
139 set { this.beforeCondition = value; }
168 this.initializer = init;
170 this.initializer =
new List<Statement>();
172 this.condition = cond;
175 this.iterator = iter;
177 this.iterator =
new List<Statement>();
179 this.forStatement = statements;
181 this.afterInit =
new List<MoveStatement>();
182 this.beforeCondition =
new List<ThetaStatement>();
183 this.afterCondition =
new List<MoveStatement>();
188 #region GetInitializerElement()
197 return getElement(this.initializer, index);
202 #region GetIteratorElement()
211 return getElement(this.iterator, index);
223 private Statement getElement(List<Statement> list,
int index)
240 return v.Visit(
this, o);
245 #region UpdateInitializer()
250 internal void UpdateInitializer()
252 for (
int i = 0; i < this.auxiliarInit.StatementCount; i++)
254 this.initializer.Insert(0, this.auxiliarInit.GetStatementElement(i));
256 this.auxiliarInit = null;
Abstract class encapsulate a programming language expression.
Encapsulates a block of statements.
Statement GetIteratorElement(int index)
Gets the element stored in the specified index.
Expression Condition
Gets the condition expression of For Statement.
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Abstract class represents a programming language statement.
Block AuxInitializer
Gets the auxiliar block of variable declarations
Encapsulates a For statement of our programming languages.
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
List< ThetaStatement > BeforeCondition
Gets or sets the statements before condition.
int InitializerCount
Gets the number of initializer expressions of For statement.
int IteratorCount
Gets the number of iterator expression of For loop.
Location location
Location: Encapsulates in one object the line, column and filename
Statement Statements
Gets the block executed while the condition is true.
ForStatement(List< Statement > init, Expression cond, List< Statement > iter, Statement statements, Location location)
Constructor of ForStatement
List< MoveStatement > AfterCondition
Gets or sets the statements after condition.
List< MoveStatement > AfterInit
Gets or sets the statements to use after initialization
Statement GetInitializerElement(int index)
Gets the element stored in the specified index.