Class ParseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.libxmq.ParseException
- All Implemented Interfaces:
Serializable
The parse exception contains necessary information
to understand the parse failure.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionParseException(ParseErrorCode ec, String text, int line, int column, String source) Construct a parse exception.ParseException(ParseErrorCode ec, String text, int line, int column, String source, int caret_bytes, int code_point, ParseException warning) Construct a parse exception of the xmq parser, printed like the C generate_state_error_message: the line of the input (at most 1024 bytes) with the ^ after as many spaces as there are utf8 bytes before the error.ParseException(ParseErrorCode ec, String text, int line, int column, String source, String info, int char_index) Construct a parse exception with extra information, like the C error_info, where the offending char is not at the column (as in the yaml parser). -
Method Summary
Modifier and TypeMethodDescriptionintGet the number of utf8 bytes before the ^, -1 if the line is not shown.intGet the position of the offending char in the text, -1 if at the end of the input.intGet the character at the error, 0 at the end of the input.intcolumn()Get the column.booleancStyle()Is this exception printed like generate_state_error_message in C.Get the error code.info()Get the extra information, or null.intline()Get the line number.source()Get the source, ie file name, "mbuffer", "stdin" etc.text()Get the line of text.warning()Get the warning printed before the error, or null.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ParseException
Construct a parse exception.- Parameters:
ec- The error code.text- The line on which the parse failed.line- The line number.column- The column.source- Information about where the xmq originated from.
-
ParseException
public ParseException(ParseErrorCode ec, String text, int line, int column, String source, String info, int char_index) Construct a parse exception with extra information, like the C error_info, where the offending char is not at the column (as in the yaml parser).- Parameters:
ec- The error code.text- The line on which the parse failed.line- The line number.column- The column that is reported.source- Information about where the xmq originated from.info- Extra information appended to the message, or null.char_index- The position of the offending char in text, -1 if at the end of the input.
-
ParseException
public ParseException(ParseErrorCode ec, String text, int line, int column, String source, int caret_bytes, int code_point, ParseException warning) Construct a parse exception of the xmq parser, printed like the C generate_state_error_message: the line of the input (at most 1024 bytes) with the ^ after as many spaces as there are utf8 bytes before the error.- Parameters:
ec- The error code.text- The line of the input around the error.line- The line number.column- The column, in characters (code points).source- Information about where the xmq originated from.caret_bytes- The number of utf8 bytes of the line before the error, -1 when the error is at the end of the input (the line is not shown).code_point- The character at the error, 0 at the end of the input.warning- A warning printed before the error, or null.
-
-
Method Details
-
cStyle
public boolean cStyle()Is this exception printed like generate_state_error_message in C.- Returns:
- true if it is
-
caretBytes
public int caretBytes()Get the number of utf8 bytes before the ^, -1 if the line is not shown.- Returns:
- the number of bytes
-
codePoint
public int codePoint()Get the character at the error, 0 at the end of the input.- Returns:
- the code point
-
warning
Get the warning printed before the error, or null.- Returns:
- the warning
-
info
-
charIndex
public int charIndex()Get the position of the offending char in the text, -1 if at the end of the input.- Returns:
- the position
-
errorCode
-
text
-
line
public int line()Get the line number.- Returns:
- line number
-
column
public int column()Get the column.- Returns:
- column
-
source
Get the source, ie file name, "mbuffer", "stdin" etc.- Returns:
- The source information.
-