|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.prorefactor.treeparser.SymbolScope
public class SymbolScope
For keeping track of PROCEDURE, FUNCTION, and trigger scopes within a 4gl compile unit. Note that scopes are nested. There is the outer program scope, and within it the other types of scopes which may themselves nest trigger scopes. (Trigger scopes may be deeply nested). These scopes are defined Symbol scopes. They have nothing to do with record or frame scoping!
Field Summary | |
---|---|
protected java.util.ArrayList<Symbol> |
allSymbols
|
protected java.util.Map<java.lang.String,TableBuffer> |
bufferMap
|
protected java.util.ArrayList<Call> |
callList
|
protected java.util.ArrayList<SymbolScope> |
childScopes
|
protected java.util.Map<java.lang.String,FieldLevelWidgetI> |
fieldLevelWidgetMap
|
protected SymbolScope |
parentScope
|
protected Block |
rootBlock
|
protected SymbolScopeRoot |
rootScope
|
protected java.util.Map<java.lang.String,Routine> |
routineMap
|
protected java.util.Map<java.lang.Integer,java.util.Map> |
typeMap
|
protected java.util.Map<Table,TableBuffer> |
unnamedBuffers
|
protected java.util.Map<java.lang.String,Variable> |
variableMap
|
Constructor Summary | |
---|---|
|
SymbolScope()
Only to be used for persistence/serialization. |
protected |
SymbolScope(SymbolScope parentScope)
Only Scope and derivatives may create a Scope object. |
Method Summary | ||
---|---|---|
void |
add(FieldLevelWidgetI widget)
Add a FieldLevelWidget for names lookup. |
|
void |
add(Routine routine)
Add a Routine for call handling. |
|
void |
add(Symbol symbol)
Add a Symbol for names lookup. |
|
void |
add(TableBuffer tableBuffer)
Add a TableBuffer for names lookup. |
|
void |
add(Variable var)
Add a Variable for names lookup. |
|
SymbolScope |
addScope()
Add a new scope to this scope. |
|
TableBuffer |
defineBuffer(java.lang.String name,
Table table)
Define a new BufferSymbol. |
|
int |
depth()
Get the integer "depth" of the scope. |
|
java.util.ArrayList<Symbol> |
getAllSymbols()
Get a *copy* of the list of all symbols in this scope |
|
|
getAllSymbols(java.lang.Class<T> klass)
Get a list of this scope's symbols which match a given class |
|
java.util.ArrayList<Symbol> |
getAllSymbolsDeep()
Get a list of this scope's symbols, and all symbols of all descendant scopes. |
|
|
getAllSymbolsDeep(java.lang.Class<T> klass)
Get a list of this scope's symbols, and all symbols of all descendant scopes, which match a given class. |
|
java.util.Set |
getBufferSet()
Get the set of named buffers |
|
TableBuffer |
getBufferSymbol(java.lang.String inName)
Given a name, find a BufferSymbol (or create if necessary for unnamed buffer). |
|
java.util.ArrayList<Call> |
getCallList()
|
|
java.util.ArrayList<SymbolScope> |
getChildScopes()
Get a *copy* of the list of child scopes |
|
java.util.ArrayList<SymbolScope> |
getChildScopesDeep()
Get a list of all child scopes, and their child scopes, etc |
|
SymbolScope |
getParentScope()
|
|
Block |
getRootBlock()
|
|
SymbolScopeRoot |
getRootScope()
|
|
TableBuffer |
getUnnamedBuffer(Table table)
Get or create the unnamed buffer for a schema table. |
|
java.util.Collection<Variable> |
getVariables()
Get the Variables. |
|
boolean |
hasRoutine(java.lang.String name)
Answer whether the scope has a Routine named by param. |
|
boolean |
isActiveIn(SymbolScope theScope)
Is this scope active in the input scope? In other words, is this scope the input scope, or any of the parents of the input scope? |
|
TableBuffer |
lookupBuffer(java.lang.String inName)
Lookup a named record/table buffer in this scope or an enclosing scope. |
|
Dataset |
lookupDataset(java.lang.String name)
|
|
Datasource |
lookupDatasource(java.lang.String name)
|
|
FieldLevelWidgetI |
lookupFieldLevelWidget(java.lang.String inName)
Lookup a FieldLevelWidget in this scope or an enclosing scope. |
|
Query |
lookupQuery(java.lang.String name)
|
|
Routine |
lookupRoutine(java.lang.String name)
|
|
Stream |
lookupStream(java.lang.String name)
|
|
Symbol |
lookupSymbol(java.lang.Integer symbolType,
java.lang.String name)
|
|
Symbol |
lookupSymbolLocally(java.lang.Integer symbolType,
java.lang.String name)
|
|
TableBuffer |
lookupTableOrBufferSymbol(java.lang.String inName)
Lookup a Table or a BufferSymbol, schema table first. |
|
TableBuffer |
lookupTempTable(java.lang.String name)
|
|
Variable |
lookupVariable(java.lang.String inName)
Lookup a Variable in this scope or an enclosing scope. |
|
Widget |
lookupWidget(int widgetType,
java.lang.String name)
Lookup a Widget based on TokenType (FRAME, BUTTON, etc) and the name in this scope or enclosing scope. |
|
void |
registerCall(Call call)
|
|
void |
setRootBlock(Block block)
|
|
void |
writeXferBytes(DataXferStream out)
Implement Xferable. |
|
void |
writeXferSchema(DataXferStream out)
Implement Xferable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.ArrayList<Symbol> allSymbols
protected java.util.ArrayList<Call> callList
protected java.util.ArrayList<SymbolScope> childScopes
protected Block rootBlock
protected java.util.Map<java.lang.String,TableBuffer> bufferMap
protected java.util.Map<java.lang.String,FieldLevelWidgetI> fieldLevelWidgetMap
protected java.util.Map<java.lang.String,Routine> routineMap
protected java.util.Map<Table,TableBuffer> unnamedBuffers
protected java.util.Map<java.lang.Integer,java.util.Map> typeMap
protected java.util.Map<java.lang.String,Variable> variableMap
protected SymbolScope parentScope
protected SymbolScopeRoot rootScope
Constructor Detail |
---|
public SymbolScope()
protected SymbolScope(SymbolScope parentScope)
parentScope
- null if called by the SymbolScopeRoot constructor.Method Detail |
---|
public void add(FieldLevelWidgetI widget)
public void add(Routine routine)
public void add(TableBuffer tableBuffer)
public void add(Variable var)
public void add(Symbol symbol)
public SymbolScope addScope()
public TableBuffer defineBuffer(java.lang.String name, Table table)
name
- Input "" for a default or unnamed buffer, otherwise the "named buffer" name.public int depth()
public java.util.ArrayList<Symbol> getAllSymbols()
public <T extends Symbol> java.util.ArrayList<T> getAllSymbols(java.lang.Class<T> klass)
public java.util.ArrayList<Symbol> getAllSymbolsDeep()
public <T extends Symbol> java.util.ArrayList<T> getAllSymbolsDeep(java.lang.Class<T> klass)
public java.util.Set getBufferSet()
public TableBuffer getBufferSymbol(java.lang.String inName)
public java.util.ArrayList<Call> getCallList()
public java.util.ArrayList<SymbolScope> getChildScopes()
public java.util.ArrayList<SymbolScope> getChildScopesDeep()
public SymbolScope getParentScope()
public Block getRootBlock()
public SymbolScopeRoot getRootScope()
public TableBuffer getUnnamedBuffer(Table table)
public java.util.Collection<Variable> getVariables()
public boolean hasRoutine(java.lang.String name)
name
- - the name of the routine.public boolean isActiveIn(SymbolScope theScope)
public TableBuffer lookupBuffer(java.lang.String inName)
inName
- String buffer name.
public Dataset lookupDataset(java.lang.String name)
public Datasource lookupDatasource(java.lang.String name)
public FieldLevelWidgetI lookupFieldLevelWidget(java.lang.String inName)
public Query lookupQuery(java.lang.String name)
public Routine lookupRoutine(java.lang.String name)
public Stream lookupStream(java.lang.String name)
public Symbol lookupSymbol(java.lang.Integer symbolType, java.lang.String name)
public Symbol lookupSymbolLocally(java.lang.Integer symbolType, java.lang.String name)
public TableBuffer lookupTableOrBufferSymbol(java.lang.String inName)
public TableBuffer lookupTempTable(java.lang.String name)
public Variable lookupVariable(java.lang.String inName)
inName
- The string field name to lookup.
public Widget lookupWidget(int widgetType, java.lang.String name)
public void registerCall(Call call)
public void setRootBlock(Block block)
public void writeXferBytes(DataXferStream out) throws java.io.IOException
writeXferBytes
in interface Xferable
java.io.IOException
public void writeXferSchema(DataXferStream out) throws java.io.IOException
writeXferSchema
in interface Xferable
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |