Class Program
java.lang.Object
gw.internal.gosu.parser.ParsedElement
gw.internal.gosu.parser.Expression
gw.internal.gosu.parser.expressions.Program
- All Implemented Interfaces:
IProgram
,IExpression
,IHasType
,IParsedElement
An expression representing a Program:
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IType
private Map<String,
IDynamicFunctionSymbol> private Statement
Fields inherited from class gw.internal.gosu.parser.Expression
_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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParseWarning
(IParseIssue warning) evaluate()
Evaluates this Expression and returns the result.findDeclaringStatement
(IParsedElement element, String identifierName) <E extends IParsedElement>
booleangetContainedParsedElementsByType
(Class<E> parsedElementType, List<E> listResults) Find all the parsed elements of a given type contained within this parsed element.boolean
boolean
boolean
void
setDeclaredReturnType
(IType declaredReturnType) void
setFunctions
(Map functions) void
setMainStatement
(Statement mainStatement) toString()
Subclasses should return a String representing the parsed expression.Methods inherited from class gw.internal.gosu.parser.Expression
evaluate, getContextType, getType, getTypeImpl, isNullSafe, isUnchecked, setType
Methods inherited from class gw.internal.gosu.parser.ParsedElement
addExceptionsFrom, addParseException, addParseException, addParseException, addParseExceptions, addParseIssues, addParseWarning, addParseWarnings, addToken, adjustColumn, adjustLineNum, assignTokens, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, compactParseTree, findAncestorParsedElementByType, findLineNumberOfDeclaration, findRootParsedElement, getAnnotations, getColumn, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getEnclosingFeatureInfo, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getLineNum, getModule, getParent, getQualifyingEnclosingTypeInfo, getTokens, hasImmediateParseIssue, hasImmediateParseWarning, hasImmediateParseWarnings, hasParseException, hasParseIssue, hasParseIssues, hasParseWarning, 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.IExpression
evaluate, getContextType, isNullSafe, isUnchecked
Methods inherited from interface gw.lang.parser.IParsedElement
addExceptionsFrom, addParseException, addParseException, addParseWarning, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, findAncestorParsedElementByType, findRootParsedElement, getColumn, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getLineNum, getModule, getParent, getTokens, hasImmediateParseIssue, hasImmediateParseWarnings, hasParseException, hasParseIssue, hasParseIssues, hasParseWarning, isCompileTimeConstant, isSuppressed, isSynthetic, setLocation, setParent, visit
-
Field Details
-
_mainStatement
-
_functions
-
_declaredReturnType
-
-
Constructor Details
-
Program
public Program()Constructs a Program given an ISymbolTable instance.
-
-
Method Details
-
getMainStatement
- Specified by:
getMainStatement
in interfaceIProgram
-
setMainStatement
-
getFunctions
- Specified by:
getFunctions
in interfaceIProgram
-
setFunctions
-
getDeclaredReturnType
-
setDeclaredReturnType
-
evaluate
Description copied from interface:IExpression
Evaluates this Expression and returns the result.- Specified by:
evaluate
in interfaceIExpression
- Overrides:
evaluate
in classExpression
-
addParseWarning
- Specified by:
addParseWarning
in interfaceIParsedElement
- Overrides:
addParseWarning
in classParsedElement
-
getLocation
- Specified by:
getLocation
in interfaceIParsedElement
- Overrides:
getLocation
in classParsedElement
- Returns:
- The location of this parsed element within the source.
-
toString
Description copied from class:Expression
Subclasses should return a String representing the parsed expression.- Specified by:
toString
in classExpression
-
getReturnType
- Specified by:
getReturnType
in interfaceIParsedElement
- Overrides:
getReturnType
in classExpression
-
hasContent
public boolean hasContent()- Specified by:
hasContent
in interfaceIProgram
-
getContainedParsedElementsByType
public <E extends IParsedElement> boolean getContainedParsedElementsByType(Class<E> parsedElementType, List<E> listResults) Description copied from class:ParsedElement
Find all the parsed elements of a given type contained within this parsed element.- Specified by:
getContainedParsedElementsByType
in interfaceIParsedElement
- Overrides:
getContainedParsedElementsByType
in classParsedElement
- Parameters:
parsedElementType
- The type of parsed element to find.listResults
- A list of all the contained parsed elements matching the specified type. Can be null if you are only interested in whether or not parsedElementType exists in this element.- Returns:
- True iff one or more parseElementType are found.
-
findDeclaringStatement
public IParsedElementWithAtLeastOneDeclaration findDeclaringStatement(IParsedElement element, String identifierName) - Specified by:
findDeclaringStatement
in interfaceIParsedElement
- Overrides:
findDeclaringStatement
in classParsedElement
-
getParseIssues
- Specified by:
getParseIssues
in interfaceIParsedElement
- Overrides:
getParseIssues
in classParsedElement
-
getImmediateParseIssues
- Specified by:
getImmediateParseIssues
in interfaceIParsedElement
- Overrides:
getImmediateParseIssues
in classParsedElement
-
hasParseExceptions
public boolean hasParseExceptions()- Specified by:
hasParseExceptions
in interfaceIParsedElement
- Overrides:
hasParseExceptions
in classParsedElement
-
getParseExceptions
- Specified by:
getParseExceptions
in interfaceIParsedElement
- Overrides:
getParseExceptions
in classParsedElement
-
getParseWarnings
- Specified by:
getParseWarnings
in interfaceIParsedElement
- Overrides:
getParseWarnings
in classParsedElement
-
hasParseWarnings
public boolean hasParseWarnings()- Specified by:
hasParseWarnings
in interfaceIParsedElement
- Overrides:
hasParseWarnings
in classParsedElement
-