The pattern represents a constant, which can be a literal constant such as "abc"
or a compound type such as (2, 3)
or (Some(2), 3, 4)
.
The pattern represents a constant, which can be a literal constant such as "abc"
or a compound type such as (2, 3)
or (Some(2), 3, 4)
.
The value v
represents a value of the [T]
type of M[T]
or B[T,R]
.
Describes the pattern matcher for input molecules.
Describes the pattern matcher for input molecules.
Possible values:
WildcardF for case a(_) ⇒
SimpleVarF for case a(x) ⇒
ConstantPatternF for case a(1) ⇒
WrongReplyVarF: the reply matcher for blocking molecules is not a simple variable, e.g. case f(_, _)
instead of case f(_, r)
OtherInputPatternF: none of the above (could be a case class or a general unapply
expression)
This is the main traverser that gathers information about molecule inputs and outputs in a reaction.
Nontrivial pattern matching expression that could contain unapply
, destructuring, and pattern @
variables.
Nontrivial pattern matching expression that could contain unapply
, destructuring, and pattern @
variables.
For instance, if c
is a molecule with values of type (Int, Option[Int])
then and example of nontrivial pattern match could be c( z@(x, Some(y)) )
.
In this example, we will have vars = List("z", "x", "y")
and matcher = { case z@(x, Some(y)) => (z, x, y) }
.
Tree of a partial function of type Any => Any
.
None
if the pattern is irrefutable; Some(guard expression tree)
if the pattern is not irrefutable and potentially requires a guard condition.
List of pattern variables in the order of their appearance in the syntax tree.
Describes the pattern matcher for output molecules.
Describes the pattern matcher for output molecules. This flag is used only within the macro code and is not exported to compiled code. The corresponding value of type OutputPatternType is exported to compiled code of the Reaction instance.
Possible values: ConstOutputPatternF(x): a(123) or a(Some(4)), etc. OtherOutputPatternF: a(x), a(x+y), or any other kind of expression. EmptyOutputPatternF: no argument given, i.e. bare molecule emitter value or reply emitter value
Represents a reply pattern consisting of a simple variable.
Represents a reply pattern consisting of a simple variable.
The Ident of a reply pattern variable.
Represents a pattern match with a simple pattern variable, such as a(x)
Represents a pattern match with a simple pattern variable, such as a(x)
The Ident of the pattern variable.
Input molecules in a reaction must be given using a chemical notation such as a(x) + b(y) + c(z) => ...
.
Input molecules in a reaction must be given using a chemical notation such as a(x) + b(y) + c(z) => ...
.
It is an error to group input molecules such as a(x) + (b(y) + c(z)) => ...
, or to use pattern grouping such as q @ a(x) + ...
Obtain the list of case
expressions in a reaction.
Obtain the list of case
expressions in a reaction.
There should be only one case
expression.
Represents an error situation.
Represents an error situation. The reply pseudo-molecule must be bound to a simple variable, but we found another pattern instead.
Convert a term to conjunctive normal form (CNF).
Convert a term to conjunctive normal form (CNF).
CNF is represented as a list of lists of Boolean term trees.
For example, List( List(q"x>0", q"y<x"), List(q"x>z", q"z<1") )
represents ( x > 0 || y < x ) && ( x > z || z < 1)
.
Initial expression tree.
Equivalent expression in CNF. Terms will be duplicated when necessary. No simplification is performed on terms.
Detect whether an expression tree represents a constant expression.
Detect whether an expression tree represents a constant expression. A constant expression is either a literal constant (Int, String, Symbol, etc.), (), None, Nil, or Some(...), Left(...), Right(...), List(...), and tuples of constant expressions.
Binder pattern tree or expression tree.
Some(tree)
if the expression represents a constant of the recognized form. Here tree
will be a quoted expression tree (not a binder tree). None
otherwise.
Obtain the owner of the current macro call site.
Obtain the owner of the current macro call site.
The owner symbol of the current macro call site.
Detect the enclosing name of an expression.
Detect the enclosing name of an expression.
For example: val x = "name is " + getName
will set x
to the string "name is x"
.
String that represents the name of the enclosing value.
Detect whether a pattern-matcher expression tree represents an irrefutable pattern.
Detect whether a pattern-matcher expression tree represents an irrefutable pattern.
For example, Some(_)
is refutable because it does not match None
.
The pattern (_, x, y, (z, _))
is irrefutable.
Patterns with single-case-classes are irrefutable.
Binder pattern tree.
true
or false
Build an error message about incorrect usage of chemical notation.
Build an error message about incorrect usage of chemical notation. The phrase looks like this: (Beginning of phrase) must (Phrase connector) (What was incorrect) (molecule list)
Type of molecule or other object.
Beginning of phrase.
What was incorrect about the molecule usage.
List of molecules (or other objects) that were incorrectly used.
Phrase connector. By default: "not contain a pattern that"
.
How to report the error; by default, will use c.error
.