Class ParserState
java.lang.Object
io.github.syst3ms.skriptparser.parsing.ParserState
An object that stores data about the current parsing, on the scale of the entire trigger.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCurrentSection(CodeSection section) Adds a new enclosingCodeSectionto the hierarchyvoidaddCurrentStatement(Statement statement) Adds a newStatementto the items of the enclosing section.voidClears all stored items of this enclosing section, after all parsing inside it has been completed.voidClears the previously enforced syntax restrictionsbooleanforbidsSyntax(Class<? extends SyntaxElement> c) Set<Class<? extends TriggerContext>> Returns a list of all consecutive, successfully parsed Statements in the enclosing section.booleanvoidUses recursion to allow items of a new enclosing section to be added, preserving the current items to be used when the callback has been invoked.voidRemoves the current section from the hierarchy, after all parsing inside it has been completed.voidsetCurrentContexts(Set<Class<? extends TriggerContext>> currentContexts) Sets theTriggerContexts handled by the currently parsed eventvoidsetSyntaxRestrictions(Set<Class<? extends SyntaxElement>> allowedSyntaxes, boolean restrictingExpressions) Define the syntax restrictions enforced by the current section
-
Constructor Details
-
ParserState
public ParserState()
-
-
Method Details
-
getCurrentContexts
- Returns:
- the
TriggerContexts handled by the currently parsed event
-
setCurrentContexts
Sets theTriggerContexts handled by the currently parsed event- Parameters:
currentContexts- the handledTriggerContexts
-
getCurrentSections
- Returns:
- a list of all enclosing CodeSections, with the closest one first
-
addCurrentSection
Adds a new enclosingCodeSectionto the hierarchy- Parameters:
section- the enclosingCodeSection
-
removeCurrentSection
public void removeCurrentSection()Removes the current section from the hierarchy, after all parsing inside it has been completed. -
getCurrentStatements
-
addCurrentStatement
-
recurseCurrentStatements
public void recurseCurrentStatements()Uses recursion to allow items of a new enclosing section to be added, preserving the current items to be used when the callback has been invoked. -
callbackCurrentStatements
public void callbackCurrentStatements()Clears all stored items of this enclosing section, after all parsing inside it has been completed. -
setSyntaxRestrictions
public void setSyntaxRestrictions(Set<Class<? extends SyntaxElement>> allowedSyntaxes, boolean restrictingExpressions) Define the syntax restrictions enforced by the current section- Parameters:
allowedSyntaxes- all allowed syntaxesrestrictingExpressions- whether expressions are also restricted
-
clearSyntaxRestrictions
public void clearSyntaxRestrictions()Clears the previously enforced syntax restrictions -
forbidsSyntax
- Parameters:
c- the class of the syntax- Returns:
- whether the current syntax restrictions forbid a given syntax or not
-
isRestrictingExpressions
public boolean isRestrictingExpressions()- Returns:
- whether the current syntax restrictions also apply to expressions
-