Trait/Object

org.bitbucket.inkytonik.kiama.rewriting

PositionedRewriter

Related Docs: object PositionedRewriter | package rewriting

Permalink

trait PositionedRewriter extends CallbackRewriter

Strategy-based term rewriting that copies positions to rewritten terms. The positions are stored in a Kiama Positions object.

Specifically, this kind of rewriter will record positions of nodes when they are (a) rewritten as part of a generic traversal (e.g., all), or (b) rewritten as part of a rule or similar (e.g., rulefs).

In each case both the start and finish positions of the old node are copied across to the new node into which it is rewritten. In case (b) no attempt is made to assign positions to nodes that represent sub-terms of the term that results from a successful application of the rule. Override the rewriting method to add more specific behaviour.

Source
PositionedRewriter.scala
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PositionedRewriter
  2. CallbackRewriter
  3. Rewriter
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Duplicator

    Permalink

    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 of t'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
    Rewriter
  5. object Term

    Permalink

    Generic term deconstruction.

    Generic term deconstruction.

    Definition Classes
    Rewriter
  6. def all(s: ⇒ Strategy): Strategy

    Permalink

    Traversal to all children.

    Traversal to all children. Construct a strategy that applies s to all term children of the subject term. If s succeeds on all of the children, then succeed, forming a new term from the constructor of the original term and the result of s for each child. If s fails on any child, fail. If there are no children, succeed. If s succeeds on all children producing the same terms (by eq for references and by == for other values), then the overall strategy returns the subject term. This operation works on finite Rewritable, Product, Map and Iterable values, checked for in that order. Children of a Rewritable (resp. Product, collection) value are processed in the order returned by the value's deconstruct (resp. productElement, foreach) method. s is evaluated at most once.

    Definition Classes
    Rewriter
  7. def allIterable[CC[U] <: Iterable[U]](s: Strategy, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]

    Permalink

    Implementation of all for Iterable values.

    Implementation of all for Iterable values.

    Definition Classes
    Rewriter
  8. 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]]

    Permalink

    Implementation of all for Map values.

    Implementation of all for Map values.

    Definition Classes
    Rewriter
  9. def allProduct(s: Strategy, p: Product): Option[Any]

    Permalink

    Implementation of all for Product values.

    Implementation of all for Product values.

    Definition Classes
    Rewriter
  10. def allRewritable(s: Strategy, r: Rewritable): Option[Any]

    Permalink

    Implementation of all for Rewritable values.

    Implementation of all for Rewritable values.

    Definition Classes
    Rewriter
  11. def allbu(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a bottom-up fashion to all subterms at each level, stopping at a frontier where s succeeds.

    Construct a strategy that applies s in a bottom-up fashion to all subterms at each level, stopping at a frontier where s succeeds.

    Definition Classes
    Rewriter
  12. def alldownup2(s1: Strategy, s2: Strategy): Strategy

    Permalink

    Construct a strategy that applies s1 in a top-down, prefix fashion stopping at a frontier where s1 succeeds.

    Construct a strategy that applies s1 in a top-down, prefix fashion stopping at a frontier where s1 succeeds. s2 is applied in a bottom-up, postfix fashion to the result.

    Definition Classes
    Rewriter
  13. def alltd(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a top-down fashion, stopping at a frontier where s succeeds.

    Construct a strategy that applies s in a top-down fashion, stopping at a frontier where s succeeds.

    Definition Classes
    Rewriter
  14. def alltdfold(s1: Strategy, s2: Strategy): Strategy

    Permalink

    Construct a strategy that applies s1 in a top-down, prefix fashion stopping at a frontier where s1 succeeds.

    Construct a strategy that applies s1 in a top-down, prefix fashion stopping at a frontier where s1 succeeds. s2 is applied in a bottom-up, postfix fashion to the results of the recursive calls.

    Definition Classes
    Rewriter
  15. def and(s1: Strategy, s2: Strategy): Strategy

    Permalink

    and(s1, s2) applies s1 and s2 to the subject term and succeeds if both succeed.

    and(s1, s2) applies s1 and s2 to the subject term and succeeds if both succeed. s2 will always be applied, i.e., and is not a short-circuit operator.

    Definition Classes
    Rewriter
  16. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  17. def attempt(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s, yielding the result of s if it succeeds, otherwise leave the original subject term unchanged.

    Construct a strategy that applies s, yielding the result of s if it succeeds, otherwise leave the original subject term unchanged. In Stratego library this strategy is called try.

    Definition Classes
    Rewriter
  18. def bottomup(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a bottom-up, postfix fashion to the subject term.

    Construct a strategy that applies s in a bottom-up, postfix fashion to the subject term.

    Definition Classes
    Rewriter
  19. def bottomupS(s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a bottom-up, postfix fashion to the subject term but stops when the strategy produced by stop succeeds.

    Construct a strategy that applies s in a bottom-up, postfix fashion to the subject term but stops when the strategy produced by stop succeeds. stop is given the whole strategy itself as its argument.

    Definition Classes
    Rewriter
  20. def breadthfirst(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in breadth first order.

    Construct a strategy that applies s in breadth first order. This strategy does not apply s to the root of the subject term.

    It is called breadthfirst to 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
    Rewriter
  21. def build(t: Any): Strategy

    Permalink

    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 term t is evaluated at most once.

    Definition Classes
    Rewriter
  22. def child(i: Int, s: ⇒ Strategy): Strategy

    Permalink

    Traversal to a single child.

    Traversal to a single child. Construct a strategy that applies s to the ith child of the subject term (counting from one). If s succeeds on the ith child producing t, then succeed, forming a new term that is the same as the original term except that the ith child is now t. If s fails on the ith child or the subject term does not have an ith child, then fail. child(i, s) is equivalent to Stratego's i(s) operator. If s succeeds on the ith child producing the same term (by eq for references and by == for other values), then the overall strategy returns the subject term. This operation works for instances of Product or finite Seq values. s is evaluated at most once.

    Definition Classes
    Rewriter
  23. def childProduct(s: Strategy, i: Int, p: Product): Option[Any]

    Permalink

    Implementation of child for Product values.

    Implementation of child for Product values.

    Definition Classes
    Rewriter
  24. def childSeq[CC[U] <: Seq[U]](s: Strategy, i: Int, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]

    Permalink

    Implementation of child for Seq values.

    Implementation of child for Seq values.

    Definition Classes
    Rewriter
  25. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. def collect[CC[X] <: Iterable[X], U](f: ==>[Any, U])(implicit cbf: Factory[U, CC[U]]): (Any) ⇒ CC[U]

    Permalink

    Collect query results in a Iterable collection.

    Collect query results in a Iterable collection. Run the function f as a top-down left-to-right query on the subject term. Each application of f returns a single value. All of these values are accumulated in the collection.

    Definition Classes
    Rewriter
  27. def collectall[CC[X] <: Iterable[X], U](f: ==>[Any, CC[U]])(implicit cbf: Factory[U, CC[U]]): (Any) ⇒ CC[U]

    Permalink

    Collect query results in a Iterable collection.

    Collect query results in a Iterable collection. Run the function f as a top-down left-to-right query on the subject term. Each application of f returns a collection of values. All of these values are accumulated in the collection.

    Definition Classes
    Rewriter
  28. def collectl[U](f: ==>[Any, U]): (Any) ⇒ List[U]

    Permalink

    Collect query results in a list.

    Collect query results in a list. Run the function f as 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
  29. def collects[U](f: ==>[Any, U]): (Any) ⇒ Set[U]

    Permalink

    Collect query results in a set.

    Collect query results in a set. Run the function f as 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
  30. def congruence(ss: Strategy*): Strategy

    Permalink

    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 ss is not the same as the number of children, then congruence(ss) fails. If the argument strategies succeed on children producing the same terms (by eq for references and by == for other values), then the overall strategy returns the subject term. This operation works on instances of Product values.

    Definition Classes
    Rewriter
  31. def congruenceProduct(p: Product, ss: Strategy*): Option[Any]

    Permalink

    Implementation of congruence for Product values.

    Implementation of congruence for Product values.

    Definition Classes
    Rewriter
  32. def copy[T <: Product](t: T): T

    Permalink

    Copy a product node by creating a new node of the same class type using the same children.

    Copy a product node by creating a new node of the same class type using the same children.

    Definition Classes
    Rewriter
  33. def count(f: ==>[Any, Int]): (Any) ⇒ Int

    Permalink

    Count function results.

    Count function results. Run the function f as a top-down query on the subject term. Sum the integer values returned by f from all applications.

    Definition Classes
    Rewriter
  34. def debug(msg: String, emitter: Emitter = new OutputEmitter): Strategy

    Permalink

    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
    Rewriter
  35. def dispatch(s: Strategy): Strategy

    Permalink

    Produce a strategy that first runs the strategy s on the current term.

    Produce a strategy that first runs the strategy s on the current term. If s fails, then fail. Otherwise, pass the original and new terms to the rewriting method and succeed with the term that it returns.

    Definition Classes
    CallbackRewriter
  36. def doloop(s: Strategy, r: Strategy): Strategy

    Permalink

    Construct a strategy that applies s at least once and then repeats s while r succeeds.

    Construct a strategy that applies s at least once and then repeats s while r succeeds. This operator is called do-while in the Stratego library.

    Definition Classes
    Rewriter
  37. def dontstop(s: ⇒ Strategy): Strategy

    Permalink

    A unit for topdownS, bottomupS and downupS.

    A unit for topdownS, bottomupS and downupS. For example, topdown(s) is equivalent to topdownS(s, dontstop).

    Definition Classes
    Rewriter
  38. def downup(s1: Strategy, s2: Strategy): Strategy

    Permalink

    Construct a strategy that applies s1 in a top-down, prefix fashion and s2 in a bottom-up, postfix fashion to the subject term.

    Construct a strategy that applies s1 in a top-down, prefix fashion and s2 in a bottom-up, postfix fashion to the subject term.

    Definition Classes
    Rewriter
  39. def downup(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject term.

    Construct a strategy that applies s in a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject term.

    Definition Classes
    Rewriter
  40. def downupS(s1: Strategy, s2: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy

    Permalink

    Construct a strategy that applies s1 in a top-down, prefix fashion and s2 in a bottom-up, postfix fashion to the subject term but stops when the strategy produced by stop succeeds.

    Construct a strategy that applies s1 in a top-down, prefix fashion and s2 in a bottom-up, postfix fashion to the subject term but stops when the strategy produced by stop succeeds. stop is given the whole strategy itself as its argument.

    Definition Classes
    Rewriter
  41. def downupS(s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject but stops when the strategy produced by stop succeeds.

    Construct a strategy that applies s in a combined top-down and bottom-up fashion (i.e., both prefix and postfix) to the subject but stops when the strategy produced by stop succeeds. stop is given the whole strategy itself as its argument.

    Definition Classes
    Rewriter
  42. def dup[T <: Product](t: T, children: Array[AnyRef]): T

    Permalink

    Product duplication with callback notification.

    Product duplication with callback notification.

    Definition Classes
    CallbackRewriterRewriter
  43. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  44. val eq: Strategy

    Permalink

    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
  45. val equal: Strategy

    Permalink

    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
  46. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  47. def everything[T](v: T)(f: (T, T) ⇒ T)(g: ==>[Any, T])(t: Any): T

    Permalink

    Apply the function at every term in t in a top-down, left-to-right order.

    Apply the function at every term in t in a top-down, left-to-right order. Collect the resulting T values by accumulating them using f with initial left value v. Return the final value of the accumulation.

    Definition Classes
    Rewriter
  48. def everywhere(s: Strategy): Strategy

    Permalink

    Same as everywheretd.

    Same as everywheretd.

    Definition Classes
    Rewriter
  49. def everywherebu(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s at all terms in a bottom-up fashion regardless of failure.

    Construct a strategy that applies s at all terms in a bottom-up fashion regardless of failure. Terms for which the strategy fails are left unchanged.

    Definition Classes
    Rewriter
  50. def everywheretd(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s at all terms in a top-down fashion regardless of failure.

    Construct a strategy that applies s at all terms in a top-down fashion regardless of failure. Terms for which the strategy fails are left unchanged.

    Definition Classes
    Rewriter
  51. val fail: Strategy

    Permalink

    A strategy that always fails.

    A strategy that always fails.

    Definition Classes
    Rewriter
  52. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  53. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  54. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  55. val id: Strategy

    Permalink

    A strategy that always succeeds.

    A strategy that always succeeds.

    Definition Classes
    Rewriter
  56. def innermost(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s repeatedly to the innermost (i.e., lowest and left-most) (sub-)term to which it applies.

    Construct a strategy that applies s repeatedly to the innermost (i.e., lowest and left-most) (sub-)term to which it applies. Stop with the subject term if s doesn't apply anywhere.

    Definition Classes
    Rewriter
  57. def innermost2(s: Strategy): Strategy

    Permalink

    An alternative version of innermost.

    An alternative version of innermost.

    Definition Classes
    Rewriter
  58. def ior(s1: Strategy, s2: Strategy): Strategy

    Permalink

    ior(s1, s2) implements inclusive OR, that is, the inclusive choice of s1 and s2.

    ior(s1, s2) implements inclusive OR, that is, the inclusive choice of s1 and s2. It first tries s1. If that fails it applies s2 (just like s1 <+ s2). However, when s1 succeeds it also tries to apply s2.

    Definition Classes
    Rewriter
  59. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  60. val isinnernode: Strategy

    Permalink

    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
  61. val isleaf: Strategy

    Permalink

    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
  62. val ispropersubterm: Strategy

    Permalink

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a sub-term of y but is not equal to y.

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a sub-term of y but is not equal to y.

    Definition Classes
    Rewriter
  63. val ispropersuperterm: Strategy

    Permalink

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a super-term of y but is not equal to y.

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a super-term of y but is not equal to y.

    Definition Classes
    Rewriter
  64. val issubterm: Strategy

    Permalink

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a sub-term of y.

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a sub-term of y.

    Definition Classes
    Rewriter
  65. val issuperterm: Strategy

    Permalink

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a superterm of y.

    Construct a strategy that succeeds when applied to a pair (x,y) if x is a superterm of y.

    Definition Classes
    Rewriter
  66. def lastly(s: Strategy, f: Strategy): Strategy

    Permalink

    Applies s followed by f whether s failed or not.

    Applies s followed by f whether s failed or not. This operator is called finally in the Stratego library.

    Definition Classes
    Rewriter
  67. def leaves(s: Strategy, isleaf: Strategy, skip: (Strategy) ⇒ Strategy): Strategy

    Permalink

    Construct a strategy that applies to all of the leaves of the subject term, using isleaf as the leaf predicate, skipping subterms for which skip when applied to the result succeeds.

    Construct a strategy that applies to all of the leaves of the subject term, using isleaf as the leaf predicate, skipping subterms for which skip when applied to the result succeeds.

    Definition Classes
    Rewriter
  68. def leaves(s: Strategy, isleaf: Strategy): Strategy

    Permalink

    Construct a strategy that applies to all of the leaves of the subject term, using isleaf as the leaf predicate.

    Construct a strategy that applies to all of the leaves of the subject term, using isleaf as the leaf predicate.

    Definition Classes
    Rewriter
  69. def log(s: Strategy, msg: String, emitter: Emitter): Strategy

    Permalink

    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 as s does, but also prints the provided message, the subject term, the success or failure status, and on success, the result term, to the provided emitter. s is evaluated at most once.

    Definition Classes
    Rewriter
  70. def logfail[T](s: Strategy, msg: String, emitter: Emitter): Strategy

    Permalink

    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 as s does, but if s fails, also prints the provided message and the subject term to the provided emitter. s is evaluated at most once.

    Definition Classes
    Rewriter
  71. def loop(c: Strategy, s: Strategy): Strategy

    Permalink

    Construct a strategy that while r succeeds applies s.

    Construct a strategy that while r succeeds applies s. This operator is called while in the Stratego library.

    Definition Classes
    Rewriter
  72. def loopiter(s: (Int) ⇒ Strategy, low: Int, high: Int): Strategy

    Permalink

    Construct a strategy that applies s(i) for each integer i from low to high (inclusive).

    Construct a strategy that applies s(i) for each integer i from low to high (inclusive). This operator is called for in the Stratego library.

    Definition Classes
    Rewriter
  73. def loopiter(i: Strategy, r: Strategy, s: Strategy): Strategy

    Permalink

    Construct a strategy that repeats application of s while r fails, after initialization with i.

    Construct a strategy that repeats application of s while r fails, after initialization with i. This operator is called for in the Stratego library.

    Definition Classes
    Rewriter
  74. def loopnot(r: Strategy, s: Strategy): Strategy

    Permalink

    Construct a strategy that while r does not succeed applies s.

    Construct a strategy that while r does not succeed applies s. This operator is called while-not in the Stratego library.

    Definition Classes
    Rewriter
  75. def makechild(c: Any): AnyRef

    Permalink

    Make an arbitrary value c into a term child, checking that it worked properly.

    Make an arbitrary value c into a term child, checking that it worked properly. Object references will be returned unchanged; other values will be boxed.

    Attributes
    protected
    Definition Classes
    Rewriter
  76. def manybu(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s as many times as possible, but at least once, in bottom up order.

    Construct a strategy that applies s as many times as possible, but at least once, in bottom up order.

    Definition Classes
    Rewriter
  77. def manytd(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s as many times as possible, but at least once, in top down order.

    Construct a strategy that applies s as many times as possible, but at least once, in top down order.

    Definition Classes
    Rewriter
  78. def map(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s to each element of a finite sequence (type Seq) returning a new sequence of the results if all of the applications succeed, otherwise fail.

    Construct a strategy that applies s to each element of a finite sequence (type Seq) 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
    Rewriter
  79. def memo(s: Strategy): Strategy

    Permalink

    Return a strategy that behaves as s does, but memoises its arguments and results.

    Return a strategy that behaves as s does, but memoises its arguments and results. In other words, if memo(s) is called on a term t twice, the second time will return the same result as the first, without having to invoke s. For best results, it is important that s should have no side effects. s is evaluated at most once.

    Definition Classes
    Rewriter
  80. def mkStrategy(f: (Any) ⇒ Option[Any]): Strategy

    Permalink

    Make a strategy with the body f.

    Make a strategy with the body f. By default, make a basic strategy.

    Definition Classes
    Rewriter
  81. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  82. def not(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s, then fails if s succeeded or, if s failed, succeeds with the subject term unchanged, I.e., it tests if s applies, but has no effect on the subject term.

    Construct a strategy that applies s, then fails if s succeeded or, if s failed, succeeds with the subject term unchanged, I.e., it tests if s applies, but has no effect on the subject term.

    Definition Classes
    Rewriter
  83. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  84. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  85. def oncebu(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in 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 s in a bottom-up fashion to one subterm at each level, stopping as soon as it succeeds once (at any level).

    Definition Classes
    Rewriter
  86. def oncetd(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in 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 s in a top-down fashion to one subterm at each level, stopping as soon as it succeeds once (at any level).

    Definition Classes
    Rewriter
  87. def one(s: ⇒ Strategy): Strategy

    Permalink

    Traversal to one child.

    Traversal to one child. Construct a strategy that applies s to the term children of the subject term. Assume that c is the first child on which s succeeds. Then stop applying s to the children and succeed, forming a new term from the constructor of the original term and the original children, except that c is replaced by the result of applying s to c. In the event that the strategy fails on all children, then fail. If there are no children, fail. If s succeeds on the one child producing the same term (by eq for references and by == for other values), then the overall strategy returns the subject term. This operation works on instances of finite Rewritable, Product, Map and Iterable values, checked for in that order. Children of a Rewritable (resp. Product, collection) value are processed in the order returned by the value's deconstruct (resp. productElement, foreach) method. s is evaluated at most once.

    Definition Classes
    Rewriter
  88. def oneIterable[CC[U] <: Iterable[U]](s: Strategy, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]

    Permalink

    Implementation of one for Iterable values.

    Implementation of one for Iterable values.

    Definition Classes
    Rewriter
  89. 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]]

    Permalink

    Implementation of one for Map values.

    Implementation of one for Map values.

    Definition Classes
    Rewriter
  90. def oneProduct(s: Strategy, p: Product): Option[Any]

    Permalink

    Implementation of one for Product values.

    Implementation of one for Product values.

    Definition Classes
    Rewriter
  91. def oneRewritable(s: Strategy, r: Rewritable): Option[Any]

    Permalink

    Implementation of one for Rewritable values.

    Implementation of one for Rewritable values.

    Definition Classes
    Rewriter
  92. def option(o: Option[Any]): Strategy

    Permalink

    Construct a strategy from an option value o.

    Construct a strategy from an option value o. The strategy succeeds or fails depending on whether o is a Some or None, respectively. If o is a Some, then the subject term is changed to the term that is wrapped by the Some. o is evaluated at most once.

    Definition Classes
    Rewriter
  93. def or(s1: Strategy, s2: Strategy): Strategy

    Permalink

    or(s1, s2) is similar to ior(s1, s2), but the application of the strategies is only tested.

    or(s1, s2) is similar to ior(s1, s2), but the application of the strategies is only tested.

    Definition Classes
    Rewriter
  94. def outermost(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s repeatedly in a top-down fashion stopping each time as soon as it succeeds once (at any level).

    Construct a strategy that applies s repeatedly in a top-down fashion stopping each time as soon as it succeeds once (at any level). The outermost fails when s fails to apply to any (sub-)term.

    Definition Classes
    Rewriter
  95. def para[T](f: (Any, Seq[T]) ⇒ T): (Any) ⇒ T

    Permalink

    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 f is called, the first parameter is the value and the second is a sequence of the values that f has returned for the children. This will work on any value, but will only decompose values that are supported by the Term generic term deconstruction. This operation is similar to that used in the Uniplate library.

    Definition Classes
    Rewriter
  96. val positions: Positions

    Permalink

    The position store to use for this rewriter.

  97. def query[T](f: ==>[T, Unit]): Strategy

    Permalink

    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 function f to the subject term. In other words, the strategy runs f for its side-effects. If the subject term is not a T or 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] and List[String].

    Definition Classes
    Rewriter
  98. def queryf(f: (Any) ⇒ Unit): Strategy

    Permalink

    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) function f to the subject term. In other words, the strategy runs f for its side-effects.

    Definition Classes
    Rewriter
  99. def reduce(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s repeatedly to subterms until it fails on all of them.

    Construct a strategy that applies s repeatedly to subterms until it fails on all of them.

    Definition Classes
    Rewriter
  100. def repeat(s: Strategy, n: Int): Strategy

    Permalink

    Construct a strategy that applies s repeatedly exactly n times.

    Construct a strategy that applies s repeatedly exactly n times. If s fails at some point during the n applications, the entire strategy fails. The result of the strategy is that of the nth application of s.

    Definition Classes
    Rewriter
  101. def repeat(s: Strategy, r: Strategy): Strategy

    Permalink

    Construct a strategy that repeatedly applies s until it fails and then terminates with application of r.

    Construct a strategy that repeatedly applies s until it fails and then terminates with application of r.

    Definition Classes
    Rewriter
  102. def repeat(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s repeatedly until it fails.

    Construct a strategy that applies s repeatedly until it fails.

    Definition Classes
    Rewriter
  103. def repeat1(s: Strategy, r: Strategy): Strategy

    Permalink

    Construct a strategy that repeatedly applies s (at least once) and terminates with application of c.

    Construct a strategy that repeatedly applies s (at least once) and terminates with application of c.

    Definition Classes
    Rewriter
  104. def repeat1(s: Strategy): Strategy

    Permalink

    Construct a strategy that repeatedly applies s (at least once).

    Construct a strategy that repeatedly applies s (at least once).

    Definition Classes
    Rewriter
  105. def repeatuntil(s: Strategy, r: Strategy): Strategy

    Permalink

    Construct a strategy that repeatedly applies s until c succeeds.

    Construct a strategy that repeatedly applies s until c succeeds.

    Definition Classes
    Rewriter
  106. def restore(s: Strategy, rest: Strategy): Strategy

    Permalink

    Construct a strategy that applies s, then applies the restoring action rest if s fails (and then fail).

    Construct a strategy that applies s, then applies the restoring action rest if s fails (and then fail). Otherwise, let the result of s stand. Typically useful if s performs side effects that should be restored or undone when s fails.

    Definition Classes
    Rewriter
  107. def restorealways(s: Strategy, rest: Strategy): Strategy

    Permalink

    Construct a strategy that applies s, then applies the restoring action rest regardless of the success or failure of s.

    Construct a strategy that applies s, then applies the restoring action rest regardless of the success or failure of s. The whole strategy preserves the success or failure of s. Typically useful if s performs side effects that should be restored always, e.g., when maintaining scope information.

    Definition Classes
    Rewriter
  108. def rewrite[T](s: Strategy)(t: T): T

    Permalink

    Rewrite a term.

    Rewrite a term. Apply the strategy s to a term returning the result term if s succeeds, otherwise return the original term.

    Definition Classes
    Rewriter
  109. def rewriteTree[T <: Product, U <: T](s: Strategy)(t: Tree[T, U], shape: TreeShape = EnsureTree): Tree[T, U]

    Permalink

    Rewrite a tree.

    Rewrite a tree. Apply the strategy s to the root of a tree returning the a tree formed from the result term if s succeeds, otherwise return the original tree.

    The shape parameter specifies the tree shape that should be used when creating the new tree. The default is EnsureTree since it is likely that rewrites will result in node sharing that should be removed.

    Definition Classes
    Rewriter
  110. def rewriting[T](oldTerm: T, newTerm: T): T

    Permalink

    Use the Positioned support to set the start and finish positions of the new term to be those of the old term.

    Use the Positioned support to set the start and finish positions of the new term to be those of the old term. Always return the new term.

    Definition Classes
    PositionedRewriterCallbackRewriter
  111. def rule[T](f: ===>[T]): Strategy

    Permalink

    Define a rewrite rule using a partial function f defined on the type T.

    Define a rewrite rule using a partial function f defined on the type T. If the subject term is a T and 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] and List[String].

    Definition Classes
    CallbackRewriterRewriter
  112. def rulef(f: (Any) ⇒ Any): Strategy

    Permalink

    Define a rewrite rule using a function f that returns a term.

    Define a rewrite rule using a function f that returns a term. The rule always succeeds with the return value of the function.

    Definition Classes
    CallbackRewriterRewriter
  113. def rulefs[T](f: ==>[T, Strategy]): Strategy

    Permalink

    Define a rewrite rule using a function f defined on type T that returns a strategy.

    Define a rewrite rule using a function f defined on type T that returns a strategy. If the subject term is a T and 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 if f is not defined at the term in the first place.

    Definition Classes
    CallbackRewriterRewriter
  114. def some(s: ⇒ Strategy): Strategy

    Permalink

    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 s to the term children of the subject term. If s succeeds on any of the children, then succeed, forming a new term from the constructor of the original term and the result of s for each succeeding child, with other children unchanged. In the event that s fails on all children, then fail. If there are no children, fail. If s succeeds on children producing the same terms (by eq for references and by == for other values), then the overall strategy returns the subject term. This operation works on instances of finite Rewritable, Product, Map and Iterable values, checked for in that order. Children of a Rewritable (resp. Product, collection) value are processed in the order returned by the value's deconstruct (resp. productElement, foreach) method. s is evaluated at most once.

    Definition Classes
    Rewriter
  115. def someIterable[CC[U] <: Iterable[U]](s: Strategy, t: CC[Any])(implicit cbf: CanBuildFrom[CC[Any], Any, CC[Any]]): Option[CC[Any]]

    Permalink

    Implementation of some for Iterable values.

    Implementation of some for Iterable values.

    Definition Classes
    Rewriter
  116. 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]]

    Permalink

    Implementation of some for Map values.

    Implementation of some for Map values.

    Definition Classes
    Rewriter
  117. def someProduct(s: Strategy, p: Product): Option[Any]

    Permalink

    Implementation of some for Product values.

    Implementation of some for Product values.

    Definition Classes
    Rewriter
  118. def someRewritable(s: Strategy, r: Rewritable): Option[Any]

    Permalink

    Implementation of some for Rewritable values.

    Implementation of some for Rewritable values.

    Definition Classes
    Rewriter
  119. def somebu(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in 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 s in a bottom-up fashion to some subterms at each level, stopping as soon as it succeeds once (at any level).

    Definition Classes
    Rewriter
  120. def somedownup(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a top-down, prefix fashion stopping at a frontier where s succeeds on some children.

    Construct a strategy that applies s in a top-down, prefix fashion stopping at a frontier where s succeeds on some children. s is then applied in a bottom-up, postfix fashion to the result.

    Definition Classes
    Rewriter
  121. def sometd(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in 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 s in a top-down fashion to some subterms at each level, stopping as soon as it succeeds once (at any level).

    Definition Classes
    Rewriter
  122. def strategy[T](f: ==>[T, Option[T]]): Strategy

    Permalink

    Make a strategy from a partial function f defined on the type T.

    Make a strategy from a partial function f defined on the type T. If the subject term is a T and 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 a T or 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] and List[String].

    Definition Classes
    CallbackRewriterRewriter
  123. def strategyf(f: (Any) ⇒ Option[Any]): Strategy

    Permalink

    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
    CallbackRewriterRewriter
  124. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  125. def term[T](t: T): Strategy

    Permalink

    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
    Rewriter
  126. def test(s: Strategy): Strategy

    Permalink

    Construct a strategy that tests whether strategy s succeeds, restoring the original term on success.

    Construct a strategy that tests whether strategy s succeeds, restoring the original term on success. A synonym for where.

    Definition Classes
    Rewriter
  127. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  128. def topdown(s: Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a top-down, prefix fashion to the subject term.

    Construct a strategy that applies s in a top-down, prefix fashion to the subject term.

    Definition Classes
    Rewriter
  129. def topdownS(s: Strategy, stop: (⇒ Strategy) ⇒ Strategy): Strategy

    Permalink

    Construct a strategy that applies s in a top-down, prefix fashion to the subject term but stops when the strategy produced by stop succeeds.

    Construct a strategy that applies s in a top-down, prefix fashion to the subject term but stops when the strategy produced by stop succeeds. stop is given the whole strategy itself as its argument.

    Definition Classes
    Rewriter
  130. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  131. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  132. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  133. def where(s: Strategy): Strategy

    Permalink

    Construct a strategy that tests whether strategy s succeeds, restoring the original term on success.

    Construct a strategy that tests whether strategy s succeeds, restoring the original term on success. This is similar to Stratego's where, except that in this version any effects on bindings are not visible outside s.

    Definition Classes
    Rewriter

Inherited from CallbackRewriter

Inherited from Rewriter

Inherited from AnyRef

Inherited from Any

Ungrouped