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
public class Program extends Expression implements IProgram
An expression representing a Program:- See Also:
IGosuParser
-
-
Field Summary
-
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 Constructor Description Program()
Constructs a Program given an ISymbolTable instance.
-
Method Summary
-
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
-
-
-
-
Method Detail
-
getMainStatement
public Statement getMainStatement()
- Specified by:
getMainStatement
in interfaceIProgram
-
setMainStatement
public void setMainStatement(Statement mainStatement)
-
getFunctions
public Map getFunctions()
- Specified by:
getFunctions
in interfaceIProgram
-
setFunctions
public void setFunctions(Map functions)
-
getDeclaredReturnType
public IType getDeclaredReturnType()
-
setDeclaredReturnType
public void setDeclaredReturnType(IType declaredReturnType)
-
evaluate
public Object evaluate()
- Specified by:
evaluate
in interfaceIExpression
- Overrides:
evaluate
in classExpression
-
addParseWarning
public void addParseWarning(IParseIssue warning)
- Specified by:
addParseWarning
in interfaceIParsedElement
- Overrides:
addParseWarning
in classParsedElement
-
getLocation
public ParseTree getLocation()
- Specified by:
getLocation
in interfaceIParsedElement
- Overrides:
getLocation
in classParsedElement
- Returns:
- The location of this parsed element within the source.
-
toString
public String toString()
Description copied from class:Expression
Subclasses should return a String representing the parsed expression.- Specified by:
toString
in classExpression
-
getReturnType
public IType 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
public List<IParseIssue> getParseIssues()
- Specified by:
getParseIssues
in interfaceIParsedElement
- Overrides:
getParseIssues
in classParsedElement
-
getImmediateParseIssues
public List<IParseIssue> getImmediateParseIssues()
- Specified by:
getImmediateParseIssues
in interfaceIParsedElement
- Overrides:
getImmediateParseIssues
in classParsedElement
-
hasParseExceptions
public boolean hasParseExceptions()
- Specified by:
hasParseExceptions
in interfaceIParsedElement
- Overrides:
hasParseExceptions
in classParsedElement
-
getParseExceptions
public List<IParseIssue> getParseExceptions()
- Specified by:
getParseExceptions
in interfaceIParsedElement
- Overrides:
getParseExceptions
in classParsedElement
-
getParseWarnings
public List<IParseIssue> getParseWarnings()
- Specified by:
getParseWarnings
in interfaceIParsedElement
- Overrides:
getParseWarnings
in classParsedElement
-
hasParseWarnings
public boolean hasParseWarnings()
- Specified by:
hasParseWarnings
in interfaceIParsedElement
- Overrides:
hasParseWarnings
in classParsedElement
-
-