Class ExpressionParseCache

java.lang.Object
ch.njol.skript.lang.parser.ExpressionParseCache

public final class ExpressionParseCache extends Object
A scoped cache for failed expression parse attempts.

Each parseExpression call pushes a new scope via push(). Failures cached within that scope are isolated from parent scopes, ensuring that recursive sub-expression parsing does not interfere with the parent's cache. The scope is removed via pop() when the parseExpression call completes.

  • Constructor Details

    • ExpressionParseCache

      public ExpressionParseCache()
  • Method Details

    • push

      public void push()
      Pushes a new cache scope. Call at the start of parseExpression.
    • pop

      public void pop()
      Pops the current cache scope. Call at the end of parseExpression.
    • contains

      public boolean contains(ExpressionParseCache.Failure failure)
      Checks whether the given failure is cached in the current scope.
    • add

      public void add(ExpressionParseCache.Failure failure)
      Caches a failure in the current scope.
    • clear

      public void clear()
      Clears all scopes.