Enum Class ParserMessage
- All Implemented Interfaces:
Serializable
,Comparable<ParserMessage>
,Constable
Contains all the messages that can be produced during parsing. Each message
has a kind (WARNING, ERROR) and a code number. Code is used to identify
particular message and makes it easier to test what messages are produced.
Code numbers are split so that ones within
1xxx
are from lexer
and 2xxx
from parser.
Messages with ERROR
should be treated as terminating messages because
those are most likely hard errors based on manual validation or exception
thrown within lexing or parsing.
Messages with WARNING
can be ignored but can be used to provide
info to user. For example parsing may detect some ambiguities with a command
and option model related to what user tries to use as an input. This
because there are limits how clever a parser can be as command model
is beyond its control.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionformatMessage
(boolean useCode, int position, Object... inserts) Format message.formatMessage
(Object... inserts) Format message without code and position parts.int
getCode()
getType()
static ParserMessage
Returns the enum constant of this class with the specified name.static ParserMessage[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ILLEGAL_CONTENT_BEFORE_COMMANDS
-
MANDATORY_OPTION_MISSING
-
UNRECOGNISED_OPTION
-
ILLEGAL_OPTION_VALUE
-
NOT_ENOUGH_OPTION_ARGUMENTS
-
TOO_MANY_OPTION_ARGUMENTS
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getCode
public int getCode() -
getType
-
formatMessage
Format message without code and position parts.- Parameters:
inserts
- the inserts- Returns:
- formatted message
-
formatMessage
Format message.For example code and position 2000E:(pos 0):
- Parameters:
useCode
- Add code partposition
- position info, not printed if negativeinserts
- the inserts- Returns:
- formatted message
-