The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
Symbol.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: Symbol.cs //
6 // Authors: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Francisco Ortin - francisco.ortin@gmail.com //
8 // Description: //
9 // This class represents a symbol associated with a identifier. //
10 // -------------------------------------------------------------------------- //
11 // Create date: 30-03-2007 //
12 // Modification date: 13-04-2007 //
14 
15 using System;
16 using System.Collections.Generic;
17 using System.Text;
18 
19 using TypeSystem;
20 
21 namespace Symbols
22 {
26  public class Symbol
27  {
28  #region Fields
29 
33  private string name;
34 
38  private int scope;
39 
43  private TypeExpression type;
44 
48  private bool dynamic;
49 
50  #endregion
51 
52  #region Properties
53 
57  public string Name
58  {
59  get { return this.name; }
60  }
61 
65  public int Scope
66  {
67  get { return this.scope; }
68  }
69 
74  {
75  get { return this.type; }
76  set { this.type = value; }
77  }
78 
82  public bool IsDynamic
83  {
84  get { return this.dynamic; }
85  }
86 
87  #endregion
88 
89  #region Constructor
90 
98  public Symbol(string symbolName, int symbolScope, TypeExpression symbolType, bool isDinamic)
99  {
100  this.name = symbolName;
101  this.scope = symbolScope;
102  this.type = symbolType;
103  this.dynamic = isDinamic;
104  }
105 
106  #endregion
107 
108  #region ToString()
109 
114  public override string ToString()
115  {
116  StringBuilder aux = new StringBuilder();
117  aux.AppendFormat("Name: {0} Scope: {1} Type: {2} Is dynamic: {3}", this.name, this.scope, this.type, this.dynamic);
118  return aux.ToString();
119  }
120 
121  #endregion
122  }
123 }
bool IsDynamic
True if the symbol reference is dynamic, false if the symbol reference is static. ...
Definition: Symbol.cs:83
string Name
Gets the identifier name associated with the symbol.
Definition: Symbol.cs:58
Abstract class that represents all different types.
System.Text.StringBuilder StringBuilder
Definition: CSharpParser.cs:4
This class represents a symbol associated with its identifier.
Definition: Symbol.cs:26
int Scope
Gets symbol scope.
Definition: Symbol.cs:66
TypeExpression SymbolType
Gets the symbol type.
Definition: Symbol.cs:74
override string ToString()
Returns the symbol information
Definition: Symbol.cs:114
Symbol(string symbolName, int symbolScope, TypeExpression symbolType, bool isDinamic)
Constructor of Symbol.
Definition: Symbol.cs:98