Package org.parboiled.errors
Class ErrorUtils
- java.lang.Object
-
- org.parboiled.errors.ErrorUtils
-
public final class ErrorUtils extends Object
General utility methods regarding parse errors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
printErrorMessage(String format, String errorMessage, int startIndex, int endIndex, InputBuffer inputBuffer)
Prints an error message showing a location in the given InputBuffer.static String
printErrorMessage(String format, String errorMessage, int errorIndex, InputBuffer inputBuffer)
Prints an error message showing a location in the given InputBuffer.static String
printParseError(ParseError error)
Pretty prints the given parse error showing its location in the given input buffer.static String
printParseError(ParseError error, Formatter<InvalidInputError> formatter)
Pretty prints the given parse error showing its location in the given input buffer.static String
printParseErrors(List<ParseError> errors)
Pretty prints the given parse errors showing their location in the given input buffer.static String
printParseErrors(ParsingResult<?> parsingResult)
Pretty prints the parse errors of the given ParsingResult showing their location in the given input buffer.
-
-
-
Method Detail
-
printParseErrors
public static String printParseErrors(ParsingResult<?> parsingResult)
Pretty prints the parse errors of the given ParsingResult showing their location in the given input buffer.- Parameters:
parsingResult
- the parsing result- Returns:
- the pretty print text
-
printParseErrors
public static String printParseErrors(List<ParseError> errors)
Pretty prints the given parse errors showing their location in the given input buffer.- Parameters:
errors
- the parse errors- Returns:
- the pretty print text
-
printParseError
public static String printParseError(ParseError error)
Pretty prints the given parse error showing its location in the given input buffer.- Parameters:
error
- the parse error- Returns:
- the pretty print text
-
printParseError
public static String printParseError(ParseError error, Formatter<InvalidInputError> formatter)
Pretty prints the given parse error showing its location in the given input buffer.- Parameters:
error
- the parse errorformatter
- the formatter for InvalidInputErrors- Returns:
- the pretty print text
-
printErrorMessage
public static String printErrorMessage(String format, String errorMessage, int errorIndex, InputBuffer inputBuffer)
Prints an error message showing a location in the given InputBuffer.- Parameters:
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 InputBuffer- Returns:
- the error message including the relevant line from the underlying input plus location indicator
-
printErrorMessage
public static String printErrorMessage(String format, String errorMessage, int startIndex, int endIndex, InputBuffer inputBuffer)
Prints an error message showing a location in the given InputBuffer.- Parameters:
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- Returns:
- the error message including the relevant line from the underlying input plus location indicators
-
-