Packages

  • package root
    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
  • class Lexer extends AnyRef

    This class provides a large selection of functionality concerned with lexing.

    This class provides a large selection of functionality concerned with lexing.

    This class provides lexing functionality to parsley, however it is guaranteed that nothing in this class is not implementable purely using parsley's pre-existing functionality. These are regular parsers, but constructed in such a way that they create a clear and logical separation from the rest of the parser.

    The class is broken up into several internal "modules" that group together similar kinds of functionality. Importantly, the lexemes and nonlexemes objects separate the underlying token implementations based on whether or not they consume whitespace or not. Functionality is broadly duplicated across both of these modules: lexemes should be used by a wider parser, to ensure whitespace is handled uniformly; and nonlexemes should be used to define further composite tokens or in special circumstances where whitespace should not be consumed.

    It is possible that some of the implementations of parsers found within this class may have been hand-optimised for performance: care will have been taken to ensure these implementations precisely match the semantics of the originals.

    Definition Classes
    token
    Annotations
    @deprecatedInheritance( ... , "4.1.0" )
  • object lexeme extends Lexeme

    This object is concerned with lexemes: these are tokens that are treated as "words", such that whitespace will be consumed after each has been parsed.

    This object is concerned with lexemes: these are tokens that are treated as "words", such that whitespace will be consumed after each has been parsed.

    Ideally, a wider parser should not be concerned with handling whitespace, as it is responsible for dealing with a stream of tokens. With parser combinators, however, it is usually not the case that there is a separate distinction between the parsing phase and the lexing phase. That said, it is good practice to establish a logical separation between the two worlds. As such, this object contains parsers that parse tokens, and these are whitespace-aware. This means that whitespace will be consumed after any of these parsers are parsed. It is not, however, required that whitespace be present.

    Definition Classes
    Lexer
    Since

    4.0.0

  • enclosing
  • numeric
  • separators
  • text

object text

This object contains lexing functionality relevant to the parsing of text. This is sub-divided into different categories:

  • string literals (both with escapes and raw)
  • multi-line string literals (both with escapes and raw)
  • character literals

These contain the relevant functionality required to specify the degree of unicode support for the underlying language, from ASCII to full UTF-16.

Source
Lexer.scala
Since

4.0.0

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. text
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val character: Character

    This is a collection of parsers concerned with handling character literals.

    This is a collection of parsers concerned with handling character literals.

    Character literals are described generally as follows:

    • desc.textDesc.characterLiteralEnd: the character that starts and ends the literal (for example in many languages this is ')
    • desc.textDesc.graphicCharacter: describes the legal characters that may appear in the literal directly. Usually, this excludes control characters and newlines, but permits most other things. Escape sequences can represent non-graphic characters
    • desc.textDesc.escapeSequences: describes the legal escape sequences that that can appear in a character literal (for example \n or )

    Aside from the generic configuration, characters can be parsed in accordance with varying levels of unicode support, from ASCII-only to full UTF-16 characters. Parsers for each of four different vareties are exposed by this object.

    Since

    4.0.0

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. val multiString: String

    This is a collection of parsers concerned with handling multi-line string literals.

    This is a collection of parsers concerned with handling multi-line string literals.

    String literals are described generally as follows:

    • desc.textDesc.multiStringEnds: the sequence of characters that can begin or end a multi-line string literal. Regardless of which of these is used for a specific literal, the end of the literal must use the same sequence
    • desc.textDesc.graphicCharacter: describes the legal characters that may appear in the literal directly. Usually, this excludes control characters and newlines, but permits most other things. Escape sequences can represent non-graphic characters for non-raw strings
    • desc.textDesc.escapeSequences: describes the legal escape sequences that that can appear in a string literal (for example \n or )
    Since

    4.0.0

  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. val rawMultiString: String

    This is a collection of parsers concerned with handling multi-line string literals.

    This is a collection of parsers concerned with handling multi-line string literals.

    String literals are described generally as follows:

    • desc.textDesc.multiStringEnds: the sequence of characters that can begin or end a multi-line string literal. Regardless of which of these is used for a specific literal, the end of the literal must use the same sequence
    • desc.textDesc.graphicCharacter: describes the legal characters that may appear in the literal directly. Usually, this excludes control characters and newlines, but permits most other things. Escape sequences can represent non-graphic characters for non-raw strings
    • desc.textDesc.escapeSequences: describes the legal escape sequences that that can appear in a string literal (for example \n or )
    Since

    4.0.0

    Note

    this will be parsed without handling any escape sequences, this includes literal-end characters and the escape prefix (often " and \ respectively)

  18. val rawString: String

    This is a collection of parsers concerned with handling single-line string literals.

    This is a collection of parsers concerned with handling single-line string literals.

    String literals are described generally as follows:

    • desc.textDesc.stringEnds: the sequence of characters that can begin or end a string literal. Regardless of which of these is used for a specific literal, the end of the literal must use the same sequence
    • desc.textDesc.graphicCharacter: describes the legal characters that may appear in the literal directly. Usually, this excludes control characters and newlines, but permits most other things. Escape sequences can represent non-graphic characters for non-raw strings
    • desc.textDesc.escapeSequences: describes the legal escape sequences that that can appear in a string literal (for example \n or )
    Since

    4.0.0

    Note

    this will be parsed without handling any escape sequences, this includes literal-end characters and the escape prefix (often " and \ respectively)

  19. val string: String

    This is a collection of parsers concerned with handling single-line string literals.

    This is a collection of parsers concerned with handling single-line string literals.

    String literals are described generally as follows:

    • desc.textDesc.stringEnds: the sequence of characters that can begin or end a string literal. Regardless of which of these is used for a specific literal, the end of the literal must use the same sequence
    • desc.textDesc.graphicCharacter: describes the legal characters that may appear in the literal directly. Usually, this excludes control characters and newlines, but permits most other things. Escape sequences can represent non-graphic characters for non-raw strings
    • desc.textDesc.escapeSequences: describes the legal escape sequences that that can appear in a string literal (for example \n or )
    Since

    4.0.0

  20. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped