Parser
Attributes
- Graph
-
- Supertypes
- Self type
-
Parser.type
Members list
Type members
Inherited classlikes
Associativity of an operator.
Associativity of an operator.
Attributes
- Inherited from:
- Operators
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object LeftAssociative.typeobject RightAssociative.type
Contains the description of the various LL(1) conflicts.
Contains the description of the various LL(1) conflicts.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
Describes a LL(1) conflict.
Describes a LL(1) conflict.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
class Objecttrait Matchableclass Any
Indicates that a syntax is not LL(1) due to various conflicts.
Indicates that a syntax is not LL(1) due to various conflicts.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Factory of iterators over sequences accepted by a syntax.
Factory of iterators over sequences accepted by a syntax.
Attributes
- Inherited from:
- Enumeration
- Supertypes
-
class Objecttrait Matchableclass Any
Contains an instance for Uninteresting for every type. The Uninteresting instance for Unit
is distinct.
Contains an instance for Uninteresting for every type. The Uninteresting instance for Unit
is distinct.
Attributes
- Inherited from:
- Syntaxes
- Supertypes
Left-associativity.
Left-associativity.
Attributes
- Inherited from:
- Operators
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Associativityclass Objecttrait Matchableclass AnyShow all
Represents a precedence level with a syntax for the various operator
s of that level and an associativity.
Represents a precedence level with a syntax for the various operator
s of that level and an associativity.
Attributes
- Inherited from:
- Operators
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Implicitly decorates an operator
syntax to add an is
method that indicates the associativity of the operator.
Implicitly decorates an operator
syntax to add an is
method that indicates the associativity of the operator.
==Example==
val level = div | times is LeftAssociative
Attributes
- Inherited from:
- Operators
- Supertypes
-
class Objecttrait Matchableclass Any
Result of parsing.
Result of parsing.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Indicates that the input has been fully parsed, resulting in a value
.
Indicates that the input has been fully parsed, resulting in a value
.
A parser for subsequent input is also provided.
Value parameters
- rest
-
Parser for more input.
- value
-
The value produced.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ParseResult[A]class Objecttrait Matchableclass AnyShow all
Factory of LL(1) parsers.
Factory of LL(1) parsers.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
class Objecttrait Matchableclass Any
LL(1) parser.
Factory of pretty printers.
Factory of pretty printers.
Attributes
- Inherited from:
- PrettyPrinting
- Supertypes
-
class Objecttrait Matchableclass Any
Pretty printer of values.
Pretty printer of values.
Attributes
- Inherited from:
- PrettyPrinting
- Supertypes
-
class Objecttrait Matchableclass Any
Contains properties of syntaxes.
Contains properties of syntaxes.
Value parameters
- conflicts
-
The set of LL(1) conflicts of the syntax.
- first
-
The set of token kinds that can start valid sequences.
- nullable
-
A value associated to the empty string, if any.
- shouldNotFollow
-
The set of token kinds that should not follow in sequence.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Right-associativity.
Right-associativity.
Attributes
- Inherited from:
- Operators
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Associativityclass Objecttrait Matchableclass AnyShow all
Contains the instance for Uninteresting of Unit
.
Contains the instance for Uninteresting of Unit
.
Attributes
- Inherited from:
- Syntaxes
- Supertypes
-
class Objecttrait Matchableclass Any
Wrapper around a Syntax
indicating that values from the inner syntax
should be ignored when building up sequences using ~
.
Wrapper around a Syntax
indicating that values from the inner syntax
should be ignored when building up sequences using ~
.
Value parameters
- syntax
-
The wrapped syntax.
Attributes
- Inherited from:
- Syntaxes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Contains primitive basic syntaxes and syntax combinators.
Contains primitive basic syntaxes and syntax combinators.
Attributes
- Inherited from:
- Syntaxes
- Supertypes
-
class Objecttrait Matchableclass Any
Represents a syntax.
Represents a syntax.
Acts as both a parser and a pretty printer.
Type parameters
- A
-
the type of values that can be produced or printed.
Attributes
- Inherited from:
- Syntaxes
- Supertypes
-
class Objecttrait Matchableclass Any
Indicates that end of input was unexpectedly encountered.
Indicates that end of input was unexpectedly encountered.
The syntax
for subsequent input is provided.
Value parameters
- syntax
-
Syntax at the end of input.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ParseResult[A]class Objecttrait Matchableclass AnyShow all
Indicates that the provided token
was not expected at that point.
Indicates that the provided token
was not expected at that point.
The parser at the point of error is returned.
Value parameters
- rest
-
Parser at the point of error.
- token
-
The token at fault.
Attributes
- Inherited from:
- Parsing
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ParseResult[A]class Objecttrait Matchableclass AnyShow all
Typeclass to denote that values of a given type are uninteresting and can be safely ignored while describing a syntax.
Typeclass to denote that values of a given type are uninteresting and can be safely ignored while describing a syntax.
Attributes
- Inherited from:
- Syntaxes
- Supertypes
-
class Objecttrait Matchableclass Any
Low priority implicits. Contains an instance for Uninteresting for every type.
Low priority implicits. Contains an instance for Uninteresting for every type.
Attributes
Value members
Concrete methods
Returns the kind associated with token
.
Returns the kind associated with token
.
Attributes
- Definition Classes
-
Syntaxes
Inherited methods
Syntax that describes a single token of the provided kind
, and that directly applies a function on the successfully parsed token.
Syntax that describes a single token of the provided kind
, and that directly applies a function on the successfully parsed token.
Attributes
- Inherited from:
- Syntaxes
Prints a report of LL(1) conflicts in the syntax.
Prints a report of LL(1) conflicts in the syntax.
Attributes
- Inherited from:
- Debug
Returns a report of LL(1) conflicts in the syntax.
Returns a report of LL(1) conflicts in the syntax.
Attributes
- Inherited from:
- Debug
Syntax that describes a single token of the provided kind
.
Syntax that describes a single token of the provided kind
.
Attributes
- Inherited from:
- Syntaxes
Syntax that produces the given value
to the empty sequence of tokens.
Syntax that produces the given value
to the empty sequence of tokens.
Attributes
- Inherited from:
- Syntaxes
Syntax that represents repetitions of elem
separated by left-associative op
. The value returned is reduced left-to-right.
Syntax that represents repetitions of elem
separated by left-associative op
. The value returned is reduced left-to-right.
==Example==
val binaryOp: Syntax[Operator] = ...
val operand: Syntax[Expr] = ...
val operationExpr = infixLeft(operand, binaryOp) {
// Describes how to turn two values and an operator into a value.
case (lhs, op, rhs) => BinaryExpr(op, lhs, rhs)
}
With inverse function, for pretty printing support:
val binaryOp: Syntax[Operator] = ...
val operand: Syntax[Expr] = ...
val operationExpr = infixLeft(operand, binaryOp)({
// Describes how to turn two values and an operator into a value.
case (lhs, op, rhs) => BinaryExpr(op, lhs, rhs)
}, {
// Describes how to turn a `BinaryExpr` back to its components.
case BinaryExpr(op, lhs, rhs) => (lhs, op, rhs)
})
Value parameters
- elem
-
Syntax for the operands.
- function
-
Function to apply an operation.
- inverse
-
Function to reverse an operation.
- op
-
Syntax for the operators.
Attributes
- Inherited from:
- Operators
Syntax that represents repetitions of elem
separated by right-associative op
. The value returned is reduced right-to-left.
Syntax that represents repetitions of elem
separated by right-associative op
. The value returned is reduced right-to-left.
==Example==
val binaryOp: Syntax[Operator] = ...
val operand: Syntax[Expr] = ...
val operationExpr = infixRight(operand, binaryOp) {
// Describes how to turn two values and an operator into a value.
case (lhs, op, rhs) => BinaryExpr(op, lhs, rhs)
}
With inverse function, for pretty printing support:
val binaryOp: Syntax[Operator] = ...
val operand: Syntax[Expr] = ...
val operationExpr = infixRight(operand, binaryOp)({
// Describes how to turn two values and an operator into a value.
case (lhs, op, rhs) => BinaryExpr(op, lhs, rhs)
}, {
// Describes how to turn a `BinaryExpr` back to its components.
case BinaryExpr(op, lhs, rhs) => (lhs, op, rhs)
})
Value parameters
- elem
-
Syntax for the operands.
- function
-
Function to apply an operation.
- inverse
-
Function to reverse an operation. *
- op
-
Syntax for the operators.
Attributes
- Inherited from:
- Operators
Syntax that represents 0 or more repetitions of the rep
syntax.
Syntax that represents 0 or more repetitions of the rep
syntax.
Attributes
- Inherited from:
- Syntaxes
Syntax that represents 1 or more repetitions of the rep
syntax.
Syntax that represents 1 or more repetitions of the rep
syntax.
Attributes
- Inherited from:
- Syntaxes
Syntax that represents the disjunction of several syntaxes
.
Syntax that represents the disjunction of several syntaxes
.
Attributes
- Inherited from:
- Syntaxes
Syntax that represents repetitions of elem
separated by infix operators.
Syntax that represents repetitions of elem
separated by infix operators.
The operators in earlier levels are considered to bind tighter than those in later levels.
==Example==
val andOp: Syntax[Operator]
val orOp: Syntax[Operator]
val implyOr: Syntax[Operator]
val operand: Syntax[Expr]
val operationExpr = operators(operand)(
// The "and" operation binds the strongest.
andOp is LeftAssociative,
// Then, the "or" operation.
orOp is LeftAssociative,
// Finally, the "imply" operation, which is right associative.
implyOr is RightAssociative
)({
// Defines how to turn two values and an operator into a value.
case (lhs, op, rhs) => BinaryExpr(op, lhs, rhs)
}, {
// Optionally, defines how to turn a value back into its components.
// This part is only needed if you want to support pretty printing.
case BinaryExpr(op, lhs, rhs) => (lhs, op, rhs)
})
If multiple operators share the same priority level, you can simply combine them using |
before specifying the associativity:
val operationExpr = operators(operand)(
// First, multiplication and division, at the same priority level.
timesOp | divOp is LeftAssociative,
// Then, addition and substraction, at the next priority level.
plusOp | minusOp is LeftAssociative
)({
case (lhs, op, rhs) => BinaryExpr(op, lhs, rhs)
}, {
case BinaryExpr(op, lhs, rhs) => (lhs, op, rhs)
})
Value parameters
- elem
-
Syntax for the operands.
- function
-
Function to apply an operation.
- inverse
-
Function to reverse an operation.
- levels
-
Operators (with associativity), in decreasing priority.
Attributes
- Inherited from:
- Operators
Syntax that represents 0 or 1 instances of the syntax
.
Syntax that represents 0 or 1 instances of the syntax
.
Attributes
- Inherited from:
- Syntaxes
Syntax that represents elem
postfixed by any number of op
.
Syntax that represents elem
postfixed by any number of op
.
Operators are applied left-to-right.
==Example==
val simpleExpr: Syntax[Expr] = ...
val unaryOps: Syntax[Operator] = ...
val postfixedExpr = postfixes(simpleExpr, unaryOps) {
// Defines how to convert an `expr` and an `op` into a `Unary` expression.
case (expr, op) => Unary(op, expr)
}
With inverse function, for pretty printing support:
val simpleExpr: Syntax[Expr] = ...
val unaryOps: Syntax[Operator] = ...
val postfixedExpr = postfixes(simpleExpr, unaryOps)({
// Defines how to convert an `expr` and an `op` into a `Unary` expression.
case (expr, op) => Unary(op, expr)
}, {
// Defines how to convert a `Unary` expression into its components.
case Unary(op, expr) => (expr, op)
})
Value parameters
- elem
-
Syntax for the operands.
- function
-
Function to apply an operation.
- inverse
-
Function to reverse an operation.
- op
-
Syntax for the operators.
Attributes
- Inherited from:
- Operators
Syntax that represents elem
prefixed by any number of op
.
Syntax that represents elem
prefixed by any number of op
.
Operators are applied right-to-left.
==Example==
val simpleExpr: Syntax[Expr] = ...
val unaryOps: Syntax[Operator] = ...
val prefixedExpr = prefixes(unaryOps, simpleExpr) {
// Defines how to convert an `op` and an `expr` into an `expr`.
case (op, expr) => Unary(op, expr)
}
With inverse function, for pretty printing support:
val simpleExpr: Syntax[Expr] = ...
val unaryOps: Syntax[Operator] = ...
val prefixedExpr = prefixes(unaryOps, simpleExpr)({
// Defines how to convert an `op` and an `expr` into a `Unary` expression.
case (op, expr) => Unary(op, expr)
}, {
// Defines how to convert a `Unary` expression into its components.
case Unary(op, expr) => (op, expr)
})
Value parameters
- elem
-
Syntax for the operands.
- function
-
Function to apply an operation.
- inverse
-
Function to reverse an operation.
- op
-
Syntax for the operators.
Attributes
- Inherited from:
- Operators
Indicates that the syntax can refer to itself within its body.
Indicates that the syntax can refer to itself within its body.
Attributes
- Inherited from:
- Syntaxes
Attributes
- Inherited from:
- Syntaxes
Attributes
- Inherited from:
- Syntaxes
Concrete fields
Attributes
Attributes
Attributes
Implicits
Inherited implicits
Decorates syntaxes with methods for LL(1) properties.
Decorates syntaxes with methods for LL(1) properties.
Attributes
- Inherited from:
- Parsing