Sha256: daee337e43027913ea89848b76df34844f110ec6edf29cf4879d585d1f84ab61

Contents?: true

Size: 859 Bytes

Versions: 135

Compression:

Stored size: 859 Bytes

Contents

/** 
 * Copyright 2005-2007 Xue Yong Zhi
 * Distributed under the BSD License
 */

package com.xruby.compiler.parser;

import java.util.*;

public class SymbolTableManager {
	private Stack<SymbolTable> stStack = new Stack<SymbolTable>();
	
	public SymbolTableManager() {
		enterScope();
	}
	
	public SymbolTableManager(List<String> preDefinedVar) {
		enterScope();
		
		for (String s : preDefinedVar) {
			addVariable(s);
		}
	}
	
	public void enterScope() {
		stStack.add(new SymbolTable());
	}
	
	public void enterBlockScope() {
		stStack.add(new SymbolTableForBlock(stStack.peek()));
	}
	
	public void leaveScope() {
		stStack.pop();
	}
	
	public boolean isDefinedInCurrentScope(String s) {
		return stStack.peek().findVariable(s);
	}
	
	public void addVariable(String s) {
		stStack.peek().addVariable(s);
	}
}

Version data entries

135 entries across 135 versions & 2 rubygems

Version Path
rhodes-7.6.0 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-7.5.1 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-7.4.1 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-7.1.17 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-6.2.0 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-6.0.11 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.18 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.17 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.15 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.0.22 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.2 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.0.7 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.0.3 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-5.5.0 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
tauplatform-1.0.3 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
tauplatform-1.0.2 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
tauplatform-1.0.1 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-3.5.1.12 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-3.3.5 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java
rhodes-3.4.2 platform/shared/xruby/src/com/xruby/compiler/parser/SymbolTableManager.java