It should probably be like that:
Template ::= Constr [TemplateBody]
TemplateBody ::= {`with' Constr} `{' [TemplateStat {`;' TemplateStat}] `}'
Otherwise the code below should be rejected.
trait T;
class C with T;
object O with T;
The syntax of classes and objects is defined like this:
TmplDef ::= ([case] class | trait) ClassDef
| [case] object ObjectDef
ClassDef ::= ClassSig {`,' ClassSig} [`:' SimpleType] ClassTemplate
ClassSig ::= id [TypeParamClause] [ClassParamClause]
ObjectDef ::= id {`,' id} [`:' SimpleType] ClassTemplate
ClassTemplate ::= extends Template
| TemplateBody
|
|