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.Token
The unexpected token. -
Constructor Summary
ConstructorsConstructorDescriptionUnexpectedTokenException
(Lexer.Token token, Lexer.Token.Type... expected) Constructs aUnexpectedTokenException
instance with the unexpected token and the expected types.Constructs aUnexpectedTokenException
instance with the wrappedUnexpectedElementException
exception. -
Method Summary
Modifier and TypeMethodDescription(package private) Lexer.Token.Type[]
Gets the expected token types.(package private) Lexer.Token
Gets 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 java.lang.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 aUnexpectedTokenException
instance with the wrappedUnexpectedElementException
exception.- Parameters:
cause
- the wrapped exception
-
UnexpectedTokenException
UnexpectedTokenException(Lexer.Token token, Lexer.Token.Type... expected) Constructs aUnexpectedTokenException
instance with the unexpected token and the expected types.- Parameters:
token
- the unexpected tokenexpected
- an array of the expected token types
-
-
Method Details
-
getUnexpectedToken
Lexer.Token getUnexpectedToken()Gets the unexpected token.- Returns:
- the unexpected token
-
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:
toString
in classParseException
- Returns:
- the string representation of this exception
-