kiama.rewriting.Rewriter

class Strategy

[source: kiama/rewriting/Rewriter.scala]

abstract class Strategy
extends (AnyRef) => scala.Option[AnyRef]
Term-rewriting strategies.
Direct Known Subclasses:
Rewriter.PlusStrategy

Method Summary
def + (q : => Strategy) : PlusStrategy
Non-deterministic choice. Normally, construct a strategy that first applies either this strategy or the given strategy. If it succeeds, succeed with the resulting term. Otherwise, apply q. Currently implemented as deterministic choice, but this behaviour should not be relied upon. When used as the argument to the < conditional choice combinator, + just serves to hold the two strategies that are chosen between by the conditional choice.
def < (lr : => PlusStrategy) : Strategy
Conditional choice: c < l + r. Construct a strategy that first applies this strategy (c). If it succeeds, apply l to the resulting term, otherwise apply r to the original subject term.
def <* (q : => Strategy) : Strategy
Sequential composition. Construct a strategy that first applies this strategy. If it succeeds, then apply q to the new subject term. Otherwise fail.
def <+ (q : => Strategy) : Strategy
Deterministic choice. Construct a strategy that first applies this strategy. If it succeeds, succeed with the resulting term. Otherwise, apply q to the original subject term.
abstract def apply (r : AnyRef) : scala.Option[AnyRef]
Apply this strategy to a term, producing either a transformed term or None, representing a rewriting failure.
Methods inherited from scala.Function1
scala.Function1.toString, scala.Function1.compose, scala.Function1.andThen
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
abstract def apply(r : AnyRef) : scala.Option[AnyRef]
Apply this strategy to a term, producing either a transformed term or None, representing a rewriting failure.
Overrides
scala.Function1.scala.Function1.apply

def <*(q : => Strategy) : Strategy
Sequential composition. Construct a strategy that first applies this strategy. If it succeeds, then apply q to the new subject term. Otherwise fail.

def <+(q : => Strategy) : Strategy
Deterministic choice. Construct a strategy that first applies this strategy. If it succeeds, succeed with the resulting term. Otherwise, apply q to the original subject term.

def +(q : => Strategy) : PlusStrategy
Non-deterministic choice. Normally, construct a strategy that first applies either this strategy or the given strategy. If it succeeds, succeed with the resulting term. Otherwise, apply q. Currently implemented as deterministic choice, but this behaviour should not be relied upon. When used as the argument to the < conditional choice combinator, + just serves to hold the two strategies that are chosen between by the conditional choice.

def <(lr : => PlusStrategy) : Strategy
Conditional choice: c < l + r. Construct a strategy that first applies this strategy (c). If it succeeds, apply l to the resulting term, otherwise apply r to the original subject term.