18 using System.Collections.Generic;
22 using ErrorManagement;
42 private List<string> usings;
47 private Dictionary<string, List<Namespace>> namespaceDefinitions;
52 private List<Declaration> declarations;
64 get {
return this.usings; }
70 public Dictionary<string, List<Namespace>>.KeyCollection
Namespacekeys
72 get {
return this.namespaceDefinitions.Keys; }
80 get {
return this.declarations.Count; }
96 this.usings =
new List<string>();
97 this.namespaceDefinitions =
new Dictionary<string, List<Namespace>>();
98 this.declarations =
new List<Declaration>();
112 this.usings.Add(include);
117 #region AddDeclaration()
125 this.declarations.Add(declaration);
130 #region AddNamespace()
139 if (!namespaceDefinitions.ContainsKey(name.
Identifier))
141 this.namespaceDefinitions.Add(name.Identifier,
new List<Namespace>());
143 this.namespaceDefinitions[name.Identifier].Add(
new Namespace(name, declaration, name.
Location));
148 #region GetDeclarationElement()
157 return this.declarations[index];
162 #region GetNamespaceDefinitionCount
170 if (this.namespaceDefinitions.ContainsKey(name))
171 return this.namespaceDefinitions[name].Count;
177 #region GetNamespaceDeclarationElement()
187 if (this.namespaceDefinitions.ContainsKey(name))
188 return this.namespaceDefinitions[name][index];
204 return v.Visit(
this, o);
Declaration GetDeclarationElement(int index)
Gets the element stored in the specified index.
Encapsulates a name expression of our programming language.
void AddNamespace(IdentifierExpression name, List< Declaration > declaration)
Add a new namespace definition.
Encapsulates a namespace definition.
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.
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
int DeclarationCount
Gets the number of declarations out of namespace definition.
Namespace GetNamespaceDeclarationElement(string name, int index)
Gets the element stored in the specified namespace and index.
Dictionary< string, List< Namespace > >.KeyCollection Namespacekeys
Gets the keys of namespace definition.
SourceFile(Location loc)
Constructor of SourceFile
Abstract class for all nodes that compounds the abstract syntax tree.
Encapsulates the source code.
Encapsulates a declaration of a concrete type.
int GetNamespaceDefinitionCount(string name)
Gets the number of declaration into the specified namespace.
void AddUsing(string include)
Add a new include file.
void AddDeclaration(Declaration declaration)
Add a new declaration.
string Identifier
Gets the name name.
List< string > Usings
Gets the included files.