parsley.token.errors

This package contains the relevant functionality for configuring the error messages generated by the parsers provided by the Lexer class.

Attributes

Members list

Grouped members

Labelling and Explain Configuration

These classes can be used to configure both labels and/or explains for simple description configurations.

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

Attributes

Since

4.1.0

Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object NotConfigured.type
class Reason
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.

Attributes

Since

4.1.0

Source
ConfigImplUntyped.scala
Supertypes
trait LabelConfig
class Object
trait Matchable
class Any
Self type
Hidden.type
final class Label(val label: String, val labels: String*) extends LabelConfig

This class represents configurations producing labels: labels may not be empty.

This class represents configurations producing labels: labels may not be empty.

Attributes

Since

4.1.0

Companion
object
Source
ConfigImplUntyped.scala
Supertypes
trait LabelConfig
class Object
trait Matchable
class Any
object Label

Attributes

Since

4.1.0

Companion
class
Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Label.type
final class LabelAndReason(val reason: String, val label: String, val labels: String*) extends LabelWithExplainConfig

This object has a factory for configurations producing labels and reasons: the reason and labels cannot be empty.

This object has a factory for configurations producing labels and reasons: the reason and labels cannot be empty.

Attributes

Since

4.1.0

Companion
object
Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Since

4.1.0

Companion
class
Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed 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.

Attributes

Since

4.1.0

Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Hidden.type
class Label
object NotConfigured.type
sealed trait LabelWithExplainConfig

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.

Attributes

Since

4.1.0

Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object NotConfigured.type
class Reason
trait LabelConfig
object Hidden.type
class Label
Show all

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.

Attributes

Since

4.1.0

Source
ConfigImplUntyped.scala
Supertypes
trait LabelConfig
class Object
trait Matchable
class Any
Show all
Self type
final class Reason(val reason: String) extends ExplainConfig

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.

Attributes

Since

4.1.0

Companion
object
Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
object Reason

Attributes

Since

4.1.0

Companion
class
Source
ConfigImplUntyped.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Reason.type

Error Configuration

This is the main class that defines the configuration for errors from the Lexer.

class ErrorConfig

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 via label-ing, explain-ing, and filter-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.

Attributes

Since

4.1.0

Companion
object
Source
ErrorConfig.scala
Supertypes
class Object
trait Matchable
class Any
object ErrorConfig

Some possible defaults for the ErrorConfig.

Some possible defaults for the ErrorConfig.

Attributes

Since

4.5.0

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

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.

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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Show all
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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Self type
Because[A]
sealed trait FilterConfig[A]

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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BasicFilter[A]
class Because[A]
class Unexpected[A]
Show all
sealed 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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Known subtypes
class BasicFilter[A]
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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Self type
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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Self type
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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Self type
sealed 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.

Attributes

Since

4.1.0

Source
ConfigImplTyped.scala
Supertypes
trait FilterConfig[A]
class Object
trait Matchable
class Any
Known subtypes
class BasicFilter[A]
class Because[A]
class Unexpected[A]

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.

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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type

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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type
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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Unverified.type
sealed abstract class VerifiedBadChars

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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Unverified.type

Preventing Double Dot

These classes and objects help to configure the Preventative Error pattern for bad .s, used by peventRealDoubleDroppedZero.

sealed abstract class PreventDotIsZeroConfig

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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any

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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type

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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type
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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type
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.

Attributes

Since

4.1.0

Source
VerifiedAndPreventativeErrors.scala
Supertypes
class Object
trait Matchable
class Any
Self type