parsley.expr

package parsley.expr

Members list

Concise view

Fixities

sealed trait Fixity

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.

Attributes

Since:

4.0.0

Source:
Fixity.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object InfixL.type
object InfixN.type
object InfixR.type
object Postfix.type
object Prefix.type
case object InfixL extends Fixity

Describes left-associative binary operators

Describes left-associative binary operators

Attributes

Since:

4.0.0

Source:
Fixity.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
trait Fixity
class Object
trait Matchable
class Any
Self type
InfixL.type
case object InfixN extends Fixity

Describes non-associative operators

Describes non-associative operators

Attributes

Since:

4.0.0

Source:
Fixity.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
trait Fixity
class Object
trait Matchable
class Any
Self type
InfixN.type
case object InfixR extends Fixity

Describes right-associative binary operators

Describes right-associative binary operators

Attributes

Since:

4.0.0

Source:
Fixity.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
trait Fixity
class Object
trait Matchable
class Any
Self type
InfixR.type
case object Postfix extends Fixity

Describes unary postfix operators

Describes unary postfix operators

Attributes

Since:

4.0.0

Source:
Fixity.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
trait Fixity
class Object
trait Matchable
class Any
Self type
Postfix.type
case object Prefix extends Fixity

Describes unary prefix operators

Describes unary prefix operators

Attributes

Since:

4.0.0

Source:
Fixity.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
trait Fixity
class Object
trait Matchable
class Any
Self type
Prefix.type

Table

case class Atoms[+A](atom0: Parsley[A], atoms: Parsley[A]*) extends Prec[A]

This class is the base of a precedence table.

This class is the base of a precedence table.

Forms the base of a precedence table, requiring at least one atom to be provided. This first atom will be parsed first.

Attributes

A

the type of the atoms.

atom0

the first atom found at the root of the precedence table.

atoms

any remaining atoms found at the root of the precedence table.

Since:

4.0.0

Source:
Levels.scala
Graph
Supertypes
trait Product
trait Equals
class Prec[A]
class Object
trait Matchable
class Any
sealed abstract class Ops[-A, B]

This class allows for the description of a single layer of operators in the precedence tree.

This class allows for the description of a single layer of operators in the precedence tree.

Describes the operators at a specific level in the precedence tree, such that these ops consume Bs, possibly As and produce Bs: this depends on the Fixity of the operators.

Attributes

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 Ops[A, A] is sufficient.

Companion:
object
Source:
Ops.scala
Graph
Supertypes
class Object
trait Matchable
class Any
sealed abstract class Prec[+A]

This class is the base type for precedence tables.

This class is the base type for precedence tables.

For more complex expression parser types Prec can be used to describe the precedence table whilst preserving the intermediate structure between each level.

The base of the table will always be an Atoms, and each layer built on top of the last using either the :+ or +: methods.

Attributes

A

the type of structure produced by the list of levels.

Since:

4.0.0

Source:
Levels.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Atoms[A]

Builders

object GOps

This helper object builds values of Ops[A, B], for fully heterogeneous precedence parsing.

This helper object builds values of Ops[A, B], for fully heterogeneous precedence parsing.

Attributes

Since:

2.2.0

Source:
SmartOps.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
GOps.type
object Ops

This helper object is used to build values of Ops[A, A], for homogeneous precedence parsing.

This helper object is used to build values of Ops[A, A], for homogeneous precedence parsing.

Attributes

Since:

2.2.0

Companion:
class
Source:
Ops.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Ops.type
object SOps

This helper object builds values of Ops[A, B] where A <: B, for subtyped heterogeneous precedence parsing.

This helper object builds values of Ops[A, B] where A <: B, for subtyped heterogeneous precedence parsing.

Attributes

Since:

3.0.0

Source:
SmartOps.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
SOps.type

Chains

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.

Attributes

Since:

2.2.0

Source:
chain.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
chain.type
object infix

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.

Compared with the combinators in chain, these allow for more freedom in the type of the values and the operators.

Attributes

Since:

4.0.0

Source:
infix.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
infix.type
object mixed

This module contains specialist combinators for mixing unary and binary operators on the same level.

This module contains specialist combinators for mixing unary and binary operators on the same level. This is only sensible when mixing infix-left and postfix or infix-right and prefix.

Attributes

Since:

4.0.0

Note:

the behaviour of the enclosed combinators may be counter intuitive: they should not be used unless you know what you are doing.

Source:
mixed.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
mixed.type

Precedence

object precedence

This object is used to construct precedence parsers from either a Prec or many Ops[A, A].

This object is used to construct precedence parsers from either a Prec or many Ops[A, A].

Contained within this object are three different shapes of apply functions: they allows for the construction of a precedence parser from either: a collection of levels of operators and atoms, in either weak-to-strong or strong-to-weak orderings; or a heterogeneous precedence table Prec.

Attributes

Since:

2.2.0

Source:
precedence.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type