Package

scala.meta

tql

Permalink

package tql

Linear Supertypes
Api, CollectionLikeUI[Tree], SyntaxEnhancer[Tree], Combinators[Tree], Traverser[Tree], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. tql
  2. Api
  3. CollectionLikeUI
  4. SyntaxEnhancer
  5. Combinators
  6. Traverser
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait AllowedTransformation[I, O] extends AnyRef

    Permalink
  2. implicit class CTWithResult[U <: T] extends AnyRef

    Permalink

    Part of the 'transform' infrastructure.

    Part of the 'transform' infrastructure. transform ca take either a T only or a (T, A). (t, a) is bit cumbersome to write and that is why CTWithResult exists. This allows to write t andCollect a instead of (t, List(a))

    Definition Classes
    Combinators
  3. abstract class CollectInType[C[_]] extends AnyRef

    Permalink

    This is solely use to write collect as def collect[C[_] ] = new CollectInType[C] {..} instead of def collect[C[_] ] = new {} and so to not use reflective calls.

    This is solely use to write collect as def collect[C[_] ] = new CollectInType[C] {..} instead of def collect[C[_] ] = new {} and so to not use reflective calls. This as not been benchmarked so I don't really know if it has a real performance impact

    Definition Classes
    Combinators
  4. trait CollectionLikeUI[T] extends AnyRef

    Permalink

    This trait allows to easily write simple traversals.

    This trait allows to easily write simple traversals. Instead of writing: t : T val x = topDown(collect{...}) val result = x(t).result We can wirte instead t.collect{...}

    topDownBreak(focus{..} ~> topDown{transform{...}}) (t) becomes t.topDownBreak.focus{..}.topDown.transform{..} Which is essentially easier to read and to write

    • transform return either
      • just a T => x: T = t.transform{case Lit.Int(a) => Lit.Int(a * 2)}
      • a tuple (T, A) => (x: T, y: List[Int]) = t.transform{case Lit.Int(a) => Lit.Int(a * 2) andCollect a}
    • it is possible to use it on
      • t: T => t.transform{case Lit.Int(a) => Lit.Int(a * 2)}: T
      • t: Option[T] => t.transform{case Lit.Int(a) => Lit.Int(a * 2)}: Option[T]
      • t: List[T] => t.transform{case Lit.Int(a) => Lit.Int(a * 2)}: List[T]

    The drawbacks:

    • Every combinator have to be re-written in those 'Evaluator' classes (even macros)
    • Composition is lost.

    /!\ Beware: this code contains a lot of implcit magic tricks

  5. trait Collector[C, A, R] extends AnyRef

    Permalink

    This trait is part of the infrastructure required to make the collect combinator have a default parameter to List[_].

    This trait is part of the infrastructure required to make the collect combinator have a default parameter to List[_]. C is the type of the collection (ex: List[Int]) given by the User (or inferred to Nothing by the compiler) A is the element inside the collection (in List[Int] it would be Int) R is the 'real' collection that will be used i.e if C = Nothing => R = List[A] else R = C

    Note: maybe it would be interesting to generate such boilerplaite with a macro annotation. Something like that:

    Definition Classes
    Combinators
  6. trait Combinators[T] extends AnyRef

    Permalink

    This trait contains the base combinators which can be used to write powerful traversers.

  7. abstract class DelayedMeta extends AnyRef

    Permalink

    Abstract class used to delay delay the time when the type parameter of a meta combinator is decided.

    Abstract class used to delay delay the time when the type parameter of a meta combinator is decided. Anonymous functions can't take type parameter, so this ugly stuff is required

    Definition Classes
    CollectionLikeUI
  8. class Evaluator[V] extends AnyRef

    Permalink

    Allows to call 'combinators' directly on T For documentation see Combinators.scala

    Allows to call 'combinators' directly on T For documentation see Combinators.scala

    Definition Classes
    CollectionLikeUI
  9. class EvaluatorAndThen[V, +A] extends AnyRef

    Permalink

    Evaluator at which will be applied m andThen the traversal strategy defined in 'meta'

    Evaluator at which will be applied m andThen the traversal strategy defined in 'meta'

    Definition Classes
    CollectionLikeUI
  10. class EvaluatorAndThenCollector[V, C[_]] extends AnyRef

    Permalink
    Definition Classes
    CollectionLikeUI
  11. class EvaluatorCollector[V, C[_]] extends AnyRef

    Permalink
    Definition Classes
    CollectionLikeUI
  12. class EvaluatorMeta[V] extends AnyRef

    Permalink

    Evaluator at which will be applied the traversal strategy defined in 'meta'

    Evaluator at which will be applied the traversal strategy defined in 'meta'

    Definition Classes
    CollectionLikeUI
  13. class EvaluatorMetaCollector[V, C[_]] extends AnyRef

    Permalink
    Definition Classes
    CollectionLikeUI
  14. class ForceResult[V, A, R] extends AnyRef

    Permalink

    This has to be outside of EvaluatorAndThen because of covarience stuff it is not possible to write def force(implicit x: Monoid[A]) = ...inside EvaluatorAndThen[A] We should write def force[B >: A](implicit x: Monoid[B]) but Monoid should be made contravarient in A, which is not possible (in part because it is not logical and because contravarient stuff does not work well with implicits)

    This has to be outside of EvaluatorAndThen because of covarience stuff it is not possible to write def force(implicit x: Monoid[A]) = ...inside EvaluatorAndThen[A] We should write def force[B >: A](implicit x: Monoid[B]) but Monoid should be made contravarient in A, which is not possible (in part because it is not logical and because contravarient stuff does not work well with implicits)

    Definition Classes
    CollectionLikeUI
  15. type MatchResult[A] = Option[(T, A)]

    Permalink
    Definition Classes
    Traverser
  16. abstract class Matcher[+A] extends (T) ⇒ MatchResult[A]

    Permalink

    A Matcher is a function or 'combinator' which takes a T and return an Option of tuple of - a transformed T (or the same) - a result of type A s.t Exists Monoid[A] so that results can be combined during the traversal A transformation/traversal has succeeded if the result of the application on the Matcher is not a None

    A Matcher is a function or 'combinator' which takes a T and return an Option of tuple of - a transformed T (or the same) - a result of type A s.t Exists Monoid[A] so that results can be combined during the traversal A transformation/traversal has succeeded if the result of the application on the Matcher is not a None

    Definition Classes
    Traverser
  17. trait MatcherApply[A, R, V, L] extends AnyRef

    Permalink

    Make it possible to use the collection like ui api inside different structures A := Result of the Matcher R := Some anonymous type which represents the result of a transformation on each MatchResult V := T | Option[T] | Seq[T] L := R | Option[R] | Seq[R]

    Make it possible to use the collection like ui api inside different structures A := Result of the Matcher R := Some anonymous type which represents the result of a transformation on each MatchResult V := T | Option[T] | Seq[T] L := R | Option[R] | Seq[R]

    Definition Classes
    CollectionLikeUI
  18. implicit class MatcherResultEnhancer[A] extends AnyRef

    Permalink
    Definition Classes
    SyntaxEnhancer
  19. implicit class MatcherXPath[A] extends AnyRef

    Permalink

    Convention : Operators ending with : are right assosiative Moreover a \: b is desugared to b.\:(a)

    Convention : Operators ending with : are right assosiative Moreover a \: b is desugared to b.\:(a)

    Definition Classes
    SyntaxEnhancer
  20. trait Monoid[A] extends AnyRef

    Permalink

    https://en.wikipedia.org/wiki/Monoid

  21. trait SyntaxEnhancer[T] extends AnyRef

    Permalink
  22. implicit class TEnhancer extends AnyRef

    Permalink
    Definition Classes
    SyntaxEnhancer
  23. trait TransformResultTr[A, R] extends AnyRef

    Permalink

    System needed to recover the correct type from a 'transfrom' call.

    System needed to recover the correct type from a 'transfrom' call. 1) x.transform{case x: T => x} : T 2) x.transform{case x: T => (x, List(1))} : (T, List[Int])

    Definition Classes
    CollectionLikeUI
  24. trait Traverser[T] extends AnyRef

    Permalink
  25. implicit class TreeMapperEnhancer[A] extends AnyRef

    Permalink
    Definition Classes
    SyntaxEnhancer

Abstract Value Members

  1. abstract def traverse[A](tree: T, f: Matcher[A])(implicit arg0: Monoid[A]): MatchResult[A]

    Permalink
    Definition Classes
    Traverser

Concrete Value Members

  1. def @@[U <: T](implicit arg0: ClassTag[U]): (Combinators.this)#Matcher[U]

    Permalink

    Alias for select

    Alias for select

    Definition Classes
    Combinators
  2. object AllowedTransformation

    Permalink
  3. object Collector

    Permalink
    Definition Classes
    Combinators
  4. def Matcher[A](f: (T) ⇒ MatchResult[A]): Matcher[A]

    Permalink
    Definition Classes
    Traverser
  5. object MatcherApply

    Permalink
    Definition Classes
    CollectionLikeUI
  6. implicit def MatcherResultToResult[A](a: (SyntaxEnhancer.this)#MatchResult[A])(implicit arg0: Monoid[A]): A

    Permalink
    Definition Classes
    SyntaxEnhancer
  7. implicit def MatcherResultToTree(a: (SyntaxEnhancer.this)#MatchResult[_]): Option[T]

    Permalink
    Definition Classes
    SyntaxEnhancer
  8. object Monoid

    Permalink

    Different base implementation of several instances of Monoids

  9. object TransformResultTr

    Permalink
    Definition Classes
    CollectionLikeUI
  10. def bottomUp[A](m: ⇒ (Combinators.this)#Matcher[A])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink

    Same as bottomUpBreak, but does not sop when a transformation/traversal has succeeded

    Same as bottomUpBreak, but does not sop when a transformation/traversal has succeeded

    Definition Classes
    Combinators
  11. def bottomUpAlias[A](m: (SyntaxEnhancer.this)#Matcher[A])(implicit arg0: Monoid[A]): (SyntaxEnhancer.this)#Matcher[A]

    Permalink
    Definition Classes
    SyntaxEnhancer
  12. def bottomUpBreak[A](m: (Combinators.this)#Matcher[A])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink

    Traverse the tree in a BottomUp manner, stop when a transformation/traversal has succeeded

    Traverse the tree in a BottomUp manner, stop when a transformation/traversal has succeeded

    Definition Classes
    Combinators
  13. def bottomUpBreakAlias[A](m: (SyntaxEnhancer.this)#Matcher[A])(implicit arg0: Monoid[A]): (SyntaxEnhancer.this)#Matcher[A]

    Permalink
    Definition Classes
    SyntaxEnhancer
  14. def children[A](f: ⇒ (Combinators.this)#Matcher[A])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink

    Traverse the direct children of the tree and apply f to them.

    Traverse the direct children of the tree and apply f to them.

    Definition Classes
    Combinators
  15. def childrenAlias[A](m: (SyntaxEnhancer.this)#Matcher[A])(implicit arg0: Monoid[A]): (SyntaxEnhancer.this)#Matcher[A]

    Permalink
    Definition Classes
    SyntaxEnhancer
  16. def collect[C[_]]: (Combinators.this)#CollectInType[C]

    Permalink

    Same as visit but puts the results into a collection (List by default)

    Same as visit but puts the results into a collection (List by default)

    Definition Classes
    Combinators
  17. def collect2[V[_, _]]: AnyRef { def apply[A, B](f: PartialFunction[T,(A, B)])(implicit x: scala.reflect.ClassTag[T],implicit y: scala.collection.generic.CanBuildFrom[V[A,B],(A, B),V[A,B]]): Combinators.this.Matcher[V[A,B]] }

    Permalink

    same as collect but put the results into a collection of 2 type parameter e.g a Map[K, V]

    same as collect but put the results into a collection of 2 type parameter e.g a Map[K, V]

    Definition Classes
    Combinators
  18. implicit def collectionLikeUIForTree[V <: Tree](v: V): Evaluator[V]

    Permalink
    Definition Classes
    Api
  19. implicit def collectionLikeUIForTreeopt[V <: Tree](v: Option[V]): Evaluator[Option[V]]

    Permalink
    Definition Classes
    Api
  20. implicit def collectionLikeUIForTrees[V <: Tree](v: collection.immutable.Seq[V]): Evaluator[collection.immutable.Seq[V]]

    Permalink
    Definition Classes
    Api
  21. implicit def collectionLikeUIForTreess[V <: Tree](v: collection.immutable.Seq[collection.immutable.Seq[V]]): Evaluator[collection.immutable.Seq[collection.immutable.Seq[V]]]

    Permalink
    Definition Classes
    Api
  22. def fix[A](f: ((Combinators.this)#Matcher[A]) ⇒ (Combinators.this)#Matcher[A]): (Combinators.this)#Matcher[A]

    Permalink

    The infamous fix point combinator

    The infamous fix point combinator

    Definition Classes
    Combinators
  23. macro def focus(f: PartialFunction[T, Boolean]): (Combinators.this)#Matcher[T]

    Permalink

    Syntactic sugar for guard combinator so that one doesn't need to type the type parameter

    Syntactic sugar for guard combinator so that one doesn't need to type the type parameter

    Definition Classes
    Combinators
  24. implicit def forceResultUI[V, A, R](x: EvaluatorAndThen[V, A])(implicit arg0: Monoid[A]): ForceResult[V, A, R]

    Permalink
    Definition Classes
    Api
  25. def guard[U <: T](f: PartialFunction[U, Boolean])(implicit arg0: ClassTag[U]): (Combinators.this)#Matcher[U]

    Permalink

    Succeed if the partial function f applied on the tree is defined and return true

    Succeed if the partial function f applied on the tree is defined and return true

    Definition Classes
    Combinators
  26. def identity[A](implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink

    Simple Identity combinator.

    Simple Identity combinator. a identity = a

    Definition Classes
    Combinators
  27. def oneOfChildren[A](m: ⇒ (Combinators.this)#Matcher[A])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink
    Definition Classes
    Combinators
  28. def select[U <: T](implicit arg0: ClassTag[U]): (Combinators.this)#Matcher[U]

    Permalink

    Alias for focus{case t: U => some((t,t)}

    Alias for focus{case t: U => some((t,t)}

    Definition Classes
    Combinators
  29. def topDown[A](m: (Combinators.this)#Matcher[A])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink

    Same as TopDown, but does not sop when a transformation/traversal has succeeded

    Same as TopDown, but does not sop when a transformation/traversal has succeeded

    Definition Classes
    Combinators
  30. def topDownAlias[A](m: (SyntaxEnhancer.this)#Matcher[A])(implicit arg0: Monoid[A]): (SyntaxEnhancer.this)#Matcher[A]

    Permalink
    Definition Classes
    SyntaxEnhancer
  31. def topDownBreak[A](m: (Combinators.this)#Matcher[A])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink

    Traverse the tree in a TopDown manner, stop when a transformation/traversal has succeeded

    Traverse the tree in a TopDown manner, stop when a transformation/traversal has succeeded

    Definition Classes
    Combinators
  32. def topDownBreakAlias[A](m: (SyntaxEnhancer.this)#Matcher[A])(implicit arg0: Monoid[A]): (SyntaxEnhancer.this)#Matcher[A]

    Permalink
    Definition Classes
    SyntaxEnhancer
  33. macro def transform(f: PartialFunction[T, Any]): (Combinators.this)#Matcher[Any]

    Permalink

    Syntactic sugar for transform combinator so that one doesn't need to type the type parameter

    Syntactic sugar for transform combinator so that one doesn't need to type the type parameter

    Definition Classes
    Combinators
  34. def transformWithResult[I <: T, O <: T, A](f: PartialFunction[I, (O, A)])(implicit arg0: ClassTag[I], x: AllowedTransformation[I, O]): (Combinators.this)#Matcher[A]

    Permalink

    Transform a I into a T where both I and O are subtypes of T and where a transformation from I to O is authorized

    Transform a I into a T where both I and O are subtypes of T and where a transformation from I to O is authorized

    Definition Classes
    Combinators
  35. def tupledUntil[A, B](m1: (Combinators.this)#Matcher[A], m2: (Combinators.this)#Matcher[B])(implicit arg0: Monoid[A], arg1: Monoid[B]): (Combinators.this)#Matcher[(A, B)]

    Permalink
    Definition Classes
    Combinators
  36. def until[A, B](m1: ⇒ (Combinators.this)#Matcher[A], m2: (Combinators.this)#Matcher[B])(implicit arg0: Monoid[A]): (Combinators.this)#Matcher[A]

    Permalink
    Definition Classes
    Combinators
  37. def visit[A](f: PartialFunction[T, A])(implicit x: ClassTag[T]): (Combinators.this)#Matcher[A]

    Permalink

    Traverse the data structure and return a result

    Traverse the data structure and return a result

    Definition Classes
    Combinators

Inherited from Api

Inherited from CollectionLikeUI[Tree]

Inherited from SyntaxEnhancer[Tree]

Inherited from Combinators[Tree]

Inherited from Traverser[Tree]

Inherited from AnyRef

Inherited from Any

Ungrouped