trait MemoRewriter extends Rewriter with Memoiser
Strategy-based term rewriting where all strategy results are memoised by identity on the subject term.
- Source
- MemoRewriter.scala
- Alphabetic
- By Inheritance
- MemoRewriter
- Memoiser
- Rewriter
- RewriterCore
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- abstract class MemoStrategy extends Strategy with IdMemoised[Any, Option[Any]]
-
trait
IdMemoised
[T, U] extends MemoisedBase[T, U]
A memoised entity that weakly holds onto its keys and uses identity to compare them.
A memoised entity that weakly holds onto its keys and uses identity to compare them.
- Definition Classes
- Memoiser
-
trait
Memoised
[T, U] extends MemoisedBase[T, U]
A memoised entity that uses equality to compare keys.
A memoised entity that uses equality to compare keys.
- Definition Classes
- Memoiser
-
trait
MemoisedBase
[T, U] extends AnyRef
Common interface for encapsulation of memoisation for a single memoised entity backed by a configurable cache.
Common interface for encapsulation of memoisation for a single memoised entity backed by a configurable cache.
- Definition Classes
- Memoiser
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
all(name: String, s: ⇒ Strategy): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
all(s: Strategy): Strategy
Traversal to all children.
Traversal to all children. Construct a strategy that applies
sto all term children of the subject term. Ifssucceeds on all of the children, then succeed, forming a new term from the constructor of the original term and the result ofsfor each child. Ifsfails on any child, fail. If there are no children, succeed. Ifssucceeds on all children producing the same terms (byeqfor references and by==for other values), then the overall strategy returns the subject term. This operation works on finiteRewritable,Product,MapandTraversablevalues, checked for in that order. Children of aRewritable(resp. Product, collection) value are processed in the order returned by the value's deconstruct (resp.productElement,foreach) method.sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
allMap[CC[V, W] <: Map[V, W]](s: Strategy, t: CC[Any, Any])(implicit cbf: CanBuildFrom[CC[Any, Any], (Any, Any), CC[Any, Any]]): Option[CC[Any, Any]]
Implementation of
allforMapvalues.Implementation of
allforMapvalues.- Definition Classes
- RewriterCore
-
def
allProduct(s: Strategy, p: Product): Option[Any]
Implementation of
allforProductvalues.Implementation of
allforProductvalues.- Definition Classes
- RewriterCore
-
def
allRewritable(s: Strategy, r: Rewritable): Option[Any]
Implementation of
allforRewritablevalues.Implementation of
allforRewritablevalues.- Definition Classes
- RewriterCore
-
def
allTraversable[CC[U] <: Traversable[U]](s: Strategy, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]
Implementation of
allforTraversablevalues.Implementation of
allforTraversablevalues.- Definition Classes
- RewriterCore
-
def
allbu(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.allbu
-
macro
def
allbu(s: Strategy): Strategy
Construct a strategy that applies
sin a bottom-up fashion to all subterms at each level, stopping at a frontier where s succeeds.Construct a strategy that applies
sin a bottom-up fashion to all subterms at each level, stopping at a frontier where s succeeds.- Definition Classes
- RewriterCore
-
def
alldownup2(name: String, s1: Strategy, s2: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.alldownup2
-
macro
def
alldownup2(s1: Strategy, s2: Strategy): Strategy
Construct a strategy that applies
s1in a top-down, prefix fashion stopping at a frontier wheres1succeeds.Construct a strategy that applies
s1in a top-down, prefix fashion stopping at a frontier wheres1succeeds.s2is applied in a bottom-up, postfix fashion to the result.- Definition Classes
- RewriterCore
-
def
alltd(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.alltd
-
macro
def
alltd(s: Strategy): Strategy
Construct a strategy that applies
sin a top-down fashion, stopping at a frontier where s succeeds.Construct a strategy that applies
sin a top-down fashion, stopping at a frontier where s succeeds.- Definition Classes
- RewriterCore
-
def
alltdfold(name: String, s1: Strategy, s2: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.alltdfold
-
macro
def
alltdfold(s1: Strategy, s2: Strategy): Strategy
Construct a strategy that applies
s1in a top-down, prefix fashion stopping at a frontier wheres1succeeds.Construct a strategy that applies
s1in a top-down, prefix fashion stopping at a frontier wheres1succeeds.s2is applied in a bottom-up, postfix fashion to the results of the recursive calls.- Definition Classes
- RewriterCore
-
def
and(name: String, s1: Strategy, s2: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.and
-
macro
def
and(s1: Strategy, s2: Strategy): Strategy
and(s1, s2)appliess1ands2to the subject term and succeeds if both succeed.and(s1, s2)appliess1ands2to the subject term and succeeds if both succeed.s2will always be applied, i.e., and is not a short-circuit operator- Definition Classes
- RewriterCore
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
attempt(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.attempt
-
macro
def
attempt(s: Strategy): Strategy
Construct a strategy that applies
s, yielding the result ofsif it succeeds, otherwise leave the original subject term unchanged.Construct a strategy that applies
s, yielding the result ofsif it succeeds, otherwise leave the original subject term unchanged. In Stratego library this strategy is calledtry.- Definition Classes
- RewriterCore
-
def
bottomup(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.bottomup
-
macro
def
bottomup(s: Strategy): Strategy
Construct a strategy that applies
sin a bottom-up, postfix fashion to the subject term.Construct a strategy that applies
sin a bottom-up, postfix fashion to the subject term.- Definition Classes
- RewriterCore
-
def
bottomupS(name: String, s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.bottomupS
-
macro
def
bottomupS(s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
Construct a strategy that applies
sin a bottom-up, postfix fashion to the subject term but stops when the strategy produced bystopsucceeds.Construct a strategy that applies
sin a bottom-up, postfix fashion to the subject term but stops when the strategy produced bystopsucceeds.stopis given the whole strategy itself as its argument.- Definition Classes
- RewriterCore
-
def
breadthfirst(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.breadthfirst
-
macro
def
breadthfirst(s: Strategy): Strategy
Construct a strategy that applies
sin breadth first order.Construct a strategy that applies
sin breadth first order. This strategy does not applysto the root of the subject term.It is called
breadthfirstto follow Stratego's library, but is not really conducting a breadth-first traversal since all of the descendants of the first child of a term are visited before any of the descendants of the second child of a term.- Definition Classes
- RewriterCore
-
def
build(name: String, t: ⇒ Any): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
build(t: Any): Strategy
Construct a strategy that always succeeds, changing the subject term to the given term
t.Construct a strategy that always succeeds, changing the subject term to the given term
t. The termtis evaluated at most once.- Definition Classes
- RewriterCore
-
def
child(name: String, i: Int, s: ⇒ Strategy): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
child(i: Int, s: Strategy): Strategy
Traversal to a single child.
Traversal to a single child. Construct a strategy that applies
sto the ith child of the subject term (counting from one). Ifssucceeds on the ith child producingt, then succeed, forming a new term that is the same as the original term except that the ith child is nowt. Ifsfails on the ith child or the subject term does not have an ith child, then fail.child(i, s)is equivalent to Stratego'si(s)operator. Ifssucceeds on the ith child producing the same term (byeqfor references and by==for other values), then the overall strategy returns the subject term. This operation works for instances ofProductor finiteSeqvalues.sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
childProduct(s: Strategy, i: Int, p: Product): Option[Any]
Implementation of
childforProductvalues.Implementation of
childforProductvalues.- Definition Classes
- RewriterCore
-
def
childSeq[CC[U] <: Seq[U]](s: Strategy, i: Int, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]
Implementation of
childforSeqvalues.Implementation of
childforSeqvalues.- Definition Classes
- RewriterCore
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
macro
def
collect[CC[X] <: Traversable[X], U](f: ==>[Any, U])(implicit cbf: CanBuildFrom[CC[Any], U, CC[U]]): (Any) ⇒ CC[U]
Collect query results in a traversable collection.
Collect query results in a traversable collection. Run the function
fas a top-down left-to-right query on the subject term. Each application offreturns a single value. All of these values are accumulated in the collection.- Definition Classes
- RewriterCore
-
def
collectWithName[CC[X] <: Traversable[X], U](name: String, f: ==>[Any, U])(implicit cbf: CanBuildFrom[CC[Any], U, CC[U]]): (Any) ⇒ CC[U]
As for
collectinRewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for
collectinRewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.collect
-
macro
def
collectall[CC[X] <: Traversable[X], U](f: ==>[Any, CC[U]])(implicit cbf: CanBuildFrom[CC[Any], U, CC[U]]): (Any) ⇒ CC[U]
Collect query results in a traversable collection.
Collect query results in a traversable collection. Run the function
fas a top-down left-to-right query on the subject term. Each application offreturns a collection of values. All of these values are accumulated in the collection.- Definition Classes
- RewriterCore
-
def
collectallWithName[CC[X] <: Traversable[X], U](name: String, f: ==>[Any, CC[U]])(implicit cbf: CanBuildFrom[CC[Any], U, CC[U]]): (Any) ⇒ CC[U]
As for
collectallinRewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for
collectallinRewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.collectall
-
def
collectl[U](f: ==>[Any, U]): (Any) ⇒ List[U]
Collect query results in a list.
Collect query results in a list. Run the function
fas a top-down left-to-right query on the subject term. Accumulate the values produced by the function in a list and return the final value of the list.- Definition Classes
- Rewriter
-
def
collects[U](f: ==>[Any, U]): (Any) ⇒ Set[U]
Collect query results in a set.
Collect query results in a set. Run the function
fas a top-down left-to-right query on the subject term. Accumulate the values produced by the function in a set and return the final value of the set.- Definition Classes
- Rewriter
-
def
congruence(name: String, ss: Strategy*): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
congruence(ss: Strategy*): Strategy
Make a strategy that applies the elements of ss pairwise to the children of the subject term, returning a new term if all of the strategies succeed, otherwise failing.
Make a strategy that applies the elements of ss pairwise to the children of the subject term, returning a new term if all of the strategies succeed, otherwise failing. The constructor of the new term is the same as that of the original term and the children are the results of the strategies. If the length of
ssis not the same as the number of children, thencongruence(ss)fails. If the argument strategies succeed on children producing the same terms (byeqfor references and by==for other values), then the overall strategy returns the subject term. This operation works on instances ofProductvalues.- Definition Classes
- RewriterCore
-
def
congruenceProduct(p: Product, ss: Strategy*): Option[Any]
Implementation of
congruenceforProductvalues.Implementation of
congruenceforProductvalues.- Definition Classes
- RewriterCore
-
def
count(name: String, f: ==>[Any, Int]): (Any) ⇒ Int
Count function results.
Count function results. Run the function
fas a top-down query on the subject term. Sum the integer values returned byffrom all applications.- Definition Classes
- Rewriter
-
macro
def
count(f: ==>[Any, Int]): (Any) ⇒ Int
Count function results.
Count function results. Run the function
fas a top-down query on the subject term. Sum the integer values returned byffrom all applications.- Definition Classes
- RewriterCore
-
def
debug(name: String, msg: String, emitter: Emitter): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
debug(msg: String, emitter: Emitter = new OutputEmitter): Strategy
A strategy that always succeeds with the subject term unchanged (i.e., this is the identity strategy) with the side-effect that the subject term is printed to the given emitter, prefixed by the string
s.A strategy that always succeeds with the subject term unchanged (i.e., this is the identity strategy) with the side-effect that the subject term is printed to the given emitter, prefixed by the string
s. The emitter defaults to one that writes to standard output.- Definition Classes
- RewriterCore
-
def
doloop(name: String, s: Strategy, r: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.doloop
-
macro
def
doloop(s: Strategy, r: Strategy): Strategy
Construct a strategy that applies
sat least once and then repeatsswhilersucceeds.Construct a strategy that applies
sat least once and then repeatsswhilersucceeds. This operator is calleddo-whilein the Stratego library.- Definition Classes
- RewriterCore
-
def
dontstop(s: ⇒ Strategy): Strategy
A unit for
topdownS,bottomupSanddownupS.A unit for
topdownS,bottomupSanddownupS. For example,topdown(s)is equivalent totopdownS(s, dontstop).- Definition Classes
- Rewriter
-
def
downup(name: String, s1: Strategy, s2: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.downup
-
def
downup(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.downup
-
macro
def
downup(s1: Strategy, s2: Strategy): Strategy
Construct a strategy that applies
s1in a top-down, prefix fashion ands2in a bottom-up, postfix fashion to the subject term.Construct a strategy that applies
s1in a top-down, prefix fashion ands2in a bottom-up, postfix fashion to the subject term.- Definition Classes
- RewriterCore
-
macro
def
downup(s: Strategy): Strategy
Construct a strategy that applies
sin a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject term.Construct a strategy that applies
sin a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject term.- Definition Classes
- RewriterCore
-
def
downupS(name: String, s1: Strategy, s2: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.downupS
-
def
downupS(name: String, s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.downupS
-
macro
def
downupS(s1: Strategy, s2: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
Construct a strategy that applies
s1in a top-down, prefix fashion ands2in a bottom-up, postfix fashion to the subject term but stops when the strategy produced bystopsucceeds.Construct a strategy that applies
s1in a top-down, prefix fashion ands2in a bottom-up, postfix fashion to the subject term but stops when the strategy produced bystopsucceeds.stopis given the whole strategy itself as its argument.- Definition Classes
- RewriterCore
-
macro
def
downupS(s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
Construct a strategy that applies
sin a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject but stops when the strategy produced bystopsucceeds.Construct a strategy that applies
sin a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject but stops when the strategy produced bystopsucceeds.stopis given the whole strategy itself as its argument.- Definition Classes
- RewriterCore
-
def
dup[T <: Product](t: T, children: Seq[AnyRef]): T
The duplicator used by the generic traversals.
The duplicator used by the generic traversals. Needs to be defined as a method so we can override it in other rewriting modules.
- Definition Classes
- RewriterCore
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
val
eq: Strategy
A strategy that tests whether the two sub-terms of a pair of terms are equal.
A strategy that tests whether the two sub-terms of a pair of terms are equal.
- Definition Classes
- Rewriter
-
val
equal: Strategy
Construct a strategy that tests whether the two sub-terms of a pair of terms are equal.
Construct a strategy that tests whether the two sub-terms of a pair of terms are equal. Synonym for
eq.- Definition Classes
- Rewriter
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
everything[T](name: String, v: T)(f: (T, T) ⇒ T)(g: ==>[Any, T])(t: Any): T
Apply the function at every term in
tin a top-down, left-to-right order.Apply the function at every term in
tin a top-down, left-to-right order. Collect the resultingTvalues by accumulating them usingfwith initial left valuev. Return the final value of the accumulation.- Definition Classes
- Rewriter
-
macro
def
everything[T](v: T)(f: (T, T) ⇒ T)(g: ==>[Any, T])(t: Any): T
Apply the function at every term in
tin a top-down, left-to-right order.Apply the function at every term in
tin a top-down, left-to-right order. Collect the resultingTvalues by accumulating them usingfwith initial left valuev. Return the final value of the accumulation.- Definition Classes
- RewriterCore
-
def
everywhere(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.everywhere
-
macro
def
everywhere(s: Strategy): Strategy
Same as
everywheretd.Same as
everywheretd.- Definition Classes
- RewriterCore
-
def
everywherebu(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.everywherebu
-
macro
def
everywherebu(s: Strategy): Strategy
Construct a strategy that applies
sat all terms in a bottom-up fashion regardless of failure.Construct a strategy that applies
sat all terms in a bottom-up fashion regardless of failure. Terms for which the strategy fails are left unchanged.- Definition Classes
- RewriterCore
-
def
everywheretd(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.everywheretd
-
macro
def
everywheretd(s: Strategy): Strategy
Construct a strategy that applies
sat all terms in a top-down fashion regardless of failure.Construct a strategy that applies
sat all terms in a top-down fashion regardless of failure. Terms for which the strategy fails are left unchanged.- Definition Classes
- RewriterCore
-
val
fail: Strategy
A strategy that always fails.
A strategy that always fails.
- Definition Classes
- RewriterCore
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
val
id: Strategy
A strategy that always succeeds.
A strategy that always succeeds.
- Definition Classes
- RewriterCore
-
def
innermost(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.innermost
-
macro
def
innermost(s: Strategy): Strategy
Construct a strategy that applies
srepeatedly to the innermost (i.e., lowest and left-most) (sub-)term to which it applies.Construct a strategy that applies
srepeatedly to the innermost (i.e., lowest and left-most) (sub-)term to which it applies. Stop with the subject term ifsdoesn't apply anywhere.- Definition Classes
- RewriterCore
-
def
innermost2(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.innermost2
-
macro
def
innermost2(s: Strategy): Strategy
An alternative version of
innermost.An alternative version of
innermost.- Definition Classes
- RewriterCore
-
def
ior(name: String, s1: Strategy, s2: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.ior
-
macro
def
ior(s1: Strategy, s2: Strategy): Strategy
ior(s1, s2)implements inclusive OR, that is, the inclusive choice ofs1ands2.ior(s1, s2)implements inclusive OR, that is, the inclusive choice ofs1ands2. It first triess1. If that fails it appliess2(just likes1 <+ s2). However, whens1succeeds it also tries to applys2.- Definition Classes
- RewriterCore
-
def
isDefinedAtArg[T](anyf: ==>[Any, T], t: Any): Boolean
Is the function
anyfdefined at the domain valuet? Allows for case thatanyfmay actually have a more specific domain andtmay not be of the domain type.Is the function
anyfdefined at the domain valuet? Allows for case thatanyfmay actually have a more specific domain andtmay not be of the domain type. Relies on implementation that does a cast at the beginning of theapplyfor a partial function literal.- Definition Classes
- RewriterCore
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
isinnernode: Strategy
Construct a strategy that succeeds if the current term has at least one direct subterm.
Construct a strategy that succeeds if the current term has at least one direct subterm.
- Definition Classes
- Rewriter
-
val
isleaf: Strategy
Construct a strategy that succeeds if the current term has no direct subterms.
Construct a strategy that succeeds if the current term has no direct subterms.
- Definition Classes
- Rewriter
-
val
ispropersubterm: Strategy
Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a sub-term ofybut is not equal toy.Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a sub-term ofybut is not equal toy.- Definition Classes
- Rewriter
-
val
ispropersuperterm: Strategy
Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a super-term ofybut is not equal toy.Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a super-term ofybut is not equal toy.- Definition Classes
- Rewriter
-
val
issubterm: Strategy
Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a sub-term ofy.Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a sub-term ofy.- Definition Classes
- Rewriter
-
val
issuperterm: Strategy
Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a superterm ofy.Construct a strategy that succeeds when applied to a pair
(x,y)ifxis a superterm ofy.- Definition Classes
- Rewriter
-
def
lastly(name: String, s: Strategy, f: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.lastly
-
macro
def
lastly(s: Strategy, f: Strategy): Strategy
Applies
sfollowed byfwhethersfailed or not.Applies
sfollowed byfwhethersfailed or not. This operator is calledfinallyin the Stratego library.- Definition Classes
- RewriterCore
-
def
leaves(name: String, s: Strategy, isleaf: Strategy, skip: (Strategy) ⇒ Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.leaves
-
def
leaves(name: String, s: Strategy, isleaf: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.leaves
-
macro
def
leaves(s: Strategy, isleaf: Strategy, skip: (Strategy) ⇒ Strategy): Strategy
Construct a strategy that applies to all of the leaves of the subject term, using
isleafas the leaf predicate, skipping subterms for whichskipwhen applied to the result succeeds.Construct a strategy that applies to all of the leaves of the subject term, using
isleafas the leaf predicate, skipping subterms for whichskipwhen applied to the result succeeds.- Definition Classes
- RewriterCore
-
macro
def
leaves(s: Strategy, isleaf: Strategy): Strategy
Construct a strategy that applies to all of the leaves of the subject term, using
isleafas the leaf predicate.Construct a strategy that applies to all of the leaves of the subject term, using
isleafas the leaf predicate.- Definition Classes
- RewriterCore
-
def
log(name: String, s: ⇒ Strategy, msg: String, emitter: Emitter): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
log(s: Strategy, msg: String, emitter: Emitter = new ErrorEmitter): Strategy
Create a logging strategy based on a strategy
s.Create a logging strategy based on a strategy
s. The returned strategy succeeds or fails exactly assdoes, but also prints the provided message, the subject term, the success or failure status, and on success, the result term, to the provided emitter (default: standard error).sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
logfail[T](name: String, s: ⇒ Strategy, msg: String, emitter: Emitter): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
logfail[T](s: Strategy, msg: String, emitter: Emitter = new ErrorEmitter): Strategy
Create a logging strategy based on a strategy
s.Create a logging strategy based on a strategy
s. The returned strategy succeeds or fails exactly assdoes, but ifsfails, also prints the provided message and the subject term to the provided emitter (default: standard error).sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
loop(name: String, c: Strategy, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.loop
-
macro
def
loop(r: Strategy, s: Strategy): Strategy
Construct a strategy that while
rsucceeds appliess.Construct a strategy that while
rsucceeds appliess. This operator is calledwhilein the Stratego library.- Definition Classes
- RewriterCore
-
def
loopiter(name: String, s: (Int) ⇒ Strategy, low: Int, high: Int): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.loopiter
-
def
loopiter(name: String, i: Strategy, r: Strategy, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.loopiter
-
macro
def
loopiter(s: (Int) ⇒ Strategy, low: Int, high: Int): Strategy
Construct a strategy that applies
s(i)for each integerifromlowtohigh(inclusive).Construct a strategy that applies
s(i)for each integerifromlowtohigh(inclusive). This operator is calledforin the Stratego library.- Definition Classes
- RewriterCore
-
macro
def
loopiter(i: Strategy, r: Strategy, s: Strategy): Strategy
Construct a strategy that repeats application of
swhilerfails, after initialization withi.Construct a strategy that repeats application of
swhilerfails, after initialization withi. This operator is calledforin the Stratego library.- Definition Classes
- RewriterCore
-
def
loopnot(name: String, r: Strategy, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.loopnot
-
macro
def
loopnot(r: Strategy, s: Strategy): Strategy
Construct a strategy that while
rdoes not succeed appliess.Construct a strategy that while
rdoes not succeed appliess. This operator is calledwhile-notin the Stratego library.- Definition Classes
- RewriterCore
-
def
makechild(c: Any): AnyRef
Make an arbitrary value
cinto a term child, checking that it worked properly.Make an arbitrary value
cinto a term child, checking that it worked properly. Object references will be returned unchanged; other values will be boxed.- Attributes
- protected
- Definition Classes
- RewriterCore
-
def
manybu(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.manybu
-
macro
def
manybu(s: Strategy): Strategy
Construct a strategy that applies
sas many times as possible, but at least once, in bottom up order.Construct a strategy that applies
sas many times as possible, but at least once, in bottom up order.- Definition Classes
- RewriterCore
-
def
manytd(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.manytd
-
macro
def
manytd(s: Strategy): Strategy
Construct a strategy that applies
sas many times as possible, but at least once, in top down order.Construct a strategy that applies
sas many times as possible, but at least once, in top down order.- Definition Classes
- RewriterCore
-
def
map(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.map
-
macro
def
map(s: Strategy): Strategy
Construct a strategy that applies
sto each element of a sequence, returning a new sequence of the results if all of the applications succeed, otherwise fail.Construct a strategy that applies
sto each element of a sequence, returning a new sequence of the results if all of the applications succeed, otherwise fail. If all of the applications succeed without change, return the input sequence.- Definition Classes
- RewriterCore
-
def
memo(name: String, s: ⇒ Strategy): Strategy
Build a memoising strategy.
Build a memoising strategy. Since all strategies here are memoised, this method is the identity.
- Definition Classes
- MemoRewriter → RewriterCore
-
macro
def
memo(s: Strategy): Strategy
Return a strategy that behaves as
sdoes, but memoises its arguments and results.Return a strategy that behaves as
sdoes, but memoises its arguments and results. In other words, ifmemo(s)is called on a termttwice, the second time will return the same result as the first, without having to invokes. For best results, it is important thatsshould have no side effects.sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
mkStrategy(name: String, f: (Any) ⇒ Option[Any]): Strategy
Make a memoising strategy with the given name and body
f.Make a memoising strategy with the given name and body
f.- Definition Classes
- MemoRewriter → RewriterCore
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
not(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.not
-
macro
def
not(s: Strategy): Strategy
Construct a strategy that applies
s, then fails ifssucceeded or, ifsfailed, succeeds with the subject term unchanged, I.e., it tests ifsapplies, but has no effect on the subject term.Construct a strategy that applies
s, then fails ifssucceeded or, ifsfailed, succeeds with the subject term unchanged, I.e., it tests ifsapplies, but has no effect on the subject term.- Definition Classes
- RewriterCore
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
oncebu(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.oncebu
-
macro
def
oncebu(s: Strategy): Strategy
Construct a strategy that applies
sin a bottom-up fashion to one subterm at each level, stopping as soon as it succeeds once (at any level).Construct a strategy that applies
sin a bottom-up fashion to one subterm at each level, stopping as soon as it succeeds once (at any level).- Definition Classes
- RewriterCore
-
def
oncetd(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.oncetd
-
macro
def
oncetd(s: Strategy): Strategy
Construct a strategy that applies
sin a top-down fashion to one subterm at each level, stopping as soon as it succeeds once (at any level).Construct a strategy that applies
sin a top-down fashion to one subterm at each level, stopping as soon as it succeeds once (at any level).- Definition Classes
- RewriterCore
-
def
one(name: String, s: ⇒ Strategy): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
one(s: Strategy): Strategy
Traversal to one child.
Traversal to one child. Construct a strategy that applies
sto the term children of the subject term. Assume thatcis the first child on which s succeeds. Then stop applyingsto the children and succeed, forming a new term from the constructor of the original term and the original children, except thatcis replaced by the result of applyingstoc. In the event that the strategy fails on all children, then fail. If there are no children, fail. Ifssucceeds on the one child producing the same term (byeqfor references and by==for other values), then the overall strategy returns the subject term. This operation works on instances of finiteRewritable,Product,MapandTraversablevalues, checked for in that order. Children of aRewritable(resp.Product, collection) value are processed in the order returned by the value'sdeconstruct(resp.productElement,foreach) method.sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
oneMap[CC[V, W] <: Map[V, W]](s: Strategy, t: CC[Any, Any])(implicit cbf: CanBuildFrom[CC[Any, Any], (Any, Any), CC[Any, Any]]): Option[CC[Any, Any]]
Implementation of
oneforMapvalues.Implementation of
oneforMapvalues.- Definition Classes
- RewriterCore
-
def
oneProduct(s: Strategy, p: Product): Option[Any]
Implementation of
oneforProductvalues.Implementation of
oneforProductvalues.- Definition Classes
- RewriterCore
-
def
oneRewritable(s: Strategy, r: Rewritable): Option[Any]
Implementation of
oneforRewritablevalues.Implementation of
oneforRewritablevalues.- Definition Classes
- RewriterCore
-
def
oneTraversable[CC[U] <: Traversable[U]](s: Strategy, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]
Implementation of
oneforTraversablevalues.Implementation of
oneforTraversablevalues.- Definition Classes
- RewriterCore
-
def
option(name: String, o: ⇒ Option[Any]): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
option(o: Option[Any]): Strategy
Construct a strategy from an option value
o.Construct a strategy from an option value
o. The strategy succeeds or fails depending on whetherois a Some or None, respectively. Ifois aSome, then the subject term is changed to the term that is wrapped by theSome.ois evaluated at most once.- Definition Classes
- RewriterCore
-
def
or(name: String, s1: Strategy, s2: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.or
-
macro
def
or(s1: Strategy, s2: Strategy): Strategy
or(s1, s2)is similar toior(s1, s2), but the application of the strategies is only tested.or(s1, s2)is similar toior(s1, s2), but the application of the strategies is only tested.- Definition Classes
- RewriterCore
-
def
outermost(name: String, s: Strategy): Strategy
- Definition Classes
- Rewriter
-
macro
def
outermost(s: Strategy): Strategy
Construct a strategy that applies
srepeatedly in a top-down fashion stopping each time as soon as it succeeds once (at any level).Construct a strategy that applies
srepeatedly in a top-down fashion stopping each time as soon as it succeeds once (at any level). The outermost fails whensfails to apply to any (sub-)term.- Definition Classes
- RewriterCore
-
def
para[T](f: (Any, Seq[T]) ⇒ T): (Any) ⇒ T
Perform a paramorphism over a value.
Perform a paramorphism over a value. This is a fold in which the recursive step may refer to the recursive component of the value and the results of folding over the children. When the function
fis called, the first parameter is the value and the second is a sequence of the values thatfhas returned for the children. his will work on any value, but will only decompose values that are supported by theTermgeneric term deconstruction. This operation is similar to that used in the Uniplate library.- Definition Classes
- RewriterCore
-
macro
def
query[T](f: ==>[T, Unit]): Strategy
Define a term query by a partial function
f.Define a term query by a partial function
f. The query always succeeds with no effect on the subject term but applies the given partial functionfto the subject term. In other words, the strategy runsffor its side-effects. If the subject term is not aTor the function is not defined at the subject term, the strategy fails.Due to the type erasure performed on Scala programs the type test will be imprecise for some types. E.g., it is not possible to tell the difference between
List[Int]andList[String].- Definition Classes
- RewriterCore
-
def
queryWithName[T](name: String, f: ==>[T, Unit]): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
def
queryf(name: String, f: (Any) ⇒ Unit): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
queryf(f: (Any) ⇒ Unit): Strategy
Define a term query by a function
f.Define a term query by a function
f. The query always succeeds with no effect on the subject term but applies the given (possibly partial) functionfto the subject term. In other words, the strategy runsffor its side-effects.- Definition Classes
- RewriterCore
-
def
reduce(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.reduce
-
macro
def
reduce(s: Strategy): Strategy
Construct a strategy that applies
srepeatedly to subterms until it fails on all of them.Construct a strategy that applies
srepeatedly to subterms until it fails on all of them.- Definition Classes
- RewriterCore
-
def
repeat(name: String, s: Strategy, n: Int): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.repeat
-
def
repeat(name: String, s: Strategy, r: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.repeat
-
def
repeat(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.repeat
-
macro
def
repeat(s: Strategy, n: Int): Strategy
Construct a strategy that applies
srepeatedly exactlyntimes.Construct a strategy that applies
srepeatedly exactlyntimes. Ifsfails at some point during the n applications, the entire strategy fails. The result of the strategy is that of the nth application ofs.- Definition Classes
- RewriterCore
-
macro
def
repeat(s: Strategy, r: Strategy): Strategy
Construct a strategy that repeatedly applies
suntil it fails and then terminates with application ofr.Construct a strategy that repeatedly applies
suntil it fails and then terminates with application ofr.- Definition Classes
- RewriterCore
-
macro
def
repeat(s: Strategy): Strategy
Construct a strategy that applies
srepeatedly until it fails.Construct a strategy that applies
srepeatedly until it fails.- Definition Classes
- RewriterCore
-
def
repeat1(name: String, s: Strategy, r: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.repeat1
-
def
repeat1(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.repeat1
-
macro
def
repeat1(s: Strategy, r: Strategy): Strategy
Construct a strategy that repeatedly applies
s(at least once) and terminates with application ofc.Construct a strategy that repeatedly applies
s(at least once) and terminates with application ofc.- Definition Classes
- RewriterCore
-
macro
def
repeat1(s: Strategy): Strategy
Construct a strategy that repeatedly applies
s(at least once).Construct a strategy that repeatedly applies
s(at least once).- Definition Classes
- RewriterCore
-
def
repeatuntil(name: String, s: Strategy, r: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.repeatuntil
-
macro
def
repeatuntil(s: Strategy, r: Strategy): Strategy
Construct a strategy that repeatedly applies
suntilcsucceeds.Construct a strategy that repeatedly applies
suntilcsucceeds.- Definition Classes
- RewriterCore
-
def
resetMemo(): Unit
Lazily reset all memoisation tables.
Lazily reset all memoisation tables. The actual resets will only happen the next time the value of each attribute is accessed.
- Definition Classes
- Memoiser
-
def
restore(name: String, s: Strategy, rest: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.restore
-
macro
def
restore(s: Strategy, rest: Strategy): Strategy
Construct a strategy that applies
s, then applies the restoring actionrestifsfails (and then fail).Construct a strategy that applies
s, then applies the restoring actionrestifsfails (and then fail). Otherwise, let the result ofsstand. Typically useful ifsperforms side effects that should be restored or undone whensfails.- Definition Classes
- RewriterCore
-
def
restorealways(name: String, s: Strategy, rest: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.restorealways
-
macro
def
restorealways(s: Strategy, rest: Strategy): Strategy
Construct a strategy that applies
s, then applies the restoring actionrestregardless of the success or failure ofs.Construct a strategy that applies
s, then applies the restoring actionrestregardless of the success or failure ofs. The whole strategy preserves the success or failure ofs. Typically useful ifsperforms side effects that should be restored always, e.g., when maintaining scope information.- Definition Classes
- RewriterCore
-
def
rewrite[T](s: Strategy)(t: T): T
Rewrite a term.
Rewrite a term. Apply the strategy
sto a term returning the result term ifssucceeds, otherwise return the original term.- Definition Classes
- Rewriter
-
macro
def
rule[T](f: ==>[T, T]): Strategy
Define a rewrite rule using a partial function
fdefined on the typeT.Define a rewrite rule using a partial function
fdefined on the typeT. If the subject term is aTand the function is defined at the subject term, then the strategy succeeds with the return value of the function applied to the subject term. Otherwise, the strategy fails.Due to the type erasure performed on Scala programs the type test will be imprecise for some types. E.g., it is not possible to tell the difference between
List[Int]andList[String].- Definition Classes
- RewriterCore
-
def
ruleWithName[T](name: String, f: ==>[T, T]): Strategy
As for
rulebut specifies the name for the constructed strategy.As for
rulebut specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
def
rulef(name: String, f: (Any) ⇒ Any): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
rulef(f: (Any) ⇒ Any): Strategy
Define a rewrite rule using a function
fthat returns a term.Define a rewrite rule using a function
fthat returns a term. The rule always succeeds with the return value of the function.- Definition Classes
- RewriterCore
-
macro
def
rulefs[T](f: ==>[T, Strategy]): Strategy
Define a rewrite rule using a function
fdefined on typeTthat returns a strategy.Define a rewrite rule using a function
fdefined on typeTthat returns a strategy. If the subject term is aTand the function is defined at the subject term, the rule applies the function to the subject term to get a strategy which is then applied again to the subject term. In other words, the function is only used for effects such as pattern matching. The whole thing also fails iffis not defined at the term in the first place.- Definition Classes
- RewriterCore
-
def
rulefsWithName[T](name: String, f: ==>[T, Strategy]): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
def
some(name: String, s: ⇒ Strategy): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
some(s: Strategy): Strategy
Traversal to as many children as possible, but at least one.
Traversal to as many children as possible, but at least one. Construct a strategy that applies
sto the term children of the subject term. Ifssucceeds on any of the children, then succeed, forming a new term from the constructor of the original term and the result ofsfor each succeeding child, with other children unchanged. In the event that the strategy fails on all children, then fail. If there are no children, fail. Ifssucceeds on children producing the same terms (byeqfor references and by==for other values), then the overall strategy returns the subject term. This operation works on instances of finiteRewritable,Product,MapandTraversablevalues, checked for in that order. Children of aRewritable(resp.Product, collection) value are processed in the order returned by the value'sdeconstruct(resp.productElement,foreach) method.sis evaluated at most once.- Definition Classes
- RewriterCore
-
def
someMap[CC[V, W] <: Map[V, W]](s: Strategy, t: CC[Any, Any])(implicit cbf: CanBuildFrom[CC[Any, Any], (Any, Any), CC[Any, Any]]): Option[CC[Any, Any]]
Implementation of
someforMapvalues.Implementation of
someforMapvalues.- Definition Classes
- RewriterCore
-
def
someProduct(s: Strategy, p: Product): Option[Any]
Implementation of
someforProductvalues.Implementation of
someforProductvalues.- Definition Classes
- RewriterCore
-
def
someRewritable(s: Strategy, r: Rewritable): Option[Any]
Implementation of
someforRewritablevalues.Implementation of
someforRewritablevalues.- Definition Classes
- RewriterCore
-
def
someTraversable[CC[U] <: Traversable[U]](s: Strategy, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]
Implementation of
someforTraversablevalues.Implementation of
someforTraversablevalues.- Definition Classes
- RewriterCore
-
def
somebu(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.somebu
-
macro
def
somebu(s: Strategy): Strategy
Construct a strategy that applies
sin a bottom-up fashion to some subterms at each level, stopping as soon as it succeeds once (at any level).Construct a strategy that applies
sin a bottom-up fashion to some subterms at each level, stopping as soon as it succeeds once (at any level).- Definition Classes
- RewriterCore
-
def
somedownup(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.somedownup
-
macro
def
somedownup(s: Strategy): Strategy
Construct a strategy that applies
sin a top-down, prefix fashion stopping at a frontier wheressucceeds on some children.Construct a strategy that applies
sin a top-down, prefix fashion stopping at a frontier wheressucceeds on some children.sis then applied in a bottom-up, postfix fashion to the result.- Definition Classes
- RewriterCore
-
def
sometd(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.sometd
-
macro
def
sometd(s: Strategy): Strategy
Construct a strategy that applies
sin a top-down fashion to some subterms at each level, stopping as soon as it succeeds once (at any level).Construct a strategy that applies
sin a top-down fashion to some subterms at each level, stopping as soon as it succeeds once (at any level).- Definition Classes
- RewriterCore
-
macro
def
strategy[T](f: ==>[T, Option[T]]): Strategy
Make a strategy from a partial function
fdefined on the typeT.Make a strategy from a partial function
fdefined on the typeT. If the subject term is aTand the function is defined at the subject term, then the function return value when applied to the subject term determines whether the strategy succeeds or fails. If the subject term is not aTor the function is not defined at the subject term, the strategy fails.Due to the type erasure performed on Scala programs the type test will be imprecise for some types. E.g., it is not possible to tell the difference between
List[Int]andList[String].- Definition Classes
- RewriterCore
-
def
strategyWithName[T](name: String, f: ==>[T, Option[T]]): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
def
strategyf(name: String, f: (Any) ⇒ Option[Any]): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
macro
def
strategyf(f: (Any) ⇒ Option[Any]): Strategy
Make a strategy from a function
f.Make a strategy from a function
f. The function return value determines whether the strategy succeeds or fails.- Definition Classes
- RewriterCore
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
macro
def
term[T](t: T): Strategy
Construct a strategy that succeeds only if the subject term matches the given term
t.Construct a strategy that succeeds only if the subject term matches the given term
t.- Definition Classes
- RewriterCore
-
def
termWithName[T](name: String, t: T): Strategy
As for the version without the
nameargument but specifies the name for the constructed strategy.As for the version without the
nameargument but specifies the name for the constructed strategy.- Definition Classes
- RewriterCore
-
def
test(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.test
-
macro
def
test(s: Strategy): Strategy
Construct a strategy that tests whether strategy
ssucceeds, restoring the original term on success.Construct a strategy that tests whether strategy
ssucceeds, restoring the original term on success. A synonym forwhere.- Definition Classes
- RewriterCore
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
topdown(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.topdown
-
macro
def
topdown(s: Strategy): Strategy
Construct a strategy that applies
sin a top-down, prefix fashion to the subject term.Construct a strategy that applies
sin a top-down, prefix fashion to the subject term.- Definition Classes
- RewriterCore
-
def
topdownS(name: String, s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.topdownS
-
macro
def
topdownS(s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy
Construct a strategy that applies
sin a top-down, prefix fashion to the subject term but stops when the strategy produced bystopsucceeds.Construct a strategy that applies
sin a top-down, prefix fashion to the subject term but stops when the strategy produced bystopsucceeds.stopis given the whole strategy itself as its argument.- Definition Classes
- RewriterCore
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
where(name: String, s: Strategy): Strategy
As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.As for the version in
RewriterCorewithout thenameargument but specifies the name for the constructed strategy.- Definition Classes
- Rewriter
- See also
RewriterCore.where
-
macro
def
where(s: Strategy): Strategy
Construct a strategy that tests whether strategy
ssucceeds, restoring the original term on success.Construct a strategy that tests whether strategy
ssucceeds, restoring the original term on success. This is similar to Stratego'swhere, except that in this version any effects on bindings are not visible outsides.- Definition Classes
- RewriterCore
-
object
Duplicator
General product duplication functionality.
General product duplication functionality. This object is a function that returns a product that applies the same constructor as the product
t, but with the given children instead oft's children. The function fails if a constructor cannot be found, there are the wrong number of new children, or if one of the new children is not of the appropriate type.- Definition Classes
- RewriterCore
-
object
Term
Generic term deconstruction.
Generic term deconstruction.
- Definition Classes
- RewriterCore