Package gw.internal.gosu.parser
Class ParsedElement
java.lang.Object
gw.internal.gosu.parser.ParsedElement
- All Implemented Interfaces:
IParsedElement
- Direct Known Subclasses:
Expression,Statement
ParsedElement is the root class for all non-terminal elements represented in
a parse tree i.e., all non-terminal expressions and statements derive either
directly or indirectly from this class.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddParseException(IFullParserState parserState, ResourceKey msgKey, Object... args) voidvoidaddParseException(ResourceKey msgKey, Object... args) voidaddParseExceptions(List<IParseIssue> parseExceptions) voidaddParseIssues(List<IParseIssue> parseIssues) voidaddParseWarning(IParseIssue warning) voidaddParseWarning(ResourceKey msgKey, Object... args) voidaddParseWarnings(List<IParseIssue> parseWarnings) protected voidaddToken(IToken token, IParseTree after) voidadjustColumn(int offset) voidadjustLineNum(int offset) voidassignTokens(List<Token> tokens) voidvoidvoidvoidfindAncestorParsedElementByType(Class... parsedElementClasses) findDeclaringStatement(IParsedElement element, String identifierName) intfindLineNumberOfDeclaration(String identifierName) int<E extends IParsedElement>
booleangetContainedParsedElementsByType(Class<E> parsedElementType, List<E> listResults) Find all the parsed elements of a given type contained within this parsed element.booleangetContainedParsedElementsByTypes(List<IParsedElement> listResults, Class<? extends IParsedElement>... parsedElementTypes) booleangetContainedParsedElementsByTypesWithIgnoreSet(List<IParsedElement> listResults, Set<Class<? extends IParsedElement>> ignoreSet, Class<? extends IParsedElement>... parsedElementTypes) static IFeatureInfogetEnclosingFeatureInfo(Stack<IFeatureInfo> enclosingFeatureInfos) getImmediateParseIssue(ResourceKey errKey) intstatic ITypeInfogetQualifyingEnclosingTypeInfo(Stack<IFeatureInfo> enclosingFeatureInfos) booleanhasImmediateParseIssue(ResourceKey errKey) booleanhasImmediateParseWarning(ResourceKey errKey) booleanbooleanhasParseException(ResourceKey errKey) booleanbooleanbooleanbooleanhasParseWarning(ResourceKey errKey) booleanvoidinitLocation(int offset, int length, int lineNumber, int iColumn, IScriptPartId scriptPart) booleanbooleanisSuppressed(IWarningSuppressor suppressor) booleanisSuppressed(IParseIssue issue) booleanstatic doublemakeDoubleValue(Object obj) Just like makeDouble(), but creates a double primitive value instead of a Double object.static floatmakeFloatValue(Object obj) Just like makeFloat(), but creates a float primitive value instead of a Float object.final IntegermakeInteger(Object obj) static LongremoveParseException(ResourceKey keyToRemove) Removes the specified parse exception or removes them all if the specified exception is null.removeParseWarning(ResourceKey keyToRemove) voidremoveParseWarningRecursively(ResourceKey keyToRemove) voidsetGosuProgram(IGosuProgramInternal gosuProgram) voidsetLineNum(int iLineNum) voidsetLocation(IParseTree location) Specifiy the location of this parsed element within the source.voidsetParent(IParsedElement parent) voidsetSynthetic(boolean bSynthetic) booleanvoidvisit(Consumer<IParsedElement> visitor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gw.lang.parser.IParsedElement
getReturnType
-
Field Details
-
UNDEF_MODULE
- See Also:
-
UNDEF_FUNCTION
- See Also:
-
UNDEF_FILE
- See Also:
-
_tokens
-
-
Method Details
-
getGosuProgram
- Specified by:
getGosuProgramin interfaceIParsedElement
-
setGosuProgram
-
addExceptionsFrom
- Specified by:
addExceptionsFromin interfaceIParsedElement
-
getLocation
- Specified by:
getLocationin interfaceIParsedElement- Returns:
- The location of this parsed element within the source.
-
setLocation
Specifiy the location of this parsed element within the source.- Specified by:
setLocationin interfaceIParsedElement- Parameters:
location- The location of this parsed element within the source.
-
initLocation
public ParseTree initLocation(int offset, int length, int lineNumber, int iColumn, IScriptPartId scriptPart) -
visit
- Specified by:
visitin interfaceIParsedElement
-
initEmptyParseTree
public void initEmptyParseTree() -
hasParseIssues
public boolean hasParseIssues()- Specified by:
hasParseIssuesin interfaceIParsedElement
-
getParseIssues
- Specified by:
getParseIssuesin interfaceIParsedElement
-
getImmediateParseIssues
- Specified by:
getImmediateParseIssuesin interfaceIParsedElement
-
hasParseExceptions
public boolean hasParseExceptions()- Specified by:
hasParseExceptionsin interfaceIParsedElement
-
hasParseException
- Specified by:
hasParseExceptionin interfaceIParsedElement
-
getImmediateParseIssue
- Specified by:
getImmediateParseIssuein interfaceIParsedElement
-
hasImmediateParseIssue
- Specified by:
hasImmediateParseIssuein interfaceIParsedElement
-
hasParseWarning
- Specified by:
hasParseWarningin interfaceIParsedElement
-
addParseWarnings
-
addParseExceptions
-
addParseIssues
-
getParseExceptions
- Specified by:
getParseExceptionsin interfaceIParsedElement
-
addParseException
- Specified by:
addParseExceptionin interfaceIParsedElement
-
addParseException
-
removeParseException
Removes the specified parse exception or removes them all if the specified exception is null. -
removeParseWarning
-
removeParseWarningRecursively
-
getGosuClass
- Specified by:
getGosuClassin interfaceIParsedElement
-
addParseWarning
- Specified by:
addParseWarningin interfaceIParsedElement
-
addParseException
- Specified by:
addParseExceptionin interfaceIParsedElement
-
clearParseExceptions
public void clearParseExceptions()- Specified by:
clearParseExceptionsin interfaceIParsedElement
-
clearParseWarnings
public void clearParseWarnings()- Specified by:
clearParseWarningsin interfaceIParsedElement
-
hasImmediateParseWarnings
public boolean hasImmediateParseWarnings()- Specified by:
hasImmediateParseWarningsin interfaceIParsedElement
-
hasImmediateParseWarning
-
hasParseWarnings
public boolean hasParseWarnings()- Specified by:
hasParseWarningsin interfaceIParsedElement
-
getParseWarnings
- Specified by:
getParseWarningsin interfaceIParsedElement
-
addParseWarning
- Specified by:
addParseWarningin interfaceIParsedElement
-
hasParseIssue
- Specified by:
hasParseIssuein interfaceIParsedElement
-
isSuppressed
-
isSuppressed
- Specified by:
isSuppressedin interfaceIParsedElement
-
getAnnotations
-
isCompileTimeConstant
public boolean isCompileTimeConstant()- Specified by:
isCompileTimeConstantin interfaceIParsedElement
-
getContainedParsedElementsByType
public <E extends IParsedElement> boolean getContainedParsedElementsByType(Class<E> parsedElementType, List<E> listResults) Find all the parsed elements of a given type contained within this parsed element.- Specified by:
getContainedParsedElementsByTypein interfaceIParsedElement- 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.
-
getContainedParsedElementsByTypes
public boolean getContainedParsedElementsByTypes(List<IParsedElement> listResults, Class<? extends IParsedElement>... parsedElementTypes) - Specified by:
getContainedParsedElementsByTypesin interfaceIParsedElement
-
getContainedParsedElementsByTypesWithIgnoreSet
public boolean getContainedParsedElementsByTypesWithIgnoreSet(List<IParsedElement> listResults, Set<Class<? extends IParsedElement>> ignoreSet, Class<? extends IParsedElement>... parsedElementTypes) - Specified by:
getContainedParsedElementsByTypesWithIgnoreSetin interfaceIParsedElement
-
makeInteger
-
makeLong
-
makeDoubleValue
Just like makeDouble(), but creates a double primitive value instead of a Double object. Much more efficient if you don't need the object.- Parameters:
obj- Any double convertible object- Returns:
- The double primitive value.
-
makeFloatValue
Just like makeFloat(), but creates a float primitive value instead of a Float object. Much more efficient if you don't need the object.- Parameters:
obj- Any float convertible object- Returns:
- The float primitive value.
-
compactParseTree
public void compactParseTree() -
clearParseTreeInformation
public void clearParseTreeInformation()- Specified by:
clearParseTreeInformationin interfaceIParsedElement
-
getParent
- Specified by:
getParentin interfaceIParsedElement
-
setParent
- Specified by:
setParentin interfaceIParsedElement
-
getLineNum
public int getLineNum()- Specified by:
getLineNumin interfaceIParsedElement
-
adjustLineNum
public void adjustLineNum(int offset) -
setLineNum
public void setLineNum(int iLineNum) -
getColumn
public int getColumn()- Specified by:
getColumnin interfaceIParsedElement
-
adjustColumn
public void adjustColumn(int offset) -
getFunctionName
- Specified by:
getFunctionNamein interfaceIParsedElement
-
isSynthetic
public boolean isSynthetic()- Specified by:
isSyntheticin interfaceIParsedElement
-
setSynthetic
public void setSynthetic(boolean bSynthetic) -
getModule
- Specified by:
getModulein interfaceIParsedElement
-
getEnclosingFeatureInfo
-
getQualifyingEnclosingTypeInfo
-
findLineNumberOfDeclaration
-
findDeclaringStatement
public IParsedElementWithAtLeastOneDeclaration findDeclaringStatement(IParsedElement element, String identifierName) - Specified by:
findDeclaringStatementin interfaceIParsedElement
-
findRootParsedElement
- Specified by:
findRootParsedElementin interfaceIParsedElement
-
findAncestorParsedElementByType
- Specified by:
findAncestorParsedElementByTypein interfaceIParsedElement- Parameters:
parsedElementClasses- List of statement types to find- Returns:
- The nearest ancestor statement that is any one of the given types. null if this element does not have an ancestor of any of the given types
-
shouldClearParseInfo
public boolean shouldClearParseInfo() -
assignTokens
-
addToken
-
getTokens
- Specified by:
getTokensin interfaceIParsedElement
-