示例#1
0
 private SymbolTable()
 {
     cur_scope = new SymbolTableScope(null);
     // insert reserved words
     insertGlobal("__MAIN", RESERVED_WORD);
     insertGlobal("and", RESERVED_WORD);
     insertGlobal("or", RESERVED_WORD);
     insertGlobal("xor", RESERVED_WORD);
     insertGlobal("__FILE__", RESERVED_WORD);
     insertGlobal("exception", RESERVED_WORD);
     insertGlobal("__LINE__", RESERVED_WORD);
     insertGlobal("array", RESERVED_WORD);
     insertGlobal("as", RESERVED_WORD);
     insertGlobal("break", RESERVED_WORD);
     insertGlobal("case", RESERVED_WORD);
     insertGlobal("class", RESERVED_WORD);
     insertGlobal("const", RESERVED_WORD);
     insertGlobal("continue", RESERVED_WORD);
     insertGlobal("declare", RESERVED_WORD);
     insertGlobal("default", RESERVED_WORD);
     insertGlobal("die", RESERVED_WORD);
     insertGlobal("do", RESERVED_WORD);
     insertGlobal("echo", RESERVED_WORD);
     insertGlobal("else", RESERVED_WORD);
     insertGlobal("elseif", RESERVED_WORD);
     insertGlobal("empty", RESERVED_WORD);
     insertGlobal("enddeclare", RESERVED_WORD);
     insertGlobal("endfor", RESERVED_WORD);
     insertGlobal("endforeach", RESERVED_WORD);
     insertGlobal("endif", RESERVED_WORD);
     insertGlobal("endswitch", RESERVED_WORD);
     insertGlobal("endwhile", RESERVED_WORD);
     insertGlobal("eval", RESERVED_WORD);
     insertGlobal("exit", RESERVED_WORD);
     insertGlobal("for", RESERVED_WORD);
     insertGlobal("foreach", RESERVED_WORD);
     insertGlobal("function", RESERVED_WORD);
     insertGlobal("global", RESERVED_WORD);
     insertGlobal("if", RESERVED_WORD);
     insertGlobal("include", RESERVED_WORD);
     insertGlobal("include_once", RESERVED_WORD);
     insertGlobal("isset", RESERVED_WORD);
     insertGlobal("list", RESERVED_WORD);
     insertGlobal("new", RESERVED_WORD);
     insertGlobal("print", RESERVED_WORD);
     insertGlobal("require", RESERVED_WORD);
     insertGlobal("require_once", RESERVED_WORD);
     insertGlobal("return", RESERVED_WORD);
     insertGlobal("static", RESERVED_WORD);
     insertGlobal("switch", RESERVED_WORD);
     insertGlobal("unset", RESERVED_WORD);
     insertGlobal("use", RESERVED_WORD);
     insertGlobal("var", RESERVED_WORD);
     insertGlobal("while", RESERVED_WORD);
     insertGlobal("__FUNCTION__", RESERVED_WORD);
     insertGlobal("__CLASS__", RESERVED_WORD);
     insertGlobal("__METHOD__", RESERVED_WORD);
     insertGlobal("final", RESERVED_WORD);
     insertGlobal("php_user_filter", RESERVED_WORD);
     insertGlobal("interface", RESERVED_WORD);
     insertGlobal("implements", RESERVED_WORD);
     insertGlobal("extends", RESERVED_WORD);
     insertGlobal("public", RESERVED_WORD);
     insertGlobal("private", RESERVED_WORD);
     insertGlobal("protected", RESERVED_WORD);
     insertGlobal("abstract", RESERVED_WORD);
     insertGlobal("clone", RESERVED_WORD);
     insertGlobal("try", RESERVED_WORD);
     insertGlobal("catch", RESERVED_WORD);
     insertGlobal("throw", RESERVED_WORD);
 }
示例#2
0
 public void openScope()
 {
     SymbolTableScope new_scope = new SymbolTableScope(cur_scope);
     cur_scope = new_scope;
 }
示例#3
0
 public SymbolTableScope(SymbolTableScope parent)
 {
     this.parent = parent;
     entries = new Hashtable();
     classMembers = new ArrayList();
     globalVariables = new ArrayList();
 }
示例#4
0
 public void closeScope()
 {
     cur_scope = cur_scope.parent;
 }