package errors
This package contains the relevant functionality for configuring the error messages generated by the parsers provided by the Lexer
class.
- Source
- package.scala
- Grouped
- Alphabetic
- By Inheritance
- errors
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final class BasicFilter[A] extends SpecialisedFilterConfig[A] with VanillaFilterConfig[A]
This class can be used to not specify an error configuration for the filter, a regular
filter
is used instead.This class can be used to not specify an error configuration for the filter, a regular
filter
is used instead.- Since
4.1.0
- abstract class Because[A] extends VanillaFilterConfig[A]
This class ensures that the filter will generate a vanilla reason for the given failing parse.
This class ensures that the filter will generate a vanilla reason for the given failing parse.
- Since
4.1.0
- class ErrorConfig extends AnyRef
This class is used to specify how errors should be produced by the
Lexer
class.This class is used to specify how errors should be produced by the
Lexer
class.The
Lexer
is set up to produce a variety of different errors vialabel
-ing,explain
-ing, andfilter
-ing, and some applications of the Verified and Preventative error patterns. The exact content of those errors can be configured here. Errors can be suppressed or specified with different levels of detail, or even switching between vanilla or specialised errors.This class should be used by extending it and overriding the relevant parts: all methods here are non-abstract and their default is documented inside. Not configuring something does not mean it will not appear in the message, but will mean it uses the underlying base errors.
- Since
4.1.0
- trait ExplainConfig extends LabelWithExplainConfig
This type can be used to configure errors that make reasons.
This type can be used to configure errors that make reasons.
- Since
4.1.0
- trait FilterConfig[A] extends AnyRef
This trait, and its subclasses, can be used to configure how filters should be used within the
Lexer
.This trait, and its subclasses, can be used to configure how filters should be used within the
Lexer
.- Since
4.1.0
- trait LabelConfig extends LabelWithExplainConfig
This type can be used to configure errors that make labels.
This type can be used to configure errors that make labels.
- Since
4.1.0
- trait LabelWithExplainConfig extends ConfigImplUntyped with LabelOps with ExplainOps
This type can be used to configure both errors that make labels and those that make reasons.
This type can be used to configure both errors that make labels and those that make reasons.
- Since
4.1.0
- sealed abstract class PreventDotIsZeroConfig extends AnyRef
This class is used to configure what error is generated when
.
is parsed as a real number.This class is used to configure what error is generated when
.
is parsed as a real number.- Since
4.1.0
- trait SpecialisedFilterConfig[A] extends FilterConfig[A]
This subtrait of
FilterConfig
specifies that only filters generating specialised errors may be used.This subtrait of
FilterConfig
specifies that only filters generating specialised errors may be used.- Since
4.1.0
- abstract class SpecialisedMessage[A] extends SpecialisedFilterConfig[A]
This class ensures that the filter will generate specialised messages for the given failing parse.
This class ensures that the filter will generate specialised messages for the given failing parse.
- Since
4.1.0
- abstract class Unexpected[A] extends VanillaFilterConfig[A]
This class ensures that the filter will generate a vanilla unexpected item for the given failing parse.
This class ensures that the filter will generate a vanilla unexpected item for the given failing parse.
- Since
4.1.0
- abstract class UnexpectedBecause[A] extends VanillaFilterConfig[A]
This class ensures that the filter will generate a vanilla unexpected item and a reason for the given failing parse.
This class ensures that the filter will generate a vanilla unexpected item and a reason for the given failing parse.
- Since
4.1.0
- trait VanillaFilterConfig[A] extends FilterConfig[A]
This subtrait of
FilterConfig
specifies that only filters generating vanilla errors may be used.This subtrait of
FilterConfig
specifies that only filters generating vanilla errors may be used.- Since
4.1.0
- sealed abstract class VerifiedBadChars extends AnyRef
This class is used to configure what error should be generated when illegal characters in a string or character literal are parsable.
This class is used to configure what error should be generated when illegal characters in a string or character literal are parsable.
- Since
4.1.0
Value Members
- object BadCharsFail
This object makes "bad literal chars" generate a bunch of given messages in a specialised error.
This object makes "bad literal chars" generate a bunch of given messages in a specialised error. Requires a map from bad characters to their messages.
- Since
4.1.0
- object BadCharsReason
This object makes "bad literal chars" generate a reason in a vanilla error.
This object makes "bad literal chars" generate a reason in a vanilla error. Requires a map from bad characters to their reasons.
- Since
4.1.0
- object Hidden extends LabelConfig
This object configures labels by stating that it must be hidden.
This object configures labels by stating that it must be hidden.
- Since
4.1.0
- object Label
This object has a factory for configurations producing labels: if the empty string is provided, this equivalent to
Hidden
.This object has a factory for configurations producing labels: if the empty string is provided, this equivalent to
Hidden
.- Since
4.1.0
- object LabelAndReason
This object has a factory for configurations producing labels and reasons: if the empty label is provided, this equivalent to
Hidden
with no reason; if the empty reason is provided this is equivalent toLabel
. - object NotConfigured extends LabelConfig with ExplainConfig with LabelWithExplainConfig
This object specifies that no special labels or reasons should be generated, and default errors should be used instead.
This object specifies that no special labels or reasons should be generated, and default errors should be used instead.
- Since
4.1.0
- object Reason
This object has a factory for configurations producing reasons: if the empty string is provided, this equivalent to
NotConfigured
.This object has a factory for configurations producing reasons: if the empty string is provided, this equivalent to
NotConfigured
.- Since
4.1.0
- object UnexpectedZeroDot
This object makes "dot is zero" generate a given unexpected message in a vanilla error.
This object makes "dot is zero" generate a given unexpected message in a vanilla error.
- Since
4.1.0
- object UnexpectedZeroDotWithReason
This object makes "dot is zero" generate a given unexpected message with a given reason in a vanilla error.
This object makes "dot is zero" generate a given unexpected message with a given reason in a vanilla error.
- Since
4.1.0
- object Unverified extends VerifiedBadChars
This object disables the verified error for bad characters: this may improve parsing performance slightly on the failure case.
This object disables the verified error for bad characters: this may improve parsing performance slightly on the failure case.
- Since
4.1.0
- object ZeroDotFail
This object makes "dot is zero" generate a bunch of given messages in a specialised error.
This object makes "dot is zero" generate a bunch of given messages in a specialised error.
- Since
4.1.0
- object ZeroDotReason
This object makes "dot is zero" generate a given reason in a vanilla error.
This object makes "dot is zero" generate a given reason in a vanilla error.
- Since
4.1.0
Error Configuration
This is the main class that defines the configuration for errors from the Lexer
.
Labelling and Explain Configuration
These classes can be used to configure both labels and/or explains for simple description configurations.
Filtering Configuration
These classes can be used to describe how to generate the filters to rule out specific parses. They can used to either generate types of vanilla error or specialised errors.
Verifying Bad Characters
These classes can be used to help configure the Verified Error pattern for illegal string and character literal characters,
used by verifiedCharBadCharsUsedInLiteral
and
verifiedStringBadCharsUsedInLiteral
.
Preventing Double Dot
These classes and objects help to configure the Preventative Error pattern for bad .
s,
used by peventRealDoubleDroppedZero
.
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.