Example #1
0
		public Scope NextScope ()
		{
			if (CurrentScope == null)
				CurrentScope = globalScope;
			CurrentScope = CurrentScope.NextScope;
			return CurrentScope;
		}
Example #2
0
		/// <summary>
		/// Leaves the scope.
		/// </summary>
		/// <returns>The scope.</returns>
		public Scope LeaveScope ()
		{
			Scope old = CurrentScope;
			CurrentScope = old.ParentScope;
			CurrentScope.NextScope = old.NextScope;
			return CurrentScope;
		}
Example #3
0
		/// <summary>
		/// Begins a new scope.
		/// </summary>
		/// <param name="isLocalScope">If set to <c>true</c> is local scope.</param>
		public void BeginScope (bool isLocalScope = false)
		{
			if (isLocalScope) {
				currentLocalScope = new LocalScope (currentLocalScope);
			}
			Scope newScope = new Scope (CurrentScope);
			if (lastScope != null) {
				lastScope.NextScope = newScope;
			} else {
				globalScope.NextScope = newScope;
			}
			CurrentScope.AddScope (newScope);
			CurrentScope = newScope;
			lastScope = newScope;
		}
Example #4
0
		public void AddScope (Scope scope)
		{
			childScopes.Add (scope);
		}
Example #5
0
		public SymbolTable ()
		{
			CurrentScope = globalScope;
		}
Example #6
0
		public Scope ()
		{
			ParentScope = null;
		}
Example #7
0
		public Scope (Scope parent)
		{
			ParentScope = parent;
		}
Example #8
0
		/// <summary>
		/// Ends a scope.
		/// </summary>
		/// <param name="isLocalScope">If set to <c>true</c> is local scope.</param>
		public void EndScope (bool isLocalScope = false)
		{
			if (isLocalScope) {
				currentLocalScope = currentLocalScope.ParentScope;
			}

			CurrentScope = CurrentScope.ParentScope;
		}
Example #9
0
 public SymbolTable()
 {
     CurrentScope = globalScope;
 }
Example #10
0
 public void AddScope(Scope scope)
 {
     childScopes.Add(scope);
 }
Example #11
0
 public Scope(Scope parent)
 {
     ParentScope = parent;
 }
Example #12
0
 public Scope()
 {
     ParentScope = null;
 }