org.parboiled.errors
Class ErrorUtils

java.lang.Object
  extended by org.parboiled.errors.ErrorUtils

public final class ErrorUtils
extends java.lang.Object

General utility methods regarding parse errors.


Method Summary
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, InputBuffer inputBuffer)
          Pretty prints the given parse error showing its location in the given input buffer.
static java.lang.String printParseError(ParseError error, InputBuffer inputBuffer, 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, InputBuffer inputBuffer)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

printParseErrors

public static java.lang.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 java.lang.String printParseErrors(java.util.List<ParseError> errors,
                                                InputBuffer inputBuffer)
Pretty prints the given parse errors showing their location in the given input buffer.

Parameters:
errors - the parse errors
inputBuffer - the input buffer
Returns:
the pretty print text

printParseError

public static java.lang.String printParseError(ParseError error,
                                               InputBuffer inputBuffer)
Pretty prints the given parse error showing its location in the given input buffer.

Parameters:
error - the parse error
inputBuffer - the input buffer
Returns:
the pretty print text

printParseError

public static java.lang.String printParseError(ParseError error,
                                               InputBuffer inputBuffer,
                                               Formatter<InvalidInputError> formatter)
Pretty prints the given parse error showing its location in the given input buffer.

Parameters:
error - the parse error
inputBuffer - the input buffer
formatter - the formatter for InvalidInputErrors
Returns:
the pretty print text

printErrorMessage

public 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.

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 message
errorIndex - the error location as an index into the inputBuffer
inputBuffer - the underlying InputBuffer
Returns:
the error message including the relevant line from the underlying input plus location indicator

printErrorMessage

public 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.

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 message
startIndex - the start location of the error as an index into the inputBuffer
endIndex - the end location of the error as an index into the inputBuffer
inputBuffer - the underlying InputBuffer
Returns:
the error message including the relevant line from the underlying input plus location indicators