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.
The offset at the start of the token to accept
semi = nl {nl} | ;'
nl =
\n' // where allowed
AccessQualifier ::= "[" (Id | this) "]"
Always add the syntactic mod
, but check and conditionally add semantic mod.flags
Adjust start of annotation or constructor to position of preceding @ or new
Annotation ::= @' SimpleType {ParArgumentExprs}
AnnotType ::= SimpleType {Annotation}
ArgTypes ::= Type {,' Type}
| NamedTypeArg {
,' NamedTypeArg}
ArgumentExprs ::= ParArgumentExprs | [nl] BlockExpr
ArgumentExprss ::= {ArgumentExprs}
ArgumentPatterns ::= (' [Patterns]
)'
| (' [Patterns
,'] Pattern2 :'
_' *' ')
If the last read offset is strictly greater than start
, position tree
to position spanning from start
to last read offset, with given point.
If the last read offset is strictly greater than start
, position tree
to position spanning from start
to last read offset, with given point.
If the last offset is less than or equal to start, the tree t
did not
consume any source for its construction. In this case, don't position it yet,
but wait for its position to be determined by setChildPositions
when the
parent node is positioned.
Positions tree.
Positions tree.
If t
does not have a position yet, set its position to the given one.
Block ::= BlockStatSeq
Block ::= BlockStatSeq
Return tree does not carry source position.
BlockExpr ::= {' (CaseClauses | Block)
}'
BlockStatSeq ::= { BlockStat semi } [ResultExpr] BlockStat ::= Import | Annotations [implicit] [lazy] Def | Annotations LocalModifiers TmplDef | Expr1 |
CaseClause ::= case Pattern [Guard] =>' Block
CaseClauses ::= CaseClause {CaseClause}
ClassDef ::= Id [ClsTypeParamClause] [ConstrMods] ClsParamClauses TemplateOpt
CompilationUnit ::= {package QualId semi} TopStatSeq
ConstrApp ::= SimpleType {ParArgumentExprs}
ConstrBlock ::= {' SelfInvocation {semi BlockStat}
}'
ConstrExpr ::= SelfInvocation | ConstrBlock
ConstrMods ::= AccessModifier
| Annotation {Annotation} (AccessModifier | this')
Convert tree to formal parameter
Convert tree to formal parameter list
Convert (qual)ident to type identifier
DefDef ::= DefSig (:' Type [
=' Expr] | "=" Expr)
| this ParamClause ParamClauses =' ConstrExpr
DefDcl ::= DefSig
:' Type
DefSig ::= id [DefTypeParamClause] ParamClauses
Def ::= val PatDef | var VarDef | def DefDef | type {nl} TypeDcl | TmplDef Dcl ::= val ValDcl | var ValDcl | def DefDcl | type {nl} TypeDcl
DotSelectors ::= { .' ident()
DotSelectors ::= { .' ident()
Accept .' separated identifiers acting as a selectors on given tree
t.
An alternative parse in case the token following a .' is not an identifier.
If the alternative does not apply, its tree argument is returned unchanged.
Enumerator ::= Generator
| Guard
| Pattern1 =' Expr
Enumerators ::= Generator {semi Enumerator | Guard}
EqualsExpr ::= =' Expr
Expr ::= FunParams =>' Expr
| Expr1
FunParams ::= Bindings
| [
implicit'] Id
| _'
ExprInParens ::= PostfixExpr
:' Type
| Expr
BlockResult ::= (FunParams | [implicit'] Id
:' InfixType) => Block
| Expr1
Expr1 ::= if'
(' Expr )' {nl} Expr else Expr]
|
if' Expr
then' Expr else Expr]
| while'
(' Expr )' {nl} Expr
|
while' Expr do' Expr
|
do' Expr [semi] while' Expr
|
try' Expr Catches [finally' Expr]
|
try' Expr [finally' Expr]
|
throw' Expr
| return' [Expr]
| ForExpr
| [SimpleExpr
.'] Id =' Expr
| SimpleExpr1 ArgumentExprs
=' Expr
| PostfixExpr [Ascription]
| PostfixExpr match'
{' CaseClauses }'
Bindings ::=
(' [Binding {,' Binding}]
)'
Binding ::= (Id | _') [
:' Type]
Ascription ::= :' CompoundType
|
:' Annotation {Annotation}
| :'
_' *'
ExprsInParens ::= ExprInParens {,' ExprInParens}
ForExpr ::= for' (
(' Enumerators )' |
{' Enumerators }')
{nl} [
yield'] Expr
| for' Enumerators (
do' Expr | yield' Expr)
FunArgType ::= Type | =>' Type
Generator ::= Pattern <-' Expr
Guard ::= if PostfixExpr
Accept identifier and return its name as a term name.
Expr ::= implicit Id =>' Expr
BlockResult ::= implicit Id [
:' InfixType] =>' Block
Import ::= import ImportExpr {,' ImportExpr}
ImportExpr ::= StableId .' (Id |
_' | ImportSelectors)
ImportSelector ::= Id [=>' Id |
=>' _']
ImportSelectors ::= {' {ImportSelector
,'} (ImportSelector | _')
}'
Issue an error at current offset taht input is incomplete
operand { infixop operand} [postfixop], respecting rules of associativity and precedence.
operand { infixop operand} [postfixop], respecting rules of associativity and precedence.
a token that does not count as operator.
postfix operators are allowed.
InfixPattern ::= SimplePattern {Id [nl] SimplePattern}
InfixType ::= RefinedType {id [nl] refinedType}
Is offset1 less or equally indented than offset2? This is the case if the characters between the preceding end-of-line and offset1 are a prefix of the characters between the preceding end-of-line and offset2.
The offset where the last syntax error was reported, or if a skip to a safepoint occurred afterwards, the offset of the safe point.
The offset where the last syntax error was reported, or if a skip to a safepoint occurred afterwards, the offset of the safe point.
SimpleExpr ::= literal | symbol | null
SimpleExpr ::= literal | symbol | null
The offset of a preceding -' sign, if any.
If the literal is not negated, negOffset = in.offset.
Create a tree representing a packaging
MixinQualifier ::= [' Id
]'
{Annotation} {Modifier} Modifiers ::= {Modifier} LocalModifiers ::= {LocalModifier} AccessModifier ::= (private | protected) [AccessQualifier] Modifier ::= LocalModifier | AccessModifier | override LocalModifier ::= abstract | final | sealed | implicit | lazy
NamedTypeArg ::= id =' Type
ObjectDef ::= Id TemplateOpt
Packaging ::= package QualId [nl] {' TopStatSeq
}'
ParArgumentExprs ::= (' [ExprsInParens]
)'
| (' [ExprsInParens
,'] PostfixExpr :'
_' *' ')' \
ParArgumentExprss ::= {ParArgumentExprs}
ClsParamClauses ::= {ClsParamClause} ('
implicit' ClsParams )']
ClsParamClause ::= [nl]
(' [ClsParams] ')'
ClsParams ::= ClsParam {' ClsParam}
ClsParam ::= {Annotation} [{Modifier} (
val' | var') |
inline'] Param
DefParamClauses ::= {DefParamClause} ('
implicit' DefParams )']
DefParamClause ::= [nl]
(' [DefParams] ')'
DefParams ::= DefParam {,' DefParam}
DefParam ::= {Annotation} [
inline'] Param
Param ::= id :' ParamType [
=' Expr]
ParamType ::= [=>'] ParamValueType
ParamValueType ::= Type [*']
This is the general parse entry point.
This is the general parse entry point. Overridden by ScriptParser
PatDef ::= Pattern2 {,' Pattern2} [
:' Type] =' Expr
VarDef ::= PatDef | Id {
,' Id} :' Type
=' _'
ValDcl ::= Id {
,' Id} :' Type
VarDcl ::= Id {
,' Id} :' Type
Path ::= StableId
| [Ident .'] this
Path ::= StableId
| [Ident .'] this
If true, [Ident .'] this is acceptable as the path.
If false, another selection is required after the
this.
An alternative parse in case the token following a .' is not an identifier.
If the alternative does not apply, its tree argument is returned unchanged.
Pattern ::= Pattern1 { |' Pattern1 }
Pattern1 ::= PatVar Ascription | Pattern2
Pattern2 ::= [varid @'] InfixPattern
Patterns ::= Pattern [,' Pattern]
The implicit parameters introduced by _
in the current expression.
The implicit parameters introduced by _
in the current expression.
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 | (in reality we admit Defs and filter them out afterwards)
RefinedType ::= WithType {Annotation | [nl] Refinement}
Refinement ::= {' RefineStatSeq
}'
Accept identifier acting as a selector on given tree t
.
Selectors ::= ident { .' ident()
Selectors ::= ident { .' ident()
Accept .' separated identifiers acting as a selectors on given tree
t.
An alternative parse in case the next token is not an identifier. If the alternative does not apply, its tree argument is returned unchanged.
SelfInvocation ::= this ArgumentExprs {ArgumentExprs}
SimpleExpr ::= new Template
| BlockExpr
| SimpleExpr1 [_']
SimpleExpr1 ::= literal
| xmlLiteral
| Path
|
(' [ExprsInParens] )'
| SimpleExpr
.' Id
| SimpleExpr (TypeArgs | NamedTypeArgs)
| SimpleExpr1 ArgumentExprs
SimplePattern ::= PatVar
| Literal
| XmlPattern
| (' [Patterns]
)'
| SimplePattern1 [TypeArgs] [ArgumentPatterns]
SimplePattern1 ::= Path
| {' Block
}'
| SimplePattern1 .' Id
PatVar ::= Id
|
_'
SimpleType ::= SimpleType TypeArgs
| SimpleType #' Id
| StableId
| Path
.' type
| (' ArgTypes
)'
| _' TypeBounds
| Refinement
| Literal
Skip on error to next safe point.
Skip on error to next safe point. Safe points are:
StableId ::= Id
| Path .' Id
| [id '.'] super [
[' id ]']
.' id
Unconditionally issue an error at given position, without updating lastErrorOffset.
Unconditionally issue an error at given position, without updating lastErrorOffset.
Issue an error at given offset if beyond last error offset and update lastErrorOffset.
Issue an error at given offset if beyond last error offset and update lastErrorOffset.
If at end of file, issue an incompleteInputError.
If at end of file, issue an incompleteInputError. Otherwise issue a syntax error and skip to next safe point.
Template ::= ConstrApps [TemplateBody] | TemplateBody
ConstrApps ::= ConstrApp {with' ConstrApp}
Template ::= ConstrApps [TemplateBody] | TemplateBody
ConstrApps ::= ConstrApp {with' ConstrApp}
a pair consisting of the template, and a boolean which indicates whether the template misses a body (i.e. no {...} part).
TemplateBody ::= [nl] {' TemplateStatSeq
}'
TemplateOpt = [extends' Template | TemplateBody]
TemplateStatSeq ::= [id [:' Type]
=>'] TemplateStat {semi TemplateStat}
TemplateStat ::= Import
| Annotations Modifiers Def
| Annotations Modifiers Dcl
| Expr1
| super ArgumentExprs {ArgumentExprs}
|
Accept identifier and return Ident with its name as a term name.
TmplDef ::= ([case']
class' | trait') ClassDef
| [
case'] object' ObjectDef
part { separator
part }
TopStatSeq ::= TopStat {semi TopStat} TopStat ::= Annotations Modifiers TmplDef | Packaging | package object objectDef | Import |
Same as typ, but if this results in a wildcard it emits a syntax error and
returns a tree for type Any
instead.
Type ::= FunArgTypes =>' Type
| HkTypeParamClause
->' Type
| InfixType
FunArgTypes ::= InfixType
| (' [ FunArgType {
,' FunArgType } ] )'
TypeArgs ::= [' Type {
,' Type} ]'
NamedTypeArgs ::=
[' NamedTypeArg {,' NamedTypeArg}
]'
TypeBounds ::= [>:' Type] [
<:' Type]
TypeDef ::= type Id [TypeParamClause] =' Type
TypeDcl ::= type Id [TypeParamClause] TypeBounds
Accept identifier and return Ident with its name as a type name.
TypeParamBounds ::= TypeBounds {<%' Type} {
:' Type}
ClsTypeParamClause::= [' ClsTypeParam {
,' ClsTypeParam} ]'
ClsTypeParam ::= {Annotation} [{Modifier} type] [
+' | -']
Id [HkTypeParamClause] TypeParamBounds
ClsTypeParamClause::= [' ClsTypeParam {
,' ClsTypeParam} ]'
ClsTypeParam ::= {Annotation} [{Modifier} type] [
+' | -']
Id [HkTypeParamClause] TypeParamBounds
DefTypeParamClause::= [' DefTypeParam {
,' DefTypeParam} ]'
DefTypeParam ::= {Annotation} Id [HkTypeParamClause] TypeParamBounds
TypTypeParamCaluse::= [' TypTypeParam {
,' TypTypeParam} ]'
TypTypeParam ::= {Annotation} Id [HkTypePamClause] TypeBounds
HkTypeParamClause ::= [' HkTypeParam {
,' HkTypeParam} ]'
HkTypeParam ::= {Annotation} ['+' |
-'] (Id[HkTypePamClause] | _') TypeBounds
Throws an UnsupportedOperationException
with the given method name.
Throws an UnsupportedOperationException
with the given method name.
WithType ::= AnnotType {with' AnnotType} (deprecated)
Wrap annotation or constructor in New(...).<init>
the markup parser