@@ -84,6 +84,7 @@ comment ::= ‘/*’ “any sequence of characters; nested comments ar
8484 | ‘//’ “any sequence of characters up to end of line”
8585
8686nl ::= “new line character”
87+ <,> ::= [ ‘,’ nl ]
8788semi ::= ‘;’ | nl {nl}
8889```
8990
@@ -168,7 +169,7 @@ FunType ::= FunTypeArgs (‘=>’ | ‘?=>’) Type
168169FunTypeArgs ::= InfixType
169170 | ‘(’ [ FunArgTypes ] ‘)’
170171 | FunParamClause
171- FunParamClause ::= ‘(’ TypedFunParam {‘,’ TypedFunParam } ‘)’
172+ FunParamClause ::= ‘(’ TypedFunParam {‘,’ TypedFunParam } <,> ‘)’
172173TypedFunParam ::= id ‘:’ Type
173174MatchType ::= InfixType `match` <<< TypeCaseClauses >>>
174175InfixType ::= RefinedType {id [nl] RefinedType} InfixOp(t1, op, t2)
@@ -181,7 +182,7 @@ SimpleType ::= SimpleLiteral
181182SimpleType1 ::= id Ident(name)
182183 | Singleton ‘.’ id Select(t, name)
183184 | Singleton ‘.’ ‘type’ SingletonTypeTree(p)
184- | ‘(’ Types ‘)’ Tuple(ts)
185+ | ‘(’ Types <,> ‘)’ Tuple(ts)
185186 | Refinement RefinedTypeTree(EmptyTree, refinement)
186187 | ‘$’ ‘{’ Block ‘}’ -- unless inside quoted pattern
187188 | ‘$’ ‘{’ Pattern ‘}’ -- only inside quoted pattern
@@ -196,7 +197,7 @@ FunArgType ::= Type
196197FunArgTypes ::= FunArgType { ‘,’ FunArgType }
197198ParamType ::= [‘=>’] ParamValueType
198199ParamValueType ::= Type [‘*’] PostfixOp(t, "*")
199- TypeArgs ::= ‘[’ Types ‘]’ ts
200+ TypeArgs ::= ‘[’ Types <,> ‘]’ ts
200201Refinement ::= ‘{’ [RefineDcl] {semi [RefineDcl]} ‘}’ ds
201202TypeBounds ::= [‘>:’ Type] [‘<:’ Type] TypeBoundsTree(lo, hi)
202203TypeParamBounds ::= TypeBounds {‘:’ Type} ContextBounds(typeBounds, tps)
@@ -249,7 +250,7 @@ SimpleExpr ::= SimpleRef
249250 | quoteId -- only inside splices
250251 | ‘new’ ConstrApp {‘with’ ConstrApp} [TemplateBody] New(constr | templ)
251252 | ‘new’ TemplateBody
252- | ‘(’ ExprsInParens ‘)’ Parens(exprs)
253+ | ‘(’ ExprsInParens <,> ‘)’ Parens(exprs)
253254 | SimpleExpr ‘.’ id Select(expr, id)
254255 | SimpleExpr ‘.’ MatchClause
255256 | SimpleExpr TypeArgs TypeApply(expr, args)
@@ -264,8 +265,8 @@ Quoted ::= ‘'’ ‘{’ Block ‘}’
264265ExprsInParens ::= ExprInParens {‘,’ ExprInParens}
265266ExprInParens ::= PostfixExpr ‘:’ Type -- normal Expr allows only RefinedType here
266267 | Expr
267- ParArgumentExprs ::= ‘(’ [‘using’] ExprsInParens ‘)’ exprs
268- | ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘*’ ‘)’ exprs :+ Typed(expr, Ident(wildcardStar))
268+ ParArgumentExprs ::= ‘(’ [‘using’] ExprsInParens <,> ‘)’ exprs
269+ | ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘*’ <,> ‘)’ exprs :+ Typed(expr, Ident(wildcardStar))
269270ArgumentExprs ::= ParArgumentExprs
270271 | BlockExpr
271272BlockExpr ::= <<< CaseClauses | Block >>>
@@ -309,44 +310,44 @@ SimplePattern1 ::= SimpleRef
309310PatVar ::= varid
310311 | ‘_’
311312Patterns ::= Pattern {‘,’ Pattern}
312- ArgumentPatterns ::= ‘(’ [Patterns] ‘)’ Apply(fn, pats)
313- | ‘(’ [Patterns ‘,’] PatVar ‘*’ ‘)’
313+ ArgumentPatterns ::= ‘(’ [Patterns] <,> ‘)’ Apply(fn, pats)
314+ | ‘(’ [Patterns ‘,’] PatVar ‘*’ <,> ‘)’
314315```
315316
316317### Type and Value Parameters
317318``` ebnf
318- ClsTypeParamClause::= ‘[’ ClsTypeParam {‘,’ ClsTypeParam} ‘]’
319+ ClsTypeParamClause::= ‘[’ ClsTypeParam {‘,’ ClsTypeParam} <,> ‘]’
319320ClsTypeParam ::= {Annotation} [‘+’ | ‘-’] TypeDef(Modifiers, name, tparams, bounds)
320321 id [HkTypeParamClause] TypeParamBounds Bound(below, above, context)
321322
322- DefTypeParamClause::= ‘[’ DefTypeParam {‘,’ DefTypeParam} ‘]’
323+ DefTypeParamClause::= ‘[’ DefTypeParam {‘,’ DefTypeParam} <,> ‘]’
323324DefTypeParam ::= {Annotation} id [HkTypeParamClause] TypeParamBounds
324325
325- TypTypeParamClause::= ‘[’ TypTypeParam {‘,’ TypTypeParam} ‘]’
326+ TypTypeParamClause::= ‘[’ TypTypeParam {‘,’ TypTypeParam} <,> ‘]’
326327TypTypeParam ::= {Annotation} id [HkTypeParamClause] TypeBounds
327328
328- HkTypeParamClause ::= ‘[’ HkTypeParam {‘,’ HkTypeParam} ‘]’
329+ HkTypeParamClause ::= ‘[’ HkTypeParam {‘,’ HkTypeParam} <,> ‘]’
329330HkTypeParam ::= {Annotation} [‘+’ | ‘-’] (id [HkTypeParamClause] | ‘_’)
330331 TypeBounds
331332
332- ClsParamClauses ::= {ClsParamClause} [[nl] ‘(’ [‘implicit’] ClsParams ‘)’]
333- ClsParamClause ::= [nl] ‘(’ ClsParams ‘)’
334- | [nl] ‘(’ ‘using’ (ClsParams | FunArgTypes) ‘)’
333+ ClsParamClauses ::= {ClsParamClause} [[nl] ‘(’ [‘implicit’] ClsParams <,> ‘)’]
334+ ClsParamClause ::= [nl] ‘(’ ClsParams <,> ‘)’
335+ | [nl] ‘(’ ‘using’ (ClsParams | FunArgTypes) <,> ‘)’
335336ClsParams ::= ClsParam {‘,’ ClsParam}
336337ClsParam ::= {Annotation} ValDef(mods, id, tpe, expr) -- point of mods on val/var
337338 [{Modifier} (‘val’ | ‘var’) | ‘inline’] Param
338339Param ::= id ‘:’ ParamType [‘=’ Expr]
339340
340- DefParamClauses ::= {DefParamClause} [[nl] ‘(’ [‘implicit’] DefParams ‘)’]
341- DefParamClause ::= [nl] ‘(’ DefParams ‘)’ | UsingParamClause
342- UsingParamClause ::= [nl] ‘(’ ‘using’ (DefParams | FunArgTypes) ‘)’
341+ DefParamClauses ::= {DefParamClause} [[nl] ‘(’ [‘implicit’] DefParams <,> ‘)’]
342+ DefParamClause ::= [nl] ‘(’ DefParams <,> ‘)’ | UsingParamClause
343+ UsingParamClause ::= [nl] ‘(’ ‘using’ (DefParams | FunArgTypes) <,> ‘)’
343344DefParams ::= DefParam {‘,’ DefParam}
344345DefParam ::= {Annotation} [‘inline’] Param ValDef(mods, id, tpe, expr) -- point of mods at id.
345346```
346347
347348### Bindings and Imports
348349``` ebnf
349- Bindings ::= ‘(’ [Binding {‘,’ Binding}] ‘)’
350+ Bindings ::= ‘(’ [Binding {‘,’ Binding} <,> ‘)’
350351Binding ::= (id | ‘_’) [‘:’ Type] ValDef(_, id, tpe, EmptyTree)
351352
352353Modifier ::= LocalModifier
@@ -371,7 +372,7 @@ ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
371372 | SimpleRef ‘as’ id Import(EmptyTree, ImportSelector(ref, id))
372373ImportSpec ::= NamedSelector
373374 | WildcardSelector
374- | ‘{’ ImportSelectors) ‘}’
375+ | ‘{’ ImportSelectors <,> ‘}’
375376NamedSelector ::= id [‘as’ (id | ‘_’)]
376377WildCardSelector ::= ‘*' | ‘given’ [InfixType]
377378ImportSelectors ::= NamedSelector [‘,’ ImportSelectors]
0 commit comments