public class SyntaxException
extends java.lang.Exception
Modifier and Type | Field and Description |
---|---|
static int |
BAD_FACTOR
An error code meaning the parser ran into a non-value token
(like "/") at a point it was expecting a value (like "42" or
"x^2").
|
static int |
EXPECTED
An error code meaning the parser hit an unexpected token at a
point where it expected to see some particular other token.
|
static int |
INCOMPLETE
An error code meaning the input string couldn't reach the end
of the input; the beginning constituted a legal expression,
but there was unparsable stuff left over.
|
static int |
PREMATURE_EOF
An error code meaning the parser hit the end of its input
before it had parsed a full expression.
|
static int |
UNKNOWN_VARIABLE
An error code meaning the expression includes a variable not
on the `allowed' list.
|
Constructor and Description |
---|
SyntaxException(java.lang.String complaint,
Parser parser,
int reason,
java.lang.String expected)
Make a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
explain()
Give a long, hopefully helpful error message.
|
public static final int INCOMPLETE
public static final int BAD_FACTOR
public static final int PREMATURE_EOF
public static final int EXPECTED
public static final int UNKNOWN_VARIABLE
public SyntaxException(java.lang.String complaint, Parser parser, int reason, java.lang.String expected)
complaint
- short error messageparser
- the parser that hit this snagreason
- one of the error codes defined in this classexpected
- if nonnull, the token the parser expected to
see (in place of the erroneous token it did see)