Packages

  • package root

    This is the documentation for Parsley.

    This is the documentation for Parsley.

    Package structure

    The parsley package contains the Parsley class, as well as the Result, Success, and Failure 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.expr contains the following sub modules:
      • parsley.expr.chain contains combinators used in expression parsing
      • parsley.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 in chain.
      • 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.syntax contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:
      • parsley.syntax.character contains implicits to allow you to use character and string literals as parsers.
      • parsley.syntax.lift enables postfix application of the lift combinator onto a function (or value).
      • parsley.syntax.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.syntax.extension contains syntactic sugar combinators exposed as implicit classes.
    • parsley.errors contains modules to deal with error messages, their refinement and generation.
    • 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.state contains combinators that interact with the context-sensitive functionality in the form of state.
    • parsley.token contains the Lexer 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.generic 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.
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package token

    This package provides a wealth of functionality for performing common lexing tasks.

    This package provides a wealth of functionality for performing common lexing tasks.

    It is organised as follows:

    • the main parsing functionality is accessed via Lexer, which provides implementations for the combinators found in the sub-packages given a LexicalDesc.
    • the descriptions sub-package is how a lexical structure can be described, providing the configuration that alters the behaviour of the parsers produced by the Lexer.
    • the other sub-packages contain the high-level interfaces that the Lexer exposes, which can be used to pass whitespace-aware and non-whitespace-aware combinators around in a uniform way.
    • the predicate module contains functionality to help define boolean predicates on characters or unicode codepoints.
    Definition Classes
    parsley
  • package descriptions

    This package contains the descriptions of various lexical structures to be fed to Lexer.

    This package contains the descriptions of various lexical structures to be fed to Lexer.

    Definition Classes
    token
    Since

    4.0.0

  • package errors

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

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

    Definition Classes
    token
  • BadCharsFail
  • BadCharsReason
  • BasicFilter
  • Because
  • ErrorConfig
  • ExplainConfig
  • FilterConfig
  • Hidden
  • Label
  • LabelAndReason
  • LabelConfig
  • LabelWithExplainConfig
  • NotConfigured
  • PreventDotIsZeroConfig
  • Reason
  • SpecializedFilterConfig
  • SpecializedMessage
  • Unexpected
  • UnexpectedBecause
  • UnexpectedZeroDot
  • UnexpectedZeroDotWithReason
  • Unverified
  • VanillaFilterConfig
  • VerifiedBadChars
  • ZeroDotFail
  • ZeroDotReason
  • package names

    This package contains the abstract parsers for parsing identifiers and operators.

    This package contains the abstract parsers for parsing identifiers and operators.

    Definition Classes
    token
    Since

    4.0.0

  • package numeric

    This package contains the abstract parsers for parsing numeric literals, like integers and reals.

    This package contains the abstract parsers for parsing numeric literals, like integers and reals.

    Definition Classes
    token
    Since

    4.0.0

  • package predicate

    This module contains functionality to describe character predicates, which can be used to determine what characters are valid for different tokens.

    This module contains functionality to describe character predicates, which can be used to determine what characters are valid for different tokens.

    Definition Classes
    token
    Since

    4.0.0

  • package symbol

    This package contains the abstract parsers for parsing symbolic tokens like keywords.

    This package contains the abstract parsers for parsing symbolic tokens like keywords.

    Definition Classes
    token
    Since

    4.0.0

  • package text

    This package contains the abstract parsers for parsing string and character literals.

    This package contains the abstract parsers for parsing string and character literals.

    Definition Classes
    token
    Since

    4.0.0

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
Linear Supertypes
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. errors
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final class BasicFilter[A] extends SpecializedFilterConfig[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

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

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

    Since

    4.1.0

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

    Since

    4.1.0

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

  6. final class Label extends LabelConfig

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

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

    Since

    4.1.0

  7. final class LabelAndReason 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.

    Since

    4.1.0

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

    Since

    4.1.0

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

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

  11. final class Reason 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.

    Since

    4.1.0

  12. sealed trait SpecializedFilterConfig[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

    5.0.0

  13. abstract class SpecializedMessage[A] extends SpecializedFilterConfig[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

    5.0.0

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

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

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

    Since

    4.1.0

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

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

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

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

  4. object Label extends Labeller

    Since

    4.1.0

  5. object LabelAndReason

    Since

    4.1.0

  6. object NotConfigured extends LabelConfig with ExplainConfig with LabelWithExplainConfig with Labeller

    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

  7. object Reason

    Since

    4.1.0

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

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.