ErrorFormatter

org.parboiled2.ErrorFormatter
class ErrorFormatter(showExpected: Boolean, showPosition: Boolean, showLine: Boolean, showTraces: Boolean, showFrameStartOffset: Boolean, expandTabs: Int, traceCutOff: Int)

Abstraction for error formatting logic. Instantiate with a custom configuration or override with custom logic.

Value parameters

expandTabs

whether and how tabs in the error input line are to be expanded. The value indicates the column multiples that a tab represents (equals the number of spaces that a leading tab is expanded into). Set to a value < 0 to disable tab expansion.

showExpected

whether a description of the expected input is to be shown

showFrameStartOffset

whether formatted traces should include the frame start offset

showLine

whether the input line with a error position indicator is to be shown

showPosition

whether the error position is to be shown

showTraces

whether the error's rule trace are to be shown

traceCutOff

the maximum number of (trailing) characters shown for a rule trace

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def expandErrorLineTabs(line: String, errorColumn: Int): (Int, String)

Performs tab expansion as configured by the expandTabs member. The errorColumn as well as the returned Int value are both 1-based.

Performs tab expansion as configured by the expandTabs member. The errorColumn as well as the returned Int value are both 1-based.

Attributes

def format(error: ParseError, input: ParserInput): String

Formats the given ParseError into a String using the settings configured for this formatter instance.

Formats the given ParseError into a String using the settings configured for this formatter instance.

Attributes

def format(sb: StringBuilder, error: ParseError, input: ParserInput): StringBuilder

Formats the given ParseError into the given StringBuilder using the settings configured for this formatter instance.

Formats the given ParseError into the given StringBuilder using the settings configured for this formatter instance.

Attributes

def formatAsExpected(trace: RuleTrace): String

Formats the given trace into an "expected" string.

Formats the given trace into an "expected" string.

Attributes

def formatErrorLine(error: ParseError, input: ParserInput): String

Formats the input line in which the error occurred and underlines the given error's position in the line with a caret.

Formats the input line in which the error occurred and underlines the given error's position in the line with a caret.

Attributes

def formatErrorLine(sb: StringBuilder, error: ParseError, input: ParserInput): StringBuilder

Formats the input line in which the error occurred and underlines the given error's position in the line with a caret.

Formats the input line in which the error occurred and underlines the given error's position in the line with a caret.

Attributes

def formatExpected(error: ParseError): String

Formats what is expected at the error location into a single line String including text padding.

Formats what is expected at the error location into a single line String including text padding.

Attributes

def formatExpected(sb: StringBuilder, error: ParseError): StringBuilder

Formats what is expected at the error location into the given StringBuilder including text padding.

Formats what is expected at the error location into the given StringBuilder including text padding.

Attributes

def formatExpectedAsList(error: ParseError): List[String]

Formats what is expected at the error location as a List of Strings.

Formats what is expected at the error location as a List of Strings.

Attributes

def formatExpectedAsString(error: ParseError): String

Formats what is expected at the error location into a single line String.

Formats what is expected at the error location into a single line String.

Attributes

def formatExpectedAsString(sb: StringBuilder, error: ParseError): StringBuilder

Formats what is expected at the error location into the given StringBuilder.

Formats what is expected at the error location into the given StringBuilder.

Attributes

def formatNonTerminal(nonTerminal: NonTerminal, showFrameStartOffset: Boolean): String

Formats the head element of a RuleTrace into a String.

Formats the head element of a RuleTrace into a String.

Attributes

def formatProblem(error: ParseError, input: ParserInput): String

Formats a description of the error's cause into a single line String.

Formats a description of the error's cause into a single line String.

Attributes

def formatProblem(sb: StringBuilder, error: ParseError, input: ParserInput): StringBuilder

Formats a description of the error's cause into the given StringBuilder.

Formats a description of the error's cause into the given StringBuilder.

Attributes

def formatTerminal(terminal: Terminal): String
def formatTrace(trace: RuleTrace, errorIndex: Int): String

Formats a RuleTrace into a String.

Formats a RuleTrace into a String.

Attributes

def formatTraces(error: ParseError): String

Formats a Vector of RuleTrace instances into a String.

Formats a Vector of RuleTrace instances into a String.

Attributes

def mismatchLength(error: ParseError): Int

Determines the number of characters to be shown as "mismatched" for the given ParseError.

Determines the number of characters to be shown as "mismatched" for the given ParseError.

Attributes