Package gw.internal.gosu.parser
Class Expression
- java.lang.Object
-
- gw.internal.gosu.parser.ParsedElement
-
- gw.internal.gosu.parser.Expression
-
- All Implemented Interfaces:
IExpression,IHasType,IParsedElement
- Direct Known Subclasses:
AnnotationUseSiteTargetClause,ArgumentListClause,ArithmeticExpression,ArrayAccess,BadInitializerExpression,BeanMethodCallExpression,BinaryExpression,BindingExpression,BlockExpression,BlockInvocation,CaseClause,ClassDeclaration,CollectionInitializerExpression,ConditionalTernaryExpression,DefaultArgLiteral,DirectiveExpression,EvalExpression,FeatureLiteral,Identifier,InterfacesClause,Literal,LocalVarDeclaration,MapAccess,MapInitializerExpression,MemberAccess,MethodCallExpression,ModifierListClause,NameInDeclaration,NewExpression,ObjectInitializerExpression,ParameterListClause,ParenthesizedExpression,Program,StaticTypeOfExpression,SuperAccess,SuperTypeClause,TemplateStringLiteral,TypeAsExpression,TypeIsExpression,TypeOfExpression,TypeParameterListClause,TypeVariableDefinition,TypeVariableListClause,UnaryExpression,UnaryNotPlusMinusExpression
public abstract class Expression extends ParsedElement implements IExpression
The root class for all Expressions represented in a parse tree as specified in the Gosu grammar.- See Also:
IGosuParser
-
-
Field Summary
Fields Modifier and Type Field Description protected IType_type-
Fields inherited from class gw.internal.gosu.parser.ParsedElement
_tokens, UNDEF_FILE, UNDEF_FUNCTION, UNDEF_MODULE
-
Fields inherited from interface gw.lang.parser.IExpression
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description Expression()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Objectevaluate()Objectevaluate(IExternalSymbolMap externalSymbols)ITypegetContextType()Context type is the type this literal value evaluates as in the context of a containing expression e.g., given the expression, n == "42", the literal "42" is always converted to a Number.ITypegetReturnType()ITypegetType()Returns this Expression's IType.protected ITypegetTypeImpl()booleanisNullSafe()booleanisUnchecked()voidsetType(IType type)Sets this Expression's IType.abstract StringtoString()Subclasses should return a String representing the parsed expression.-
Methods inherited from class gw.internal.gosu.parser.ParsedElement
addExceptionsFrom, addParseException, addParseException, addParseException, addParseExceptions, addParseIssues, addParseWarning, addParseWarning, addParseWarnings, addToken, adjustColumn, adjustLineNum, assignTokens, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, compactParseTree, findAncestorParsedElementByType, findDeclaringStatement, findLineNumberOfDeclaration, findRootParsedElement, getAnnotations, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getEnclosingFeatureInfo, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getQualifyingEnclosingTypeInfo, getTokens, hasImmediateParseIssue, hasImmediateParseWarning, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, initEmptyParseTree, initLocation, isCompileTimeConstant, isSuppressed, isSuppressed, isSynthetic, makeDoubleValue, makeFloatValue, makeInteger, makeLong, removeParseException, removeParseWarning, removeParseWarningRecursively, setGosuProgram, setLineNum, setLocation, setParent, setSynthetic, shouldClearParseInfo, visit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.parser.IParsedElement
addExceptionsFrom, addParseException, addParseException, addParseWarning, addParseWarning, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, findAncestorParsedElementByType, findDeclaringStatement, findRootParsedElement, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getTokens, hasImmediateParseIssue, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, isCompileTimeConstant, isSuppressed, isSynthetic, setLocation, setParent, visit
-
-
-
-
Field Detail
-
_type
protected IType _type
-
-
Method Detail
-
getType
public IType getType()
Returns this Expression's IType.
-
getTypeImpl
protected IType getTypeImpl()
-
setType
public void setType(IType type)
Sets this Expression's IType.
-
isNullSafe
public boolean isNullSafe()
- Specified by:
isNullSafein interfaceIExpression
-
isUnchecked
public boolean isUnchecked()
- Specified by:
isUncheckedin interfaceIExpression
-
evaluate
public Object evaluate()
- Specified by:
evaluatein interfaceIExpression
-
evaluate
public Object evaluate(IExternalSymbolMap externalSymbols)
- Specified by:
evaluatein interfaceIExpression
-
getReturnType
public IType getReturnType()
- Specified by:
getReturnTypein interfaceIParsedElement
-
getContextType
public IType getContextType()
Context type is the type this literal value evaluates as in the context of a containing expression e.g., given the expression, n == "42", the literal "42" is always converted to a Number. This feature is most useful for source code tools that provide source-sensitive help (e.g., rule composer).- Specified by:
getContextTypein interfaceIExpression
-
-