Methods which implicitly propagate the context in which they were called: either in a pattern context or not.
Methods which implicitly propagate the context in which they were called: either in a pattern context or not. Formerly, this was threaded through numerous methods as boolean isPattern.
Methods which implicitly propagate whether the initial call took place in a context where sequences are allowed.
Methods which implicitly propagate whether the initial call took place in a context where sequences are allowed. Formerly, this was threaded through methods as boolean seqOK.
Consume one token of the specified type, or signal an error if it is not there.
If current token is T consume it.
semi = nl {nl} | `;'
nl = `\n' // where allowed
AccessModifier ::= (private | protected) [AccessQualifier] AccessQualifier ::= `[' (Id | this) `]'
Scoping operator used to temporarily look into the future.
Scoping operator used to temporarily look into the future. Backs up token iterator before evaluating a block and restores it after.
Annotations ::= {`@' SimpleType {ArgumentExprs}} ConsrAnnotations ::= {`@' SimpleType ArgumentExprs}
ArgumentExprs ::= `(' [Exprs] `)' | [nl] BlockExpr
Block ::= BlockStatSeq
Return tree does not carry position.
BlockExpr ::= `{' (CaseClauses | Block) `}'
BlockStatSeq ::= { BlockStat semi } [ResultExpr] BlockStat ::= Import | Annotations [implicit] [lazy] Def | Annotations LocalModifiers TmplDef | Expr1 |
CaseClauses ::= CaseClause {CaseClause} CaseClause ::= case Pattern [Guard] `=>' Block
ClassDef ::= Id [TypeParamClause] {Annotation} [AccessModifier] ClassParamClauses RequiresTypeOpt ClassTemplateOpt
ConstrBlock ::= `{' SelfInvocation {semi BlockStat} `}'
ConstrExpr ::= SelfInvocation | ConstrBlock
Convert tree to formal parameter.
Convert tree to formal parameter list.
Def ::= val PatDef | var PatDef | def FunDef | type [nl] TypeDef | TmplDef Dcl ::= val PatDcl | var PatDcl | def FunDcl | type [nl] TypeDcl
Enumerators ::= Generator {semi Enumerator} Enumerator ::= Generator | Guard | val Pattern1 `=' Expr
Expr ::= (Bindings | [`implicit'] Id | `_') `=>' Expr | Expr1 ResultExpr ::= (Bindings | Id `:' CompoundType) `=>' Block | Expr1 Expr1 ::= if `(' Expr `)' {nl} Expr [[semi] else Expr] | try (`{' Block `}' | Expr) [catch `{' CaseClauses `}'] [finally Expr] | while `(' Expr `)' {nl} Expr | do Expr [semi] while `(' Expr `)' | for (`(' Enumerators `)' | `{' Enumerators `}') {nl} [yield] Expr | throw Expr | return [Expr] | [SimpleExpr `.'] Id `=' Expr | SimpleExpr1 ArgumentExprs `=' Expr | PostfixExpr Ascription | PostfixExpr match `{' CaseClauses `}' Bindings ::= `(' [Binding {`,' Binding}] `)' Binding ::= (Id | `_') [`:' Type] Ascription ::= `:' CompoundType | `:' Annotation {Annotation} | `:' `_' `*'
FunDef ::= FunSig [`:' Type] `=' [`macro'] Expr
| FunSig [nl] `{' Block `}'
| `this' ParamClause ParamClauses
(`=' ConstrExpr | [nl] ConstrBlock)
FunDcl ::= FunSig [`:' Type]
FunSig ::= id [FunTypeParamClause] ParamClauses
Generator ::= Pattern1 (`<-' | `=') Expr [Guard]
Guard ::= if PostfixExpr
Expr ::= implicit Id => Expr
Import ::= import ImportExpr {`,' ImportExpr}
ImportSelector ::= Id [`=>' Id | `=>' `_']
ImportSelectors ::= `{' {ImportSelector `,'} (ImportSelector | `_') `}'
ImportExpr ::= StableId `.' (Id | `_' | ImportSelectors)
Methods inParensOrError and similar take a second argument which, should the next token not be the expected opener (e.g.
Methods inParensOrError and similar take a second argument which, should the next token not be the expected opener (e.g. token.LeftParen) will be returned instead of the contents of the groupers. However in all cases accept[LeftParen] will be called, so a parse error will still result. If the grouping is optional, token should be tested before calling these methods.
SimpleExpr ::= literal
| symbol
| null
LocalModifiers ::= {LocalModifier} LocalModifier ::= abstract | final | sealed | implicit | lazy
MixinQualifier ::= `[' Id `]'
Modifiers ::= {Modifier}
Modifier ::= LocalModifier
| AccessModifier
| override
The implementation for parsing inside of patterns at points where sequences are disallowed.
ObjectDef ::= Id ClassTemplateOpt
The implementation of the context sensitive methods for parsing outside of patterns.
ParamClauses ::= {ParamClause} [[nl] `(' implicit Params `)'] ParamClause ::= [nl] `(' [Params] `)' Params ::= Param {`,' Param} Param ::= {Annotation} Id [`:' ParamType] [`=' Expr] ClassParamClauses ::= {ClassParamClause} [[nl] `(' implicit ClassParams `)'] ClassParamClause ::= [nl] `(' [ClassParams] `)' ClassParams ::= ClassParam {`,' ClassParam} ClassParam ::= {Annotation} [{Modifier} (`val' | `var')] Id [`:' ParamType] [`=' Expr]
ParamType ::= Type | `=>' Type | Type `*'
PatDef ::= Pattern2 {`,' Pattern2} [`:' Type] `=' Expr
ValDcl ::= Id {`,' Id} `:' Type
VarDef ::= PatDef | Id {`,' Id} `:' Type `=' `_'
Path ::= StableId | [Ident `.'] this ModType ::= Path [`.' type]
Default entry points into some pattern contexts.
Perform an operation while peeking ahead.
Perform an operation while peeking ahead. Recover to inputal state in case of exception.
PostfixExpr ::= InfixExpr [Id [nl]] InfixExpr ::= PrefixExpr | InfixExpr Id [nl] InfixExpr
PrefixExpr ::= [`-' | `+' | `~' | `!' | `&'] SimpleExpr
QualId ::= Id {`.' Id}
RefineStatSeq ::= RefineStat {semi RefineStat}
RefineStat ::= Dcl
| type TypeDef
|
Refinement ::= [nl] `{' RefineStat {semi RefineStat} `}'
SelfInvocation ::= this ArgumentExprs {ArgumentExprs}
The implementation for parsing inside of patterns at points where sequences are allowed.
SimpleExpr ::= new (ClassTemplate | TemplateBody)
| BlockExpr
| SimpleExpr1 [`_']
SimpleExpr1 ::= literal
| xLiteral
| Path
| `(' [Exprs] `)'
| SimpleExpr `.' Id
| SimpleExpr TypeArgs
| SimpleExpr1 ArgumentExprs
CompilationUnit ::= {package QualId semi} TopStatSeq
StableId ::= Id | Path `.' Id | [id `.'] super [`[' id `]']`.' id
ClassTemplate ::= [EarlyDefs with] ClassParents [TemplateBody] TraitTemplate ::= [EarlyDefs with] TraitParents [TemplateBody] EarlyDefs ::= `{' [EarlyDef {semi EarlyDef}] `}' EarlyDef ::= Annotations Modifiers PatDef
TemplateBody ::= [nl] `{' TemplateStatSeq `}'
specifies whether in early initializer (true) or not (false)
ClassTemplateOpt ::= `extends' ClassTemplate | [[`extends'] TemplateBody] TraitTemplateOpt ::= TraitExtends TraitTemplate | [[`extends'] TemplateBody] | `<:' TemplateBody TraitExtends ::= `extends' | `<:'
ClassParents ::= ModType {`(' [Exprs] `)'} {with ModType} TraitParents ::= ModType {with ModType}
TemplateStatSeq ::= [id [`:' Type] `=>'] TemplateStats
specifies whether in early initializer (true) or not (false)
TemplateStats ::= TemplateStat {semi TemplateStat}
TemplateStat ::= Import
| Annotations Modifiers Def
| Annotations Modifiers Dcl
| Expr1
| super ArgumentExprs {ArgumentExprs}
|
TmplDef ::= [case] class ClassDef | [case] object ObjectDef | [override] trait TraitDef
, or if sepFirst is true,
part { `sep` part }
, or if sepFirst is true,
{ `sep` part }
.
if useUnquoteForEllipsis = true, uses direct unquote instead of part
{ sep
part }
}}}
if useUnquoteForEllipsis = true, uses direct unquote instead of part
part { sep
part }
}}}
if useUnquoteForEllipsis = true, uses direct unquote instead of part
Hook for IDE, for top-level classes/objects.
TopStatSeq ::= TopStat {semi TopStat} TopStat ::= Annotations Modifiers TmplDef | Packaging | package object objectDef | Import |
TraitDef ::= Id [TypeParamClause] RequiresTypeOpt TraitTemplateOpt
These are default entry points into the pattern context sensitive methods: they are all initiated from non-pattern context.
TypeBounds ::= [`>:' Type] [`<:' Type]
TypeDef ::= type Id [TypeParamClause] `=' Type | FunSig `=' Expr TypeDcl ::= type Id [TypeParamClause] TypeBounds
TypeParamClauseOpt ::= [TypeParamClause] TypeParamClause ::= `[' VariantTypeParam {`,' VariantTypeParam} `]'] VariantTypeParam ::= {Annotation} [`+' | `-'] TypeParam FunTypeParamClauseOpt ::= [FunTypeParamClause] FunTypeParamClause ::= `[' TypeParam {`,' TypeParam} `]'] TypeParam ::= Id TypeParamClauseOpt TypeBounds {<% Type} {":" Type}
TypedOpt ::= [`:' Type]
For use from xml pattern, where sequence is allowed and encouraged.