Interface SyntaxElement
- All Known Subinterfaces:
Expression<T>, Literal<T>
- All Known Implementing Classes:
ArgumentSection, CodeSection, CondExprCompare, CondExprContains, CondExprDateCompare, CondExprIsDivisible, CondExprIsEmpty, CondExprIsPrime, CondExprIsSet, CondExprMatch, CondExprStartsEnds, ConditionalExpression, ContextExpression, ConvertedExpression, EffAsk, EffAsync, EffChange, EffContinue, EffDoIf, Effect, EffEscape, EffExit, EffFunctionCall, EffInlineCondition, EffPrint, EffReturn, EffShutdown, EffWait, EvtAtTime, EvtPeriodical, EvtScriptLoad, EvtWhen, ExecExprListOperators, ExecExprReplace, ExecutableExpression, ExprAmount, ExprAnswer, ExprArithmeticOperators, ExprBinaryMathFunctions, ExprBooleanOperators, ExprColorFromHex, ExprColorFromRGB, ExprColorValues, ExprDateAgoLater, ExprDateFormatted, ExprDateFromUnix, ExprDateInformation, ExprDateNow, ExprDateTimestamp, ExprDateTodayAt, ExprDefaultValue, ExprDifference, ExprDurationSinceUntil, ExprElement, ExpressionList, ExprFunctionCall, ExprLength, ExprLoopValue, ExprMutableList, ExprNumberConvertBase, ExprParseAs, ExprRandomNumber, ExprRange, ExprSingleParameter, ExprStringCase, ExprStringCharAt, ExprStringChars, ExprStringOccurrence, ExprStringSplitJoin, ExprSubstring, ExprTernary, ExprUnaryMathFunctions, ExprVariableIndices, ExprWhether, LiteralList, LitFunctionParameter, LitScriptName, LitTimeConstants, PropertyConditional, PropertyExpression, RestrictedExpression, ReturnSection, SecAsync, SecCase, SecChance, SecConditional, SecFilter, SecFlatMap, SecLoop, SecMap, SecSwitch, SectionValue, SecWhile, SimpleCodeSection, SimpleExpression, SimpleLiteral, SkriptEvent, Statement, StructFunction, Structure, TaggedExpression, Trigger, Variable, VariableString
public interface SyntaxElement
The base class for all elements that are described by a syntax
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckIsInSection(ParseContext parseContext, boolean isStrict, Class<? extends CodeSection>... requiredSections) Checks whether this syntax element is inside of specific givenCodeSections.booleaninit(Expression<?>[] expressions, int matchedPattern, ParseContext parseContext) Initializes this SyntaxElement before being used.toString(TriggerContext ctx, boolean debug)
-
Method Details
-
init
Initializes this SyntaxElement before being used. This method is always called before all the others in an extending class, the only exception beingCodeSection.loadSection(FileSection, ParserState, SkriptLogger).- Parameters:
expressions- an array of expressions representing all the expressions that are being passed to this syntax element. As opposed to Skript, elements of this array can't benull.matchedPattern- the index of the pattern that was successfully matched. It corresponds to the order of the syntaxes in registrationparseContext- an object containing additional information about the parsing of this syntax element, like regex matches and parse marks- Returns:
trueif the syntax element was initialized successfully,falseotherwise.- See Also:
-
toString
- Parameters:
ctx- the eventdebug- whether to show additional information or not- Returns:
- a
Stringthat should aim to resemble what is written in the script as closely as possible
-
checkIsInSection
@SafeVarargs static boolean checkIsInSection(ParseContext parseContext, boolean isStrict, Class<? extends CodeSection>... requiredSections) Checks whether this syntax element is inside of specific givenCodeSections. This method shouldn't be used for SyntaxElements that should only work with specificTriggerContexts. For this purpose, preferParseContext.getParserState()used in conjunction withParserState.getCurrentContexts().- Parameters:
parseContext- the parser contextisStrict- true if the required section has to be the one directly enclosing this SyntaxElementrequiredSections- a list of the classes of all theCodeSections this SyntaxElement should be restricted to- Returns:
- whether this Syntax element is in a given
CodeSectionor not - See Also:
-