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.
Test two objects for inequality.
Test two objects for inequality.
true
if !(this == that), false otherwise.
Equivalent to x.hashCode
except for boxed numeric types and null
.
Equivalent to x.hashCode
except for boxed numeric types and null
.
For numerics, it returns a hash value which is consistent
with value equality: if two value type instances compare
as true, then ## will produce the same hash value for each
of them.
For null
returns a hashcode where null.hashCode
throws a
NullPointerException
.
a hash value consistent with ==
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
true
if the receiver object is equivalent to the argument; false
otherwise.
Modes for infix types.
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.
semi = nl {nl} | `;`
nl = `\n' // where allowed
AccessModifier ::= (private | protected) [AccessQualifier]
AccessQualifier ::= `[' (Id | this) `]'
Annotations ::= {`@' SimpleType {ArgumentExprs}} ConsrAnnotations ::= {`@' SimpleType ArgumentExprs}
ArgumentExprs ::= `(' [Exprs] `)' | [nl] BlockExpr
Cast the receiver object to be of type T0
.
Cast the receiver object to be of type T0
.
Note that the success of a cast at runtime is modulo Scala's erasure semantics.
Therefore the expression 1.asInstanceOf[String]
will throw a ClassCastException
at
runtime, while the expression List(1).asInstanceOf[List[String]]
will not.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the requested type.
the receiver object.
ClassCastException
if the receiver object is not an instance of the erasure of type T0
.
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
Check that type parameter is not by name or repeated.
ClassDef ::= Id [TypeParamClause] {Annotation} [AccessModifier] ClassParamClauses RequiresTypeOpt ClassTemplateOpt TraitDef ::= Id [TypeParamClause] RequiresTypeOpt TraitTemplateOpt
Create a copy of the receiver object.
Create a copy of the receiver object.
The default implementation of the clone
method is platform dependent.
a copy of the receiver object.
not specified by SLS as a member of AnyRef
CompilationUnit ::= {package QualId semi} TopStatSeq
ConstrBlock ::= `{' SelfInvocation {semi BlockStat} `}'
ConstrExpr ::= SelfInvocation | ConstrBlock
Convert tree to formal parameter.
Convert tree to formal parameter list.
Convert (qual)ident to type identifier.
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
Tests whether the argument (that
) is a reference to the receiver object (this
).
Tests whether the argument (that
) is a reference to the receiver object (this
).
The eq
method implements an equivalence relation on
non-null instances of AnyRef
, and has three additional properties:
x
and y
of type AnyRef
, multiple invocations of
x.eq(y)
consistently returns true
or consistently returns false
.x
of type AnyRef
, x.eq(null)
and null.eq(x)
returns false
.null.eq(null)
returns true
. When overriding the equals
or hashCode
methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they
should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).
true
if the argument is a reference to the receiver object; false
otherwise.
The equality method for reference types.
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} | `:' `_' `*'
Called by the garbage collector on the receiver object when there are no more references to the object.
Called by the garbage collector on the receiver object when there are no more references to the object.
The details of when and if the finalize
method is invoked, as
well as the interaction between finalize
and non-local returns
and exceptions, are all platform dependent.
not specified by SLS as a member of AnyRef
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]
A representation that corresponds to the dynamic class of the receiver object.
A representation that corresponds to the dynamic class of the receiver object.
The nature of the representation is platform dependent.
a representation that corresponds to the dynamic class of the receiver object.
not specified by SLS as a member of AnyRef
Guard ::= if PostfixExpr
The hashCode method for reference types.
Assumed (provisionally) to be TermNames.
For when it's known already to be a type name.
Expr ::= implicit Id => Expr
Import ::= import ImportExpr {`,' ImportExpr}
ImportExpr ::= StableId `.' (Id | `_' | ImportSelectors)
ImportSelector ::= Id [`=>' Id | `=>' `_']
ImportSelectors ::= `{' {ImportSelector `,'} (ImportSelector | `_') `}'
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. 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.
Test whether the dynamic type of the receiver object is T0
.
Test whether the dynamic type of the receiver object is T0
.
Note that the result of the test is modulo Scala's erasure semantics.
Therefore the expression 1.isInstanceOf[String]
will return false
, while the
expression List(1).isInstanceOf[List[String]]
will return true
.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the specified type.
true
if the receiver object is an instance of erasure of type T0
; false
otherwise.
A hook for joining the comment associated with a definition.
A hook for joining the comment associated with a definition. Overridden by scaladoc.
SimpleExpr ::= literal
| symbol
| null
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(skipNewLines = true) val mods = localModifiers() withAnnotations annots if (!(mods hasFlag ~(Flags.IMPLICIT | Flags.LAZY))) defOrDcl(mods) else List(tmplDef(mods)) } } (in.offset) }
LocalModifiers ::= {LocalModifier} LocalModifier ::= abstract | final | sealed | implicit | lazy
Scoping operator used to temporarily look into the future.
Scoping operator used to temporarily look into the future. Backs up scanner data before evaluating a block and restores it after.
Create tree representing (unencoded) binary operation expression or pattern.
Create a tree representing a packaging.
Creates an actual Parens node (only used during parsing.)
Creates an actual Parens node (only used during parsing.)
Create a tuple term Tree.
Create a tuple term Tree. If the arity is not supported, a syntax error is emitted.
Create a tuple type Tree.
Create a tuple type Tree. If the arity is not supported, a syntax error is emitted.
MixinQualifier ::= `[' Id `]'
Modifiers ::= {Modifier}
Modifier ::= LocalModifier
| AccessModifier
| override
A succession of argument lists.
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
true
if the argument is not a reference to the receiver object; false
otherwise.
The implementation for parsing inside of patterns at points where sequences are disallowed.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
not specified by SLS as a member of AnyRef
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
not specified by SLS as a member of AnyRef
ObjectDef ::= Id ClassTemplateOpt
The implementation of the context sensitive methods for parsing outside of patterns.
Create a tree representing a package object, converting
Create a tree representing a package object, converting
package object foo { ... }
to
package foo { object `package` { ... } }
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 `*'
This is the general parse entry point.
These are alternative entry points for repl, script runner, toolbox and parsing in macros.
PatDef ::= Pattern2 {`,' Pattern2} [`:' Type] `=' Expr
ValDcl ::= Id {`,' Id} `:' Type
VarDef ::= PatDef | Id {`,' Id} `:' Type `=' `_'
Path ::= StableId | [Ident `.'] this AnnotType ::= Path [`.' type]
Default entry points into some pattern contexts.
Perform an operation while peeking ahead.
Perform an operation while peeking ahead. Pushback if the operation yields an empty tree or blows to pieces.
The implicit parameters introduced by _
in the current expression.
The implicit parameters introduced by _
in the current expression.
Parameters appear in reverse order.
The placeholderTypes introduced by _
in the current type.
The placeholderTypes introduced by _
in the current type.
Parameters appear in reverse order.
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} `}'
This is the parse entry point for code which is not self-contained, e.g.
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().
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
StableId ::= Id | Path `.' Id | [id `.'] super [`[' id `]']`.' id
Strip the artifitial Parens
node to create a tuple term Tree.
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 ::= AnnotType {`(' [Exprs] `)'} {with AnnotType} TraitParents ::= AnnotType {with AnnotType}
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
Creates a String representation of this object.
Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.
a String representation of the object.
,or if sepFirst is true,
part { `sep` part }
,or if sepFirst is true,
{ `sep` part }
.
{ sep
part }
}}}
part { sep
part }
}}}
Hook for IDE, for top-level classes/objects.
TopStatSeq ::= TopStat {semi TopStat} TopStat ::= Annotations Modifiers TmplDef | Packaging | package object objectDef | Import |
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]
WildcardType ::= `_' TypeBounds
For use from xml pattern, where sequence is allowed and encouraged.
(Since version 2.11.0) Use scala.reflect.internal.Precedence