package expr
- Alphabetic
- Public
- Protected
Type Members
- sealed trait Fixity extends AnyRef
Denotes the fixity and associativity of an operator.
Denotes the fixity and associativity of an operator. Importantly, it also specifies the type of the of the operations themselves. For non-monolithic structures this is described by
fixity.GOp
and for monolithic/subtyping based structures this is described byfixity.Op
.- Since
2.2.0
- final case class Level[-A, B, +C](ops: Ops[A, B], lvls: Levels[B, C]) extends Levels[A, C] with Product with Serializable
This represents a single new level of the hierarchy, with stronger precedence than its tail.
This represents a single new level of the hierarchy, with stronger precedence than its tail.
- A
The base type accepted by this layer
- B
The intermediate type that will be provided to the next layer
- C
The type of structure produced by the next layers
- ops
The operators accepted at this level
- lvls
The next, weaker, levels in the precedence table
- returns
A larger precedence table transforming atoms of type
A
into a structure of typeC
.
- Since
2.2.0
- sealed trait Levels[-A, +B] extends AnyRef
For more complex expression parser types
Levels
can be used to describe the precedence table whilst preserving the intermediate structure between each level.For more complex expression parser types
Levels
can be used to describe the precedence table whilst preserving the intermediate structure between each level.- A
The base type accepted by this list of levels
- B
The type of structure produced by the list of levels
- Since
2.2.0
- trait Ops[-A, B] extends AnyRef
Describes the operators at a specific level in the precedence tree, such that these ops consume
B
s, possiblyA
s and produceB
s: this depends on the Fixity of the operators.Describes the operators at a specific level in the precedence tree, such that these ops consume
B
s, possiblyA
s and produceB
s: this depends on the Fixity of the operators.- A
The base type consumed by the operators
- B
The type produced/consumed by the operators
- Since
2.2.0
- Note
For less complex types, such as those which use subtyping
Ops[A, A]
is sufficient
Value Members
- object GOps
Helper object to build values of
Ops[A, B]
, for generalised precedence parsingHelper object to build values of
Ops[A, B]
, for generalised precedence parsing- Since
2.2.0
- case object InfixL extends Fixity with Product with Serializable
Describes left-associative binary operators
Describes left-associative binary operators
- Since
2.2.0
- case object InfixR extends Fixity with Product with Serializable
Describes right-associative binary operators
Describes right-associative binary operators
- Since
2.2.0
- object Levels
- object Ops
Helper object to build values of
Ops[A, A]
, for monolithic precedence parsingHelper object to build values of
Ops[A, A]
, for monolithic precedence parsing- Since
2.2.0
- case object Postfix extends Fixity with Product with Serializable
Describes unary postfix operators
Describes unary postfix operators
- Since
2.2.0
- case object Prefix extends Fixity with Product with Serializable
Describes unary prefix operators
Describes unary prefix operators
- Since
2.2.0
- object chain
This module contains the very useful chaining family of combinators, which are mostly used to parse operators and expressions of varying fixities.
This module contains the very useful chaining family of combinators, which are mostly used to parse operators and expressions of varying fixities. It is a more low-level API compared with precedence.
- Since
2.2.0
- object precedence
This object is used to construct precedence parsers from either a Levels or many
Ops[A, A]
.This object is used to construct precedence parsers from either a Levels or many
Ops[A, A]
.- Since
2.2.0
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, as well as the implicit classes which enable the "method-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 parsingparsley.expr.precedence
is a builder for expression parsers built on a precedence table.parsley.implicits
contains several implicits to add syntactic sugar to the combinators, such as being able to use character and string literals directly as parsers, as well as enabling lifting of functions to work on parsers.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.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.unsafe
contains unsafe (and not thread-safe) ways of speeding up the execution of a parser.In addition to the modules and packages outlined above, this version of Parsley (up to version 3.0), also includes the so-called
old-style
API, which is deprecated (see the Parsley wiki for a discussion of these differences). You should use the modules described above, and avoid the following:parsley.BitGen
parsley.Char
parsley.CharSet
parsley.Combinator
parsley.ExpressionParser
parsley.Impl
parsley.Implicits
parsley.LanguageDef
parsley.NotRequired
parsley.Parser
parsley.Predicate
parsley.Reg
parsley.TokenParser