|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.clef.symtab.SymtabScope
public class SymtabScope
This class represents a single, local scope (e.g., for a procedure or local block).
$Id: SymtabScope.java,v 1.45 2007-08-28 13:34:32 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The primary function of a scope is to maintain a table of (identifier, decl) pairs. A list of the entries in the order they were added to the scope is also maintained for use when C code is generated.
Constructor Summary | |
---|---|
SymtabScope(int depth)
Constructor to create a symbol table scope. |
Method Summary | |
---|---|
SymtabEntry |
addEntry(Declaration decl)
This method adds a new entry to the local symbol table. |
void |
appendChild(SymtabScope child)
Add a child to the scope - represents a nested scope |
SymtabScope |
getOuterScope()
Return the scope containing this scope. |
int |
getScopeDepth()
Return the depth of the scope in the scope tree. |
int |
getScopeNumber()
Return a unique integer that represents this scope. |
Vector<SymtabEntry> |
lookup(java.lang.String id)
This method looks for the identifier in this scope. |
SymtabEntry |
lookupSymbol(Declaration d)
Look for a declaration in this scope. |
java.util.Enumeration<SymtabEntry> |
orderedElements()
Returns an enumeration of symbols in the scope - in the order that the symbols were added to the scope. |
void |
reorder(SymtabEntry se)
Make this entry the last in the ordered list. |
SymtabEntry |
replaceEntry(Declaration oldDecl,
Declaration newDecl)
This method replaces an existing declaration in an existing entry of the local symbol table. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SymtabScope(int depth)
depth
- the current nesting depth of the scope blockMethod Detail |
---|
public final int getScopeNumber()
public final int getScopeDepth()
public final Vector<SymtabEntry> lookup(java.lang.String id)
id
- the name of a symbol
public final SymtabEntry lookupSymbol(Declaration d)
public final SymtabEntry addEntry(Declaration decl)
SymtabEntry
.
decl
- the declaration for the symbol
public final SymtabEntry replaceEntry(Declaration oldDecl, Declaration newDecl)
oldDecl
- the old declaration for the symbolnewDecl
- the new declaration for the symbol
null
if not foundpublic final void reorder(SymtabEntry se)
public final SymtabScope getOuterScope()
public final void appendChild(SymtabScope child)
child
- the nested scopepublic final java.util.Enumeration<SymtabEntry> orderedElements()
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 |