18 using System.Collections.Generic;
22 using ErrorManagement;
41 private List<Statement> statements;
52 get {
return this.statements.Count; }
67 this.statements =
new List<Statement>();
79 this.statements = stats;
84 #region AddStatement()
91 if (statement != null)
92 this.statements.Add(statement);
97 #region AddStatementToTheBeginning()
105 this.statements.Insert(0, statement);
110 #region AddStatementAtIndex()
119 this.statements.Insert(index, statement);
124 #region SearchPosition()
133 for (
int i = 0; i < this.statements.Count; i++)
137 if (((IdDeclaration)this.statements[i]).Identifier.Equals(
id))
143 if (((DeclarationSet)this.statements[i]).ContainsId(id))
152 #region GetStatementElement()
161 return this.statements[index];
176 return v.Visit(
this, o);
void AddStatementAtIndex(Statement statement, int index)
Add a new statement at the specified index.
Encapsulates a block of statements.
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(Location location)
Constructor of Block
int StatementCount
Gets the number of statements.
void AddStatement(Statement statement)
Add a new statement to the end of the block.
int SearchPosition(string id)
Searches the identifier and returns its position.
Encapsulates a statement with several declarations.
Encapsulates a declaration.
Location location
Location: Encapsulates in one object the line, column and filename
void AddStatementToTheBeginning(Statement statement)
Add a new statement.
Block(List< Statement > stats, Location location)
Constructor of Block
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
Statement GetStatementElement(int index)
Gets the element stored in the specified index.