1package com.jogamp.gluegen.cgram;
3import java.util.Vector;
4import java.util.Hashtable;
5import java.util.Enumeration;
11 private final Vector<String> scopeStack;
14 private final Hashtable<String, TNode> symTable;
17 scopeStack =
new Vector<String>(10);
18 symTable =
new Hashtable<String, TNode>(533);
26 scopeStack.addElement(s);
33 final int size = scopeStack.size();
35 scopeStack.removeElementAt(size - 1);
41 final StringBuilder buf =
new StringBuilder(100);
43 final Enumeration<String> e = scopeStack.elements();
44 while(e.hasMoreElements()) {
49 buf.append(e.nextElement().toString());
51 return buf.toString();
66 if(scope ==
null || scope.length() > 0)
67 return scope +
"::" + name;
74 final int index = scopeName.lastIndexOf(
"::");
76 return scopeName.substring(0,index);
78 if (scopeName.length() > 0) {
93 return symTable.get(scopedName);
107 while (tnode ==
null && scope !=
null) {
110 tnode = symTable.get(scopedName);
119 final StringBuilder buff =
new StringBuilder(300);
121 "\nDefinedSymbols:\n");
122 final Enumeration<String> ke = symTable.keys();
123 final Enumeration<TNode> ve = symTable.elements();
124 while(ke.hasMoreElements()) {
125 buff.append(ke.nextElement().toString());
129 return buff.toString();
String addScopeToName(final String scope, final String name)
given a name for a type, append it with the given scope.
void popScope()
pop the last scope off the scope stack.
TNode add(final String name, final TNode node)
add a node to the table with it's key as the current scope and the name
TNode lookupNameInCurrentScope(final String name)
lookup an unscoped name in the table by prepending the current scope.
String addCurrentScopeToName(final String name)
given a name for a type, append it with the current scope.
TNode lookupScopedName(final String scopedName)
lookup a fully scoped name in the symbol table
String removeOneLevelScope(final String scopeName)
remove one level of scope from name MBZ
void pushScope(final String s)
push a new scope onto the scope stack.
String toString()
convert this table to a string
String currentScopeAsString()
return the current scope as a string
Class TNode is an implementation of the AST interface and adds many useful features:
static String getNameForType(final int t)
converts an int tree token type to a name.