public final class ErrorUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.RuntimeException |
UnderneathTestNot |
Modifier | Constructor and Description |
---|---|
private |
ErrorUtils() |
Modifier and Type | Method and Description |
---|---|
(package private) static Matcher |
findProperLabelMatcher(MatcherPath path,
int errorIndex)
Finds the Matcher in the given failedMatcherPath whose label is best for presentation in "expected" strings
of parse error messages, given the provided lastMatchPath.
|
private static Matcher |
findProperLabelMatcher0(MatcherPath path,
int errorIndex) |
static java.lang.String |
printErrorMessage(java.lang.String format,
java.lang.String errorMessage,
int errorIndex,
InputBuffer inputBuffer)
Prints an error message showing a location in the given InputBuffer.
|
static java.lang.String |
printErrorMessage(java.lang.String format,
java.lang.String errorMessage,
int startIndex,
int endIndex,
InputBuffer inputBuffer)
Prints an error message showing a location in the given InputBuffer.
|
static java.lang.String |
printParseError(ParseError error)
Pretty prints the given parse error showing its location in the given input buffer.
|
static java.lang.String |
printParseError(ParseError error,
Formatter<InvalidInputError> formatter)
Pretty prints the given parse error showing its location in the given input buffer.
|
static java.lang.String |
printParseErrors(java.util.List<ParseError> errors)
Pretty prints the given parse errors showing their location in the given input buffer.
|
static java.lang.String |
printParseErrors(ParsingResult<?> parsingResult)
Pretty prints the parse errors of the given ParsingResult showing their location in the given input buffer.
|
static Matcher findProperLabelMatcher(MatcherPath path, int errorIndex)
path
- the path to the failed matchererrorIndex
- the start index of the respective parse errorprivate static Matcher findProperLabelMatcher0(MatcherPath path, int errorIndex)
public static java.lang.String printParseErrors(ParsingResult<?> parsingResult)
parsingResult
- the parsing resultpublic static java.lang.String printParseErrors(java.util.List<ParseError> errors)
errors
- the parse errorspublic static java.lang.String printParseError(ParseError error)
error
- the parse errorpublic static java.lang.String printParseError(ParseError error, Formatter<InvalidInputError> formatter)
error
- the parse errorformatter
- the formatter for InvalidInputErrorspublic static java.lang.String printErrorMessage(java.lang.String format, java.lang.String errorMessage, int errorIndex, InputBuffer inputBuffer)
format
- the format string, must include three placeholders for a string
(the error message) and two integers (the error line / column respectively)errorMessage
- the error messageerrorIndex
- the error location as an index into the inputBufferinputBuffer
- the underlying InputBufferpublic static java.lang.String printErrorMessage(java.lang.String format, java.lang.String errorMessage, int startIndex, int endIndex, InputBuffer inputBuffer)
format
- the format string, must include three placeholders for a string
(the error message) and two integers (the error line / column respectively)errorMessage
- the error messagestartIndex
- the start location of the error as an index into the inputBufferendIndex
- the end location of the error as an index into the inputBufferinputBuffer
- the underlying InputBuffer