Class CheckPointedParseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.infosmid.stream.dsl.ParseException
org.infosmid.stream.dsl.CheckPointedParseException
- All Implemented Interfaces:
Serializable
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:
-
Field Summary
Fields inherited from class ParseException
expressionString, inserts, message, position -
Constructor Summary
ConstructorsConstructorDescriptionCheckPointedParseException(String expressionString, int textPosition, int tokenPointer, int checkpointPointer, List<Token> tokens, DSLMessage message, Object... inserts) Construct a newCheckPointedParseException. -
Method Summary
Modifier and TypeMethodDescriptionintintReturn the parsed expression until the last known, well formed position.intMethods inherited from class ParseException
getExpressionString, getInserts, getMessageCode, getPosition, toExceptionDescriptorMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CheckPointedParseException
public CheckPointedParseException(String expressionString, int textPosition, int tokenPointer, int checkpointPointer, List<Token> tokens, DSLMessage message, Object... inserts) Construct a newCheckPointedParseException.- Parameters:
expressionString- the raw, untokenized text that was being parsedtextPosition- the text offset where the error occurstokenPointer- the token-index of token where the error occurredcheckpointPointer- the token-index of the last known good tokentokens- the list of tokens that make up expressionStringmessage- the error messageinserts- variables that may be inserted in the error message
-
-
Method Details
-
getMessage
- Overrides:
getMessagein classParseException- Returns:
- a formatted message with inserts applied.
-
getCheckpointPosition
public int getCheckpointPosition() -
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
-
getTokenPointer
public int getTokenPointer()
-