DefaultErrorBuilder

parsley.errors.DefaultErrorBuilder
See theDefaultErrorBuilder companion class

Helper functions used to build the DefaultErrorBuilder error messages.

Attributes

Since

4.3.0

Companion
class
Source
DefaultErrorBuilder.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def blockError(header: String, lines: Iterable[String], indent: Int): String

Forms an error with the given header followed by a colon, a newline, then the remainder of the lines indented.

Forms an error with the given header followed by a colon, a newline, then the remainder of the lines indented.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def caretLine(caretAt: Int, caretWidth: Int): String

Generates a line of ^ characters as wide as specified starting as seen in as the given position, accounting for the length of the ErrorLineStart too.

Generates a line of ^ characters as wide as specified starting as seen in as the given position, accounting for the length of the ErrorLineStart too.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala

Joins together the given sequences: if the first is empty, then Unknown is prepended onto lines instead.

Joins together the given sequences: if the first is empty, then Unknown is prepended onto lines instead.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala

Filters out any empty messages and returns the rest.

Filters out any empty messages and returns the rest.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala

Combines the alternatives, separated by commas/semicolons, with the final two separated by "or".

Combines the alternatives, separated by commas/semicolons, with the final two separated by "or". An Oxford comma is added if there are more than two elements, as this helps prevent ambiguity in the list. If the elements contain a comma, then semicolon is used as the list separator.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def disjunct(alts: Iterable[String], oxfordComma: Boolean): Option[String]

Combines the alternatives, separated by commas/semicolons, with the final two separated by "or".

Combines the alternatives, separated by commas/semicolons, with the final two separated by "or". If the elements contain a comma, then semicolon is used as the list separator.

Value parameters

oxfordComma

decides whether or not to employ an Oxford comma when there more than two elements to join: this helps prevent ambiguity in the list.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala

Adds "expected " before the given alternatives should they exist.

Adds "expected " before the given alternatives should they exist.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def format(pos: String, source: Option[String], lines: Seq[String]): String

Forms an error message with blockError, with two spaces of indentation and incorporating the source file and position into the header.

Forms an error message with blockError, with two spaces of indentation and incorporating the source file and position into the header.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def indentAndUnlines(lines: Iterable[String], indent: Int): String

Indents and concatenates the given lines by the given depth.

Indents and concatenates the given lines by the given depth.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def inputLine(line: String): String

Adds the ErrorLineStart character to the front of the given line.

Adds the ErrorLineStart character to the front of the given line.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def lineInfo(line: String, linesBefore: Seq[String], linesAfter: Seq[String], errorPointsAt: Int, errorWidth: Int): Seq[String]

Constructs error context by concatenating them together with a "caret line" underneath the focus line, line, where the error occurs.

Constructs error context by concatenating them together with a "caret line" underneath the focus line, line, where the error occurs.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def message(msg: String): String

Returns the given message unchanged.

Returns the given message unchanged.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def named(item: String): String

Returns the given item unchanged.

Returns the given item unchanged.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def pos(line: Int, col: Int): String

Pairs the line and column up in the form (line m, column n).

Pairs the line and column up in the form (line m, column n).

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def raw(item: String): String

If the given item is either a whitespace character or is otherwise "unprintable", a special name is given to it, otherwise the item is enclosed in double-quotes.

If the given item is either a whitespace character or is otherwise "unprintable", a special name is given to it, otherwise the item is enclosed in double-quotes.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def reason(reason: String): String

Returns the given reason unchanged.

Returns the given reason unchanged.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def source(sourceName: Option[String]): Option[String]

If the sourceName exists, wraps it in quotes and adds file onto the front.

If the sourceName exists, wraps it in quotes and adds file onto the front.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def specializedError(msgs: Seq[String], lines: Seq[String]): Seq[String]

Forms a specialized error by combining all components in sequence, if there are no msgs, then Unknown is used instead.

Forms a specialized error by combining all components in sequence, if there are no msgs, then Unknown is used instead.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala

Adds "unexpected " before the given item should it exist.

Adds "unexpected " before the given item should it exist.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala
def vanillaError(unexpected: Option[String], expected: Option[String], reasons: Iterable[String], lines: Seq[String]): Seq[String]

Forms a vanilla error by combining all the components in sequence, if there is no information other than the lines, Unknown is used instead.

Forms a vanilla error by combining all the components in sequence, if there is no information other than the lines, Unknown is used instead.

Attributes

Since

4.3.0

Source
DefaultErrorBuilder.scala

Concrete fields

final val EndOfInput: "end of input"

Attributes

Source
DefaultErrorBuilder.scala
final val ErrorLineStart: ">"

Attributes

Source
DefaultErrorBuilder.scala
final val NumLinesAfter: 1

Attributes

Source
DefaultErrorBuilder.scala
final val NumLinesBefore: 1

Attributes

Source
DefaultErrorBuilder.scala
final val Unknown: "unknown parse error"

Attributes

Source
DefaultErrorBuilder.scala