Packages

  • package root

    The Scala compiler and reflection APIs.

    The Scala compiler and reflection APIs.

    Definition Classes
    root
  • package scala
    Definition Classes
    root
  • package tools
    Definition Classes
    scala
  • package nsc
    Definition Classes
    tools
  • package ast
    Definition Classes
    nsc
  • package parser
    Definition Classes
    ast
  • trait Parsers extends Scanners with MarkupParsers with ParsersCommon

    Performs the following context-free rewritings:

    Performs the following context-free rewritings:

    - Places all pattern variables in Bind nodes. In a pattern, for identifiers x:

                    x  => x @ _
                  x:T  => x @ (_ : T)
    

    • Removes pattern definitions (PatDef's) as follows: If pattern is a simple (typed) identifier:
             val x = e     ==>  val x = e
             val x: T = e  ==>  val x: T = e
      

    if there are no variables in pattern

           val p = e  ==>  e match (case p => ())
    

    if there is exactly one variable in pattern

           val x_1 = e match (case p => (x_1))
    

    if there is more than one variable in pattern

           val p = e  ==>  private synthetic val t$ = e match (case p => (x_1, ..., x_N))
                           val x_1 = t$._1
                           ...
                           val x_N = t$._N
    

    - Removes function types as follows:

           (argtpes) => restpe   ==>   scala.Function_n[argtpes, restpe]
    

    - Wraps naked case definitions in a match as follows:

           { cases }   ==>   (x => x.match {cases}), except when already argument to match
    

    Definition Classes
    parser
  • abstract class Parser extends ParserCommon
    Definition Classes
    Parsers
  • InfixMode
  • ParserTreeBuilder
  • PatternContextSensitive
  • SeqContextSensitive

class ParserTreeBuilder extends TreeBuilder

Source
Parsers.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ParserTreeBuilder
  2. TreeBuilder
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ParserTreeBuilder()

Value Members

  1. def addEvidenceParams(owner: Global.Name, vparamss: List[List[Global.ValDef]], contextBounds: List[Global.Tree]): List[List[Global.ValDef]]

    Append implicit parameter section if contextBounds nonempty

    Append implicit parameter section if contextBounds nonempty

    Definition Classes
    TreeBuilder
  2. def byNameApplication(tpe: Global.Tree): Global.Tree
    Definition Classes
    TreeBuilder
  3. def convertToTypeName(t: Global.Tree): Option[Global.RefTree]
    Definition Classes
    TreeBuilder
  4. implicit def fresh: FreshNameCreator
    Definition Classes
    TreeBuilder
  5. val global: Parsers.global.type
    Definition Classes
    ParserTreeBuilderTreeBuilder
  6. def makeAlternative(ts: List[Global.Tree]): Global.Tree

    Create tree for a pattern alternative

    Create tree for a pattern alternative

    Definition Classes
    TreeBuilder
  7. def makeAnnotated(t: Global.Tree, annot: Global.Tree): Global.Tree
    Definition Classes
    TreeBuilder
  8. def makeBlock(stats: List[Global.Tree]): Global.Tree

    Create block of statements stats

    Create block of statements stats

    Definition Classes
    TreeBuilder
  9. def makeCaseDef(pat: Global.Tree, guard: Global.Tree, rhs: Global.Tree): Global.CaseDef

    Create tree for case definition <case pat if guard => rhs>

    Create tree for case definition <case pat if guard => rhs>

    Definition Classes
    TreeBuilder
  10. def makeCatchFromExpr(catchExpr: Global.Tree): Global.CaseDef

    Creates tree representing: { case x: Throwable => val catchFn = catchExpr if (catchFn isDefinedAt x) catchFn(x) else throw x }

    Creates tree representing: { case x: Throwable => val catchFn = catchExpr if (catchFn isDefinedAt x) catchFn(x) else throw x }

    Definition Classes
    TreeBuilder
  11. def makeCatchFromFunc(catchFn: Global.Tree): Global.CaseDef

    Creates tree representing: { case x: Throwable => catchExpr(x) }

    Creates tree representing: { case x: Throwable => catchExpr(x) }

    Definition Classes
    TreeBuilder
  12. def makeDoWhile(lname: Global.TermName, body: Global.Tree, cond: Global.Tree): Global.Tree

    Create tree representing a do-while loop

    Create tree representing a do-while loop

    Definition Classes
    TreeBuilder
  13. def makeFunctionTypeTree(argtpes: List[Global.Tree], restpe: Global.Tree): Global.Tree

    Create a tree representing the function type (argtpes) => restpe

    Create a tree representing the function type (argtpes) => restpe

    Definition Classes
    TreeBuilder
  14. def makeImportSelector(name: Global.Name, nameOffset: Int): Global.ImportSelector
    Definition Classes
    TreeBuilder
  15. def makeMatchFromExpr(catchExpr: Global.Tree): List[Global.CaseDef]

    At parser, rejigger non-case catch expression.

    At parser, rejigger non-case catch expression.

    Match is eliminated by unwrapping. Other expression becomes a single CaseDef with empty pattern and expr tree as RHS.

    Definition Classes
    TreeBuilder
  16. def makeParam(pname: Global.TermName, tpe: Global.Tree): Global.ValDef
    Definition Classes
    TreeBuilder
  17. def makePatDef(mods: Global.Modifiers, pat: Global.Tree, rhs: Global.Tree, rhsPos: Global.Position): List[Global.ValDef]
    Definition Classes
    TreeBuilder
  18. final def makePatDef(mods: Global.Modifiers, pat: Global.Tree, rhs: Global.Tree): List[Global.ValDef]
    Definition Classes
    TreeBuilder
  19. def makePostfixSelect(start: Int, end: Int, od: Global.Tree, op: Global.Name): Global.Tree

    Tree for od op, start is start0 if od.pos is borked.

    Tree for od op, start is start0 if od.pos is borked.

    Definition Classes
    TreeBuilder
  20. def makeSelfDef(name: Global.TermName, tpt: Global.Tree): Global.ValDef
    Definition Classes
    TreeBuilder
  21. def makeSyntheticTypeParam(pname: Global.TypeName, bounds: Global.Tree): Global.TypeDef
    Definition Classes
    TreeBuilder
  22. def makeTupleTerm(elems: List[Global.Tree]): Global.Tree
    Definition Classes
    TreeBuilder
  23. def makeTupleType(elems: List[Global.Tree]): Global.Tree
    Definition Classes
    TreeBuilder
  24. def makeWhile(startPos: Int, cond: Global.Tree, body: Global.Tree): Global.Tree

    Create tree representing a while loop

    Create tree representing a while loop

    Definition Classes
    TreeBuilder
  25. def o2p(offset: Int): Global.Position
    Definition Classes
    TreeBuilder
  26. def r2p(start: Int, mid: Int, end: Int): Global.Position
    Definition Classes
    TreeBuilder
  27. def repeatedApplication(tpe: Global.Tree): Global.Tree
    Definition Classes
    TreeBuilder
  28. def rootScalaDot(name: Global.Name): Global.Select
    Definition Classes
    TreeBuilder
  29. def scalaAnyRefConstr: Global.Select
    Definition Classes
    TreeBuilder
  30. def scalaDot(name: Global.Name): Global.Select
    Definition Classes
    TreeBuilder
  31. def scalaUnitConstr: Global.Select
    Definition Classes
    TreeBuilder
  32. def source: SourceFile
    Definition Classes
    ParserTreeBuilderTreeBuilder
  33. def unit: Global.CompilationUnit
    Definition Classes
    ParserTreeBuilderTreeBuilder