public final class Scope extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Scope.Frame
A call frame, created from a scope, stores the arguments and local variables in a "stack frame" (sic).
|
Constructor and Description |
---|
Scope(Scope scope,
String... parameters)
Creates a new scope with a list of parameters.
|
Modifier and Type | Method and Description |
---|---|
Scope.Frame |
createFrame(Scope.Frame frame)
Creates a frame by copying values up to the number of parameters.
|
void |
declareParameter(String name)
Declares a parameter.
|
Integer |
declareVariable(String name)
Declares a local variable.
|
boolean |
equals(Object o) |
int |
getArgCount()
Gets the (maximum) number of arguments this script expects.
|
Integer |
getHoisted(int symbol)
Gets the hoisted index of a given symbol, ie the target index of a symbol in a child frame.
|
String[] |
getLocalVariables()
Gets this script local variable, i.e. symbols assigned to local variables excluding hoisted variables.
|
String[] |
getParameters()
Gets this script parameters, i.e. symbols assigned before creating local variables.
|
Integer |
getSymbol(String name)
Checks whether an identifier is a local variable or argument, ie a symbol.
|
String[] |
getSymbols()
Gets this script symbols names, i.e. parameters and local variables.
|
int |
hashCode() |
boolean |
isHoistedSymbol(int symbol)
Checks whether a given symbol is hoisted.
|
public Integer getSymbol(String name)
name
- the symbol namepublic boolean isHoistedSymbol(int symbol)
symbol
- the symbol numberpublic void declareParameter(String name)
This method creates an new entry in the symbol map.
name
- the parameter namepublic Integer declareVariable(String name)
This method creates an new entry in the symbol map.
name
- the variable namepublic Scope.Frame createFrame(Scope.Frame frame)
This captures the hoisted variables values.
frame
- the caller framepublic Integer getHoisted(int symbol)
symbol
- the symbol indexpublic int getArgCount()
public String[] getSymbols()
public String[] getParameters()
public String[] getLocalVariables()
Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.