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 Details

    • init

      boolean init(Expression<?>[] expressions, int matchedPattern, ParseContext parseContext)
      Initializes this SyntaxElement before being used. This method is always called before all the others in an extending class, the only exception being CodeSection.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 be null.
      matchedPattern - the index of the pattern that was successfully matched. It corresponds to the order of the syntaxes in registration
      parseContext - an object containing additional information about the parsing of this syntax element, like regex matches and parse marks
      Returns:
      true if the syntax element was initialized successfully, false otherwise.
      See Also:
    • toString

      String toString(TriggerContext ctx, boolean debug)
      Parameters:
      ctx - the event
      debug - whether to show additional information or not
      Returns:
      a String that 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 given CodeSections. This method shouldn't be used for SyntaxElements that should only work with specific TriggerContexts. For this purpose, prefer ParseContext.getParserState() used in conjunction with ParserState.getCurrentContexts().
      Parameters:
      parseContext - the parser context
      isStrict - true if the required section has to be the one directly enclosing this SyntaxElement
      requiredSections - a list of the classes of all the CodeSections this SyntaxElement should be restricted to
      Returns:
      whether this Syntax element is in a given CodeSection or not
      See Also: