|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.uned.compiler.semantic.symbol.ScopeManager
public class ScopeManager
Gestor de ámbitos. Esta clase se encarga de gestionar los objetos de tipo Scope mediante una pila. Cuando se crea un Scope este se apila y al salir del ámbito (releaseScope()) se desapila. Esta clase no debe ser modificada por el estudiante.
Constructor Summary | |
---|---|
ScopeManager()
Constructor for Scope. |
Method Summary | |
---|---|
boolean |
containsSymbol(java.lang.String name)
Indicates whether a symbol is contained witin the scope stack. |
boolean |
containsSymbol(SymbolIF symbol)
Indicates whether a symbol is contained witin the scope stack. |
Scope |
createScope(java.lang.String name)
Creates a new scope and adds it to the scope stack. |
boolean |
equals(java.lang.Object other)
Compares this object with another one. |
java.util.List |
getAllScopes()
Returns all scopes witin created during the compilation process. |
java.util.List |
getCurrentScopes()
Returns all scopes witin the stack. |
ScopeIF |
getParentScope()
Returns the parent scope. |
ScopeIF |
getScope()
Returns the current scope. |
ScopeIF |
getScope(int scopeLevel)
Returns a scope. |
int |
hashCode()
Returns a hash code for the object. |
void |
releaseScope()
Release the current scope dropping from the scope stack. |
SymbolIF |
searchSymbol(java.lang.String name)
Looks up a symbol accross all scopes within the stack. |
java.lang.String |
toString()
Return a string representing the object. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ScopeManager()
Method Detail |
---|
public boolean containsSymbol(java.lang.String name)
containsSymbol
in interface ScopeManagerIF
name
- The symbol name to search.
public boolean containsSymbol(SymbolIF symbol)
containsSymbol
in interface ScopeManagerIF
symbol
- The symbol to search.
public Scope createScope(java.lang.String name)
createScope
in interface ScopeManagerIF
the
- name token that opens the scope.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the other object.
public java.util.List getAllScopes()
getAllScopes
in interface ScopeManagerIF
public java.util.List getCurrentScopes()
getCurrentScopes
in interface ScopeManagerIF
public ScopeIF getParentScope()
getParentScope
in interface ScopeManagerIF
public ScopeIF getScope()
getScope
in interface ScopeManagerIF
public ScopeIF getScope(int scopeLevel)
getScope
in interface ScopeManagerIF
scopeLevel
- The index of the scope within the scope stack.
public int hashCode()
hashCode
in class java.lang.Object
public void releaseScope()
releaseScope
in interface ScopeManagerIF
public SymbolIF searchSymbol(java.lang.String name)
searchSymbol
in interface ScopeManagerIF
name
- The sumbol name.
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |