scala.tools.nsc.ast.parser.Parsers

Parser

abstract class Parser extends ParserCommon

Source
Parsers.scala
Linear Supertypes
ParserCommon, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Parser
  2. ParserCommon
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Parser()

Type Members

  1. trait PatternContextSensitive extends AnyRef

    Methods which implicitly propagate the context in which they were called: either in a pattern context or not.

  2. trait SeqContextSensitive extends PatternContextSensitive

    Methods which implicitly propagate whether the initial call took place in a context where sequences are allowed.

Abstract Value Members

  1. abstract def deprecationWarning(off: Int, msg: String): Unit

    Definition Classes
    ParserCommon
  2. abstract def freshName(prefix: String): Name

    Definition Classes
    ParserParserCommon
  3. abstract def freshTermName(prefix: String): TermName

    Definition Classes
    ParserParserCommon
  4. abstract def freshTypeName(prefix: String): TypeName

    Definition Classes
    ParserParserCommon
  5. abstract val in: Scanner

    Definition Classes
    ParserParserCommon
  6. abstract def incompleteInputError(msg: String): Unit

  7. abstract def o2p(offset: Int): Position

  8. abstract def parseStartRule: () ⇒ Tree

  9. abstract def r2p(start: Int, mid: Int, end: Int): Position

  10. abstract def syntaxError(offset: Int, msg: String): Unit

  11. abstract def warning(offset: Int, msg: String): Unit

  12. abstract def xmlLiteral(): Tree

  13. abstract def xmlLiteralPattern(): Tree

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object InfixMode extends Enumeration

    modes for infix types

  7. def accept(token: Int): Int

    Consume one token of the specified type, or signal an error if it is not there.

    Consume one token of the specified type, or signal an error if it is not there.

    Definition Classes
    ParserParserCommon
  8. def acceptStatSep(): Unit

    semi = nl {nl} | ;' nl = \n' // where allowed

  9. def acceptStatSepOpt(): Unit

  10. def accessModifierOpt(): Modifiers

    AccessModifier ::= (private | protected) [AccessQualifier]

  11. def accessQualifierOpt(mods: Modifiers): Modifiers

    AccessQualifier ::= "[" (Id | this) "]"

  12. def annotTypeRest(t: Tree): Tree

  13. def annotationExpr(): Tree

  14. def annotations(skipNewLines: Boolean): List[Tree]

    Annotations ::= {@' SimpleType {ArgumentExprs}} ConsrAnnotations ::= {@' SimpleType ArgumentExprs}

  15. def argumentExprs(): List[Tree]

    ArgumentExprs ::= (' [Exprs] )' | [nl] BlockExpr

  16. def argumentPatterns(): List[Tree]

  17. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  18. var assumedClosingParens: Map[Int, Int]

  19. def atPos[T <: Tree](pos: Position)(t: T): T

  20. def atPos[T <: Tree](start: Int, point: Int, end: Int)(t: T): T

  21. def atPos[T <: Tree](start: Int, point: Int)(t: T): T

  22. def atPos[T <: Tree](offset: Int)(t: T): T

  23. def block(): Tree

    Block ::= BlockStatSeq

    Block ::= BlockStatSeq

    Note

    Return tree does not carry position.

  24. def blockExpr(): Tree

    BlockExpr ::= {' (CaseClauses | Block) }'

  25. def blockStatSeq(): List[Tree]

    BlockStatSeq ::= { BlockStat semi } [ResultExpr] BlockStat ::= Import | Annotations [implicit] [lazy] Def | Annotations LocalModifiers TmplDef | Expr1 |

  26. def bound(tok: Int, default: TypeName): Tree

  27. def caseBlock(): Tree

  28. def caseClauses(): List[CaseDef]

    CaseClauses ::= CaseClause {CaseClause} CaseClause ::= case Pattern [Guard] =>' Block

  29. def caseSeparated[T](part: ⇒ T): List[T]

  30. def checkAssoc(offset: Int, op: Name, leftAssoc: Boolean): Unit

  31. def checkLegalExistential(t: Tree): Unit

    Check that tree is a legal clause of a forSome

  32. def checkNoEscapingPlaceholders[T](op: ⇒ T): T

  33. def checkNotByNameOrVarargs(tpt: Tree): Unit

    Check that type parameter is not by name or repeated

  34. def checkSize(kind: String, size: Int, max: Int): Unit

  35. def classDef(start: Int, mods: Modifiers): ClassDef

    ClassDef ::= Id [TypeParamClause] {Annotation} [AccessModifier] ClassParamClauses RequiresTypeOpt ClassTemplateOpt TraitDef ::= Id [TypeParamClause] RequiresTypeOpt TraitTemplateOpt

  36. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  37. def commaSeparated[T](part: ⇒ T): List[T]

  38. def compilationUnit(): Tree

    CompilationUnit ::= {package QualId semi} TopStatSeq

  39. def condExpr(): Tree

  40. def constrBlock(vparamss: List[List[ValDef]]): Tree

    ConstrBlock ::= {' SelfInvocation {semi BlockStat} }'

  41. def constrExpr(vparamss: List[List[ValDef]]): Tree

    ConstrExpr ::= SelfInvocation | ConstrBlock

  42. def constructorAnnotations(): List[Tree]

  43. def convertToParam(tree: Tree): ValDef

    Convert tree to formal parameter

  44. def convertToParams(tree: Tree): List[ValDef]

    Convert tree to formal parameter list

  45. def convertToTypeId(tree: Tree): Tree

    Convert (qual)ident to type identifier

  46. def defOrDcl(pos: Int, mods: Modifiers): List[Tree]

    Def ::= val PatDef | var PatDef | def FunDef | type [nl] TypeDef | TmplDef Dcl ::= val PatDcl | var PatDcl | def FunDcl | type [nl] TypeDcl

  47. def enumerators(): List[Enumerator]

    Enumerators ::= Generator {semi Enumerator} Enumerator ::= Generator | Guard | val Pattern1 =' Expr

  48. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  49. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  50. def equalsExpr(): Tree

    EqualsExpr ::= =' Expr

  51. def errorPatternTree: Ident

  52. def errorTermTree: Literal

  53. def errorTypeTree: TypeTree

  54. def expectedMsg(token: Int): String

  55. def expr(location: Int): Tree

  56. def expr(): Tree

    Expr ::= (Bindings | [implicit'] Id | _') =>' Expr | Expr1 ResultExpr ::= (Bindings | Id :' CompoundType) =>' Block | Expr1 Expr1 ::= if (' Expr )' {nl} Expr semi]

  57. def expr0(location: Int): Tree

  58. def exprSimpleType(): Tree

  59. def exprTypeArgs(): List[Tree]

  60. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  61. def funDefOrDcl(start: Int, mods: Modifiers): Tree

    FunDef ::= FunSig :' Type =' Expr | FunSig [nl] {' Block }' | this ParamClause ParamClauses (=' ConstrExpr | [nl] ConstrBlock) FunDcl ::= FunSig [:' Type] FunSig ::= id [FunTypeParamClause] ParamClauses

  62. def generator(enums: ListBuffer[Enumerator], eqOK: Boolean): Unit

    Generator ::= Pattern1 (<-' | '=') Expr [Guard]

  63. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  64. def guard(): Tree

    Guard ::= if PostfixExpr

  65. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  66. def ident(): Name

  67. def ident(skipIt: Boolean): Name

    Assumed (provisionally) to be TermNames.

  68. def identForType(skipIt: Boolean): TypeName

  69. def identForType(): TypeName

    For when it's known already to be a type name.

  70. def implicitClosure(start: Int, location: Int): Tree

    Expr ::= implicit Id => Expr

  71. def importClause(): List[Tree]

    Import ::= import ImportExpr {,' ImportExpr}

  72. def importExpr(): Tree

    ImportExpr ::= StableId .' (Id | _' | ImportSelectors)

  73. def importSelector(): ImportSelector

    ImportSelector ::= Id [=>' Id | =>' _']

  74. def importSelectors(): List[ImportSelector]

    ImportSelectors ::= {' {ImportSelector ,'} (ImportSelector | _') }'

  75. def inBraces[T](body: ⇒ T): T

    Definition Classes
    ParserCommon
  76. def inBracesOrError[T](body: ⇒ T, alt: T): T

    Definition Classes
    ParserCommon
  77. def inBracesOrNil[T](body: ⇒ List[T]): List[T]

    Definition Classes
    ParserCommon
  78. def inBracesOrUnit[T](body: ⇒ Tree): Tree

    Definition Classes
    ParserCommon
  79. def inBrackets[T](body: ⇒ T): T

    Definition Classes
    ParserCommon
  80. def inParens[T](body: ⇒ T): T

    Methods inParensOrError and similar take a second argument which, should the next token not be the expected opener (e.

    Methods inParensOrError and similar take a second argument which, should the next token not be the expected opener (e.g. LPAREN) will be returned instead of the contents of the groupers. However in all cases accept(LPAREN) will be called, so a parse error will still result. If the grouping is optional, in.token should be tested before calling these methods.

    Definition Classes
    ParserCommon
  81. def inParensOrError[T](body: ⇒ T, alt: T): T

    Definition Classes
    ParserCommon
  82. def inParensOrNil[T](body: ⇒ List[T]): List[T]

    Definition Classes
    ParserCommon
  83. def inParensOrUnit[T](body: ⇒ Tree): Tree

    Definition Classes
    ParserCommon
  84. def isDclIntro: Boolean

  85. def isDefIntro: Boolean

  86. def isExprIntro: Boolean

  87. def isExprIntroToken(token: Int): Boolean

  88. def isIdent: Boolean

  89. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  90. def isInterface(mods: Modifiers, body: List[Tree]): Boolean

  91. def isLiteral: Boolean

  92. def isLiteralToken(token: Int): Boolean

  93. def isLocalModifier: Boolean

  94. def isModifier: Boolean

  95. def isNumericLit: Boolean

  96. def isRawBar: Boolean

  97. def isRawStar: Boolean

  98. def isStatSep: Boolean

  99. def isStatSep(token: Int): Boolean

  100. def isStatSeqEnd: Boolean

  101. def isTemplateIntro: Boolean

  102. def isTypeIntro: Boolean

  103. def isTypeIntroToken(token: Int): Boolean

  104. def isUnaryOp: Boolean

  105. def isWildcard(t: Tree): Boolean

  106. def joinComment(trees: ⇒ List[Tree]): List[Tree]

    Join the comment associated with a definition

  107. def literal(isNegated: Boolean): Tree

    SimpleExpr ::= literal | symbol | null

    SimpleExpr ::= literal | symbol | null

    Note

    The returned tree does not yet have a position

  108. def localDef(implicitMod: Int): List[Tree]

    overridable IDE hook for local definitions of blockStatSeq Here's an idea how to fill in start and end positions.

    overridable IDE hook for local definitions of blockStatSeq Here's an idea how to fill in start and end positions. def localDef : List[Tree] = { atEndPos { atStartPos(in.offset) { val annots = annotations(true) val mods = localModifiers() withAnnotations annots if (!(mods hasFlag ~(Flags.IMPLICIT | Flags.LAZY))) defOrDcl(mods) else List(tmplDef(mods)) } } (in.offset) }

  109. def localModifiers(): Modifiers

    LocalModifiers ::= {LocalModifier} LocalModifier ::= abstract | final | sealed | implicit | lazy

  110. def makeFilter(start: Int, tree: Tree): Filter

  111. def makePackageObject(start: Int, objDef: ModuleDef): PackageDef

    Create a tree representing a package object, converting package object foo { .

    Create a tree representing a package object, converting package object foo { ... } to package foo { object package { ... } }

  112. def makePackaging(start: Int, pkg: Tree, stats: List[Tree]): PackageDef

    Create a tree representing a packaging

  113. def makeParens(body: ⇒ List[Tree]): Parens

    Creates an actual Parens node (only used during parsing.

    Creates an actual Parens node (only used during parsing.)

    Definition Classes
    ParserCommon
  114. def mixinQualifierOpt(): TypeName

    MixinQualifier ::= [' Id ]'

  115. def modifiers(): Modifiers

    Modifiers ::= {Modifier} Modifier ::= LocalModifier | AccessModifier | override

  116. def multipleArgumentExprs(): List[List[Tree]]

    A succession of argument lists.

  117. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  118. def newLineOpt(): Unit

  119. def newLineOptWhenFollowedBy(token: Int): Unit

  120. def newLineOptWhenFollowing(p: (Int) ⇒ Boolean): Unit

  121. def newLinesOpt(): Unit

  122. object noSeq extends SeqContextSensitive

    The implementation for parsing inside of patterns at points where sequences are disallowed.

  123. def nonLocalDefOrDcl: List[Tree]

  124. final def notify(): Unit

    Definition Classes
    AnyRef
  125. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  126. def objectDef(start: Int, mods: Modifiers): ModuleDef

    ObjectDef ::= Id ClassTemplateOpt

  127. var opstack: List[OpInfo]

  128. object outPattern extends PatternContextSensitive

    The implementation of the context sensitive methods for parsing outside of patterns.

  129. def packaging(start: Int): Tree

    Packaging ::= package QualId [nl] {' TopStatSeq }'

  130. def paramClauses(owner: Name, contextBounds: List[Tree], ofCaseClass: Boolean): List[List[ValDef]]

    ParamClauses ::= {ParamClause} nl]

  131. def paramType(useStartAsPosition: Boolean): Tree

  132. def paramType(): Tree

    ParamType ::= Type | =>' Type | Type *'

  133. def parse(): Tree

    This is the general parse entry point.

  134. def patDefOrDcl(pos: Int, mods: Modifiers): List[Tree]

    PatDef ::= Pattern2 {,' Pattern2} [:' Type] =' Expr ValDcl ::= Id {,' Id} :' Type VarDef ::= PatDef | Id {,' Id} :' Type =' _'

  135. def path(thisOK: Boolean, typeOK: Boolean): Tree

    Path ::= StableId | [Ident .'] this AnnotType ::= Path [.

    Path ::= StableId | [Ident .'] this AnnotType ::= Path [.' type]

  136. def pattern(): Tree

    Default entry points into some pattern contexts.

  137. def patterns(): List[Tree]

  138. var placeholderParams: List[ValDef]

    The implicit parameters introduced by _' in the current expression. Parameters appear in reverse order

  139. def placeholderTypeBoundary(op: ⇒ Tree): Tree

  140. var placeholderTypes: List[TypeDef]

    The placeholderTypes introduced by _' in the current type. Parameters appear in reverse order

  141. def postfixExpr(): Tree

    PostfixExpr ::= InfixExpr [Id [nl]] InfixExpr ::= PrefixExpr | InfixExpr Id [nl] InfixExpr

  142. def precedence(operator: Name): Int

  143. def prefixExpr(): Tree

    PrefixExpr ::= [-' | +' | ~' | !' | &'] SimpleExpr

  144. def qualId(): Tree

    QualId ::= Id {.' Id}

  145. def readAnnots[T](part: ⇒ T): List[T]

  146. def reduceStack(isExpr: Boolean, base: List[OpInfo], top0: Tree, prec: Int, leftAssoc: Boolean): Tree

  147. def refineStatSeq(): List[Tree]

    RefineStatSeq ::= RefineStat {semi RefineStat} RefineStat ::= Dcl | type TypeDef |

  148. def refinement(): List[Tree]

    Refinement ::= [nl] {' RefineStat {semi RefineStat} }'

  149. def resetPackage(): Unit

  150. def scriptBody(): Tree

    This is the parse entry point for code which is not self-contained, e.

    This is the parse entry point for code which is not self-contained, e.g. a script which is a series of template statements. They will be swaddled in Trees until the AST is equivalent to the one returned by compilationUnit().

  151. def selector(t: Tree): Tree

  152. def selectors(t: Tree, typeOK: Boolean, dotOffset: Int): Tree

  153. def selfInvocation(vparamss: List[List[ValDef]]): Tree

    SelfInvocation ::= this ArgumentExprs {ArgumentExprs}

  154. object seqOK extends SeqContextSensitive

    The implementation for parsing inside of patterns at points where sequences are allowed.

  155. def seqPatterns(): List[Tree]

  156. def simpleExpr(): Tree

  157. def simpleExprRest(t: Tree, canApply: Boolean): Tree

  158. def skip(targetToken: Int): Unit

    Attributes
    protected
  159. def stableId(): Tree

    StableId ::= Id | Path .' Id | [id '.'] super [[' id ]'].

    StableId ::= Id | Path .' Id | [id '.'] super [[' id ]'].' id

  160. def startAnnotType(): Tree

  161. def startInfixType(): Tree

  162. def statement(location: Int): Tree

  163. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  164. def syntaxError(offset: Int, msg: String, skipIt: Boolean): Unit

  165. def syntaxError(msg: String, skipIt: Boolean): Unit

  166. def syntaxErrorOrIncomplete(msg: String, skipIt: Boolean): Unit

  167. def template(isTrait: Boolean): (List[Tree], List[List[Tree]], ValDef, List[Tree])

    ClassTemplate ::= [EarlyDefs with] ClassParents [TemplateBody] TraitTemplate ::= [EarlyDefs with] TraitParents [TemplateBody] EarlyDefs ::= {' [EarlyDef {semi EarlyDef}] }' EarlyDef ::= Annotations Modifiers PatDef

  168. def templateBody(isPre: Boolean): (ValDef, List[Tree])

    TemplateBody ::= [nl] {' TemplateStatSeq }'

    TemplateBody ::= [nl] {' TemplateStatSeq }'

    isPre

    specifies whether in early initializer (true) or not (false)

  169. def templateBodyOpt(traitParentSeen: Boolean): (ValDef, List[Tree])

  170. def templateOpt(mods: Modifiers, name: Name, constrMods: Modifiers, vparamss: List[List[ValDef]], tstart: Int): Template

    ClassTemplateOpt ::= 'extends' ClassTemplate | 'extends']

  171. def templateParents(isTrait: Boolean): (List[Tree], List[List[Tree]])

    ClassParents ::= AnnotType {(' [Exprs] )'} {with AnnotType} TraitParents ::= AnnotType {with AnnotType}

  172. def templateStatSeq(isPre: Boolean): (ValDef, List[Tree])

    TemplateStatSeq ::= [id [:' Type] =>'] TemplateStat {semi TemplateStat} TemplateStat ::= Import | Annotations Modifiers Def | Annotations Modifiers Dcl | Expr1 | super ArgumentExprs {ArgumentExprs} |

    TemplateStatSeq ::= [id [:' Type] =>'] TemplateStat {semi TemplateStat} TemplateStat ::= Import | Annotations Modifiers Def | Annotations Modifiers Dcl | Expr1 | super ArgumentExprs {ArgumentExprs} |

    isPre

    specifies whether in early initializer (true) or not (false)

  173. def tmplDef(pos: Int, mods: Modifiers): Tree

    TmplDef ::= [case] class ClassDef | [case] object ObjectDef | [override] trait TraitDef

  174. def toString(): String

    Definition Classes
    AnyRef → Any
  175. def tokenSeparated[T](separator: Int, sepFirst: Boolean, part: ⇒ T): List[T]

    part { sep part } Or if sepFirst is true, { sep part }

  176. def topLevelTmplDef: Tree

    Hook for IDE, for top-level classes/objects

  177. def topStatSeq(): List[Tree]

    TopStatSeq ::= TopStat {semi TopStat} TopStat ::= Annotations Modifiers TmplDef | Packaging | package object objectDef | Import |

  178. object treeBuilder extends TreeBuilder

  179. def typ(): Tree

    These are default entry points into the pattern context sensitive methods: they are all initiated from non-pattern context.

  180. def typeBounds(): TypeBoundsTree

    TypeBounds ::= [>:' Type] [<:' Type]

  181. def typeDefOrDcl(start: Int, mods: Modifiers): Tree

    TypeDef ::= type Id [TypeParamClause] =' Type TypeDcl ::= type Id [TypeParamClause] TypeBounds

  182. def typeOrInfixType(location: Int): Tree

  183. def typeParamClauseOpt(owner: Name, contextBoundBuf: ListBuffer[Tree]): List[TypeDef]

    TypeParamClauseOpt ::= [TypeParamClause] TypeParamClause ::= [' VariantTypeParam {,' VariantTypeParam} ]'] VariantTypeParam ::= {Annotation} [+' | -'] TypeParam FunTypeParamClauseOpt ::= [FunTypeParamClause] FunTypeParamClause ::= [' TypeParam {,' TypeParam} ]'] TypeParam ::= Id TypeParamClauseOpt TypeBounds {<% Type} {":" Type}

  184. def typedOpt(): Tree

    TypedOpt ::= [:' Type]

  185. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()
  188. def warning(msg: String): Unit

  189. def wildcardOrIdent(): Name

  190. def wildcardType(start: Int): Ident

    WildcardType ::= _' TypeBounds

Inherited from ParserCommon

Inherited from AnyRef

Inherited from Any