object DefaultErrorBuilder
Helper functions used to build the DefaultErrorBuilder
error messages.
- Source
- DefaultErrorBuilder.scala
- Since
4.3.0
- Alphabetic
- By Inheritance
- DefaultErrorBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final val EndOfInput: String("end of input")
- final val ErrorLineStart: String(">")
- final val NumLinesAfter: Int(1)
- final val NumLinesBefore: Int(1)
- final val Unknown: String("unknown parse error")
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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.- Since
4.3.0
- 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.- Since
4.3.0
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def combineInfoWithLines(info: Seq[String], lines: Seq[String]): Seq[String]
Joins together the given sequences: if the first is empty, then
Unknown
is prepended ontolines
instead.Joins together the given sequences: if the first is empty, then
Unknown
is prepended ontolines
instead.- Since
4.3.0
- def combineMessages(alts: Seq[String]): Seq[String]
Filters out any empty messages and returns the rest.
Filters out any empty messages and returns the rest.
- Since
4.3.0
- 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.
- 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.
- Since
4.3.0
- def disjunct(alts: Iterable[String]): 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". 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.
- Since
4.3.0
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def expected(alts: Option[String]): Option[String]
Adds "expected " before the given alternatives should they exist.
Adds "expected " before the given alternatives should they exist.
- Since
4.3.0
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- 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.- Since
4.3.0
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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.
- Since
4.3.0
- 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.- Since
4.3.0
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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.- Since
4.3.0
- def message(msg: String): String
Returns the given message unchanged.
Returns the given message unchanged.
- Since
4.3.0
- def named(item: String): String
Returns the given item unchanged.
Returns the given item unchanged.
- Since
4.3.0
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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)
.- Since
4.3.0
- 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.
- Since
4.3.0
- def reason(reason: String): String
Returns the given reason unchanged.
Returns the given reason unchanged.
- Since
4.3.0
- def source(sourceName: Option[String]): Option[String]
If the
sourceName
exists, wraps it in quotes and addsfile
onto the front.If the
sourceName
exists, wraps it in quotes and addsfile
onto the front.- Since
4.3.0
- def specialisedError(msgs: Seq[String], lines: Seq[String]): Seq[String]
Forms a specialised error by combining all components in sequence, if there are no
msgs
, thenUnknown
is used instead.Forms a specialised error by combining all components in sequence, if there are no
msgs
, thenUnknown
is used instead.- Since
4.3.0
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unexpected(item: Option[String]): Option[String]
Adds "unexpected " before the given item should it exist.
Adds "unexpected " before the given item should it exist.
- Since
4.3.0
- 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.- Since
4.3.0
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
This is the documentation for Parsley.
Package structure
The parsley package contains the
Parsley
class, as well as theResult
,Success
, andFailure
types. In addition to these, it also contains the following packages and "modules" (a module is defined as being an object which mocks a package):parsley.Parsley
contains the bulk of the core "function-style" combinators.parsley.combinator
contains many helpful combinators that simplify some common parser patterns.parsley.character
contains the combinators needed to read characters and strings, as well as combinators to match specific sub-sets of characters.parsley.debug
contains debugging combinators, helpful for identifying faults in parsers.parsley.extension
contains syntactic sugar combinators exposed as implicit classes.parsley.io
contains extension methods to run parsers with input sourced from IO sources.parsley.expr
contains the following sub modules:parsley.expr.chain
contains combinators used in expression parsingparsley.expr.precedence
is a builder for expression parsers built on a precedence table.parsley.expr.infix
contains combinators used in expression parsing, but with more permissive types than their equivalents inchain
.parsley.expr.mixed
contains combinators that can be used for expression parsing, but where different fixities may be mixed on the same level: this is rare in practice.parsley.implicits
contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:parsley.implicits.character
contains implicits to allow you to use character and string literals as parsers.parsley.implicits.combinator
contains implicits related to combinators, such as the ability to make any parser into aParsley[Unit]
automatically.parsley.implicits.lift
enables postfix application of the lift combinator onto a function (or value).parsley.implicits.zipped
enables boths a reversed form of lift where the function appears on the right and is applied on a tuple (useful when type inference has failed) as well as a.zipped
method for building tuples out of several combinators.parsley.errors
contains modules to deal with error messages, their refinement and generation.parsley.errors.combinator
provides combinators that can be used to either produce more detailed errors as well as refine existing errors.parsley.errors.tokenextractors
provides mixins for common token extraction strategies during error message generation: these can be used to avoid implementingunexpectedToken
in theErrorBuilder
.parsley.lift
contains functions which lift functions that work on regular types to those which now combine the results of parsers returning those same types. these are ubiquitous.parsley.ap
contains functions which allow for the application of a parser returning a function to several parsers returning each of the argument types.parsley.registers
contains combinators that interact with the context-sensitive functionality in the form of registers.parsley.token
contains theLexer
class that provides a host of helpful lexing combinators when provided with the description of a language.parsley.position
contains parsers for extracting position information.parsley.genericbridges
contains some basic implementations of the Parser Bridge pattern (see Design Patterns for Parser Combinators in Scala, or the parsley wiki): these can be used before more specialised generic bridge traits can be constructed.