Class UnexpectedTokenException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.github.zafarkhaja.semver.ParseException
com.github.zafarkhaja.semver.expr.UnexpectedTokenException
- All Implemented Interfaces:
Serializable
Thrown when a token of unexpected types is encountered during the parsing.
- Since:
- 0.7.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Lexer.Token.Type[]The array of the expected token types.private final Lexer.TokenThe unexpected token. -
Constructor Summary
ConstructorsConstructorDescriptionUnexpectedTokenException(Lexer.Token token, Lexer.Token.Type... expected) Constructs aUnexpectedTokenExceptioninstance with the unexpected token and the expected types.Constructs aUnexpectedTokenExceptioninstance with the wrappedUnexpectedElementExceptionexception. -
Method Summary
Modifier and TypeMethodDescription(package private) Lexer.Token.Type[]Gets the expected token types.(package private) Lexer.TokenGets the unexpected token.toString()Returns the string representation of this exception containing the information about the unexpected token and, if available, about the expected types.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Field Details
-
unexpected
The unexpected token. -
expected
The array of the expected token types.
-
-
Constructor Details
-
UnexpectedTokenException
UnexpectedTokenException(UnexpectedElementException cause) Constructs aUnexpectedTokenExceptioninstance with the wrappedUnexpectedElementExceptionexception.- Parameters:
cause- the wrapped exception
-
UnexpectedTokenException
UnexpectedTokenException(Lexer.Token token, Lexer.Token.Type... expected) Constructs aUnexpectedTokenExceptioninstance with the unexpected token and the expected types.- Parameters:
token- the unexpected tokenexpected- an array of the expected token types
-
-
Method Details
-
getUnexpectedToken
-
getExpectedTokenTypes
Lexer.Token.Type[] getExpectedTokenTypes()Gets the expected token types.- Returns:
- an array of expected token types
-
toString
Returns the string representation of this exception containing the information about the unexpected token and, if available, about the expected types.- Overrides:
toStringin classParseException- Returns:
- the string representation of this exception
-