Class CheckPointedParseException

All Implemented Interfaces:
Serializable

public class CheckPointedParseException extends ParseException
An extension of ParseException that keeps track of the last position up to which parsing was successful. Backtracking to that position and attempting a parse again is guaranteed to be successful.
See Also:
  • Constructor Details

    • CheckPointedParseException

      public CheckPointedParseException(String expressionString, int textPosition, int tokenPointer, int checkpointPointer, List<Token> tokens, DSLMessage message, Object... inserts)
      Construct a new CheckPointedParseException.
      Parameters:
      expressionString - the raw, untokenized text that was being parsed
      textPosition - the text offset where the error occurs
      tokenPointer - the token-index of token where the error occurred
      checkpointPointer - the token-index of the last known good token
      tokens - the list of tokens that make up expressionString
      message - the error message
      inserts - variables that may be inserted in the error message
  • Method Details

    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class ParseException
      Returns:
      a formatted message with inserts applied.
    • getCheckpointPosition

      public int getCheckpointPosition()
    • getExpressionStringUntilCheckpoint

      public String getExpressionStringUntilCheckpoint()
      Return the parsed expression until the last known, well formed position. Attempting to re-parse that expression is guaranteed to not fail.
      Returns:
      a String containing the expression until the last known well formed position.
    • getCheckpointPointer

      public int getCheckpointPointer()
    • getTokens

      public List<Token> getTokens()
    • getTokenPointer

      public int getTokenPointer()