Package gw.internal.gosu.parser
Class Symbol
java.lang.Object
gw.internal.gosu.parser.Symbol
- All Implemented Interfaces:
IFunctionSymbol
,IHasType
,IReducedSymbol
,ISymbol
- Direct Known Subclasses:
AbstractDynamicSymbol
,AmbiguousSymbol
,CapturedSymbol
,CommonSymbolsScope.LockedDownSymbol
,CompileTimeExpressionParser.CompileTimeFieldSymbol
,QueryPathRootSymbol
,ReadOnlySymbol
,ReducedSymbol.SyntheticSymbol
,TemplateGenerator.LockedDownSymbol
,ThisSymbol
,TypedSymbol
Base class for all symbols in the symbol table.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
private IExpression
protected int
private ModifierInfo
private String
protected IStackProvider
protected ISymbolTable
private IType
protected Object
private MutableBoolean
static final IStackProvider
-
Constructor Summary
ConstructorsConstructorDescriptionSymbol
(String strName, IType type, IStackProvider stackProvider) Symbol
(String strName, IType type, IStackProvider stackProvider, Object value) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
assignIndex
(IScope scope) protected int
assignIndexInStack
(IScope scope) boolean
boolean
The symbol's default value e.g., a default parameter value for a function.Returns the Symbol's optional display name.int
getIndex()
Creates a copy of this symbol without the value so that the empty symbol can be stored.int
Returns the modifiers for this function symbolgetName()
Returns the Symbol's name.Returns a description of arguments of the form ( < argName1 >, < argName2 >, etc.getType()
Returns the Symbol's type.getValue()
Returns the value assigned to this Symbol.private Object
boolean
boolean
Invokes function.boolean
boolean
boolean
isFinal()
boolean
boolean
isHide()
boolean
boolean
boolean
isLocal()
boolean
boolean
boolean
boolean
isPublic()
boolean
boolean
Returns true if the value of this function symbol is stored on the stack as a variableboolean
isStatic()
boolean
boolean
Returns true if this symbol is writable.makeCapturedSymbol
(String strName, ISymbolTable symbolTable, IScope scope) void
renameAsErrantDuplicate
(int iIndex) void
void
setAbstract
(boolean bAbstract) void
setClassMember
(boolean bClassMember) void
setDefaultValueExpression
(IExpression defaultValue) void
setDynamicSymbolTable
(ISymbolTable symTable) Assigns an optional symbol table so that the symbol can get/set its value dynamically e.g., via ThreadLocalSymbolTable.void
setFinal
(boolean bFinal) void
setHide
(boolean bHide) void
setIndex
(int i) void
setInternal
(boolean bInternal) void
setModifierInfo
(IModifierInfo modifiers) void
setModifiers
(int modifiers) protected void
void
setOverride
(boolean bOverride) void
setPrivate
(boolean bPrivate) void
setProtected
(boolean bProtected) void
setPublic
(boolean bPublic) void
setReified
(boolean bReified) void
setStatic
(boolean bStatic) void
Sets the Symbol's type.void
Assigns a value to this Symbol.void
setValueDirectly
(Object value) private void
setValueFromSymbolTable
(Object value) void
setValueIsBoxed
(boolean b) Indicates that this symbol should use a reference rather than storing its value directly.toString()
-
Field Details
-
MEMBER_STACK_PROVIDER
-
_name
-
_type
-
_value
-
_defaultValue
-
_iIndex
protected int _iIndex -
_bGlobal
protected boolean _bGlobal -
_stackProvider
-
_symbolTable
-
_valueIsBoxed
-
_modifiers
-
-
Constructor Details
-
Symbol
-
Symbol
-
Symbol
-
Symbol
-
Symbol
-
-
Method Details
-
setDynamicSymbolTable
Description copied from interface:ISymbol
Assigns an optional symbol table so that the symbol can get/set its value dynamically e.g., via ThreadLocalSymbolTable.- Specified by:
setDynamicSymbolTable
in interfaceISymbol
-
hasDynamicSymbolTable
public boolean hasDynamicSymbolTable()- Specified by:
hasDynamicSymbolTable
in interfaceISymbol
-
getDynamicSymbolTable
- Specified by:
getDynamicSymbolTable
in interfaceISymbol
-
assignIndex
-
assignIndexInStack
-
getName
Returns the Symbol's name.- Specified by:
getName
in interfaceIReducedSymbol
- Specified by:
getName
in interfaceISymbol
-
getDisplayName
Returns the Symbol's optional display name. If a display name is not assigned, returns the symbol's name.- Specified by:
getDisplayName
in interfaceIReducedSymbol
- Specified by:
getDisplayName
in interfaceISymbol
-
getFullDescription
- Specified by:
getFullDescription
in interfaceIReducedSymbol
-
renameAsErrantDuplicate
public void renameAsErrantDuplicate(int iIndex) -
getType
Returns the Symbol's type. -
setType
Sets the Symbol's type. -
getValue
Returns the value assigned to this Symbol. -
getValueFromSymbolTable
-
setValue
Assigns a value to this Symbol. -
getDefaultValueExpression
Description copied from interface:ISymbol
The symbol's default value e.g., a default parameter value for a function.- Specified by:
getDefaultValueExpression
in interfaceIReducedSymbol
- Specified by:
getDefaultValueExpression
in interfaceISymbol
-
setDefaultValueExpression
- Specified by:
setDefaultValueExpression
in interfaceISymbol
-
isStackSymbol
public boolean isStackSymbol()Description copied from interface:IFunctionSymbol
Returns true if the value of this function symbol is stored on the stack as a variable- Specified by:
isStackSymbol
in interfaceIFunctionSymbol
-
setValueFromSymbolTable
-
getValueDirectly
-
setValueDirectly
-
invoke
Invokes function.- Specified by:
invoke
in interfaceIFunctionSymbol
- Parameters:
args
- An array of arguments to forward to the function.
-
getLightWeightReference
Description copied from interface:ISymbol
Creates a copy of this symbol without the value so that the empty symbol can be stored.- Specified by:
getLightWeightReference
in interfaceISymbol
-
isImplicitlyInitialized
public boolean isImplicitlyInitialized() -
isWritable
public boolean isWritable()Description copied from interface:ISymbol
Returns true if this symbol is writable. An example of a symbol that is not writable is a readonly Property referenced as a symbol in a Gosu class.- Specified by:
isWritable
in interfaceISymbol
-
equals
-
getSignatureDescription
Description copied from interface:IFunctionSymbol
Returns a description of arguments of the form ( < argName1 >, < argName2 >, etc. ) appropriate for display in a source editor ui.- Specified by:
getSignatureDescription
in interfaceIFunctionSymbol
-
getIndex
public int getIndex()- Specified by:
getIndex
in interfaceIReducedSymbol
- Specified by:
getIndex
in interfaceISymbol
-
isClassMember
public boolean isClassMember() -
setClassMember
public void setClassMember(boolean bClassMember) -
isStatic
public boolean isStatic()- Specified by:
isStatic
in interfaceIReducedSymbol
-
setStatic
public void setStatic(boolean bStatic) -
isPrivate
public boolean isPrivate()- Specified by:
isPrivate
in interfaceIReducedSymbol
-
setPrivate
public void setPrivate(boolean bPrivate) -
isInternal
public boolean isInternal()- Specified by:
isInternal
in interfaceIReducedSymbol
-
setInternal
public void setInternal(boolean bInternal) -
isProtected
public boolean isProtected()- Specified by:
isProtected
in interfaceIReducedSymbol
-
setProtected
public void setProtected(boolean bProtected) -
isPublic
public boolean isPublic()- Specified by:
isPublic
in interfaceIReducedSymbol
-
setPublic
public void setPublic(boolean bPublic) -
isAbstract
public boolean isAbstract()- Specified by:
isAbstract
in interfaceIReducedSymbol
-
setAbstract
public void setAbstract(boolean bAbstract) -
isFinal
public boolean isFinal()- Specified by:
isFinal
in interfaceIReducedSymbol
-
setFinal
public void setFinal(boolean bFinal) -
isReified
public boolean isReified()- Specified by:
isReified
in interfaceIReducedSymbol
-
setReified
public void setReified(boolean bReified) -
isOverride
public boolean isOverride() -
setOverride
public void setOverride(boolean bOverride) -
isHide
public boolean isHide() -
setHide
public void setHide(boolean bHide) -
getModifierInfo
- Specified by:
getModifierInfo
in interfaceISymbol
-
setModifierInfo
-
replaceModifierInfo
-
getModifiers
public int getModifiers()Description copied from interface:IFunctionSymbol
Returns the modifiers for this function symbol- Specified by:
getModifiers
in interfaceIFunctionSymbol
- Specified by:
getModifiers
in interfaceIReducedSymbol
-
getAnnotations
- Specified by:
getAnnotations
in interfaceIReducedSymbol
-
getScriptPart
- Specified by:
getScriptPart
in interfaceIReducedSymbol
-
getGosuClass
- Specified by:
getGosuClass
in interfaceIReducedSymbol
-
hasTypeVariables
public boolean hasTypeVariables()- Specified by:
hasTypeVariables
in interfaceIReducedSymbol
-
setModifiers
public void setModifiers(int modifiers) -
toString
-
canBeCaptured
public boolean canBeCaptured()- Specified by:
canBeCaptured
in interfaceISymbol
-
makeCapturedSymbol
- Specified by:
makeCapturedSymbol
in interfaceISymbol
-
setIndex
public void setIndex(int i) -
setValueIsBoxed
public void setValueIsBoxed(boolean b) Description copied from interface:ISymbol
Indicates that this symbol should use a reference rather than storing its value directly.- Specified by:
setValueIsBoxed
in interfaceISymbol
-
isValueBoxed
public boolean isValueBoxed()- Specified by:
isValueBoxed
in interfaceIReducedSymbol
- Specified by:
isValueBoxed
in interfaceISymbol
-
setName
-
isLocal
public boolean isLocal() -
isFromJava
public boolean isFromJava()- Specified by:
isFromJava
in interfaceIFunctionSymbol
- Returns:
- true if this function symbol came from a java superclass
-
getSymbolClass
- Specified by:
getSymbolClass
in interfaceIReducedSymbol
-
createReducedSymbol
- Specified by:
createReducedSymbol
in interfaceISymbol
-