Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae44f1b

Browse files
committedSep 10, 2019
Formalize syntax changes
Also: Allow inline givens to be whitebox
1 parent 685cb79 commit ae44f1b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed
 

‎docs/docs/internals/syntax.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,9 @@ ClassConstr ::= [ClsTypeParamClause] [ConstrMods] ClsParamClauses
386386
ConstrMods ::= {Annotation} [AccessModifier]
387387
ObjectDef ::= id [Template] ModuleDef(mods, name, template) // no constructor
388388
EnumDef ::= id ClassConstr InheritClauses EnumBody EnumDef(mods, name, tparams, template)
389-
GivenDef ::= [id] [DefTypeParamClause] {GivenParamClause} GivenBody
390-
GivenBody ::= [‘as’ ConstrApp {‘,’ ConstrApp }] [TemplateBody]
391-
| ‘as’ Type ‘=’ Expr
392-
| ‘(’ DefParam ‘)’ TemplateBody
389+
GivenDef ::= [GivenSig (‘:’ | <:)] Type ‘=’ Expr
390+
| [GivenSig ‘:’] [ConstrApp {‘,’ ConstrApp }] [TemplateBody]
391+
GivenSig ::= [id] [DefTypeParamClause] {GivenParamClause}
393392
Template ::= InheritClauses [TemplateBody] Template(constr, parents, self, stats)
394393
InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}]
395394
ConstrApps ::= ConstrApp {‘with’ ConstrApp}

‎docs/docs/reference/contextual/delegates.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ Here is the new syntax of given instances, seen as a delta from the [standard co
7878
```
7979
TmplDef ::= ...
8080
| ‘given’ GivenDef
81-
GivenDef ::= GivenBody
82-
| [id] [DefTypeParamClause] {GivenParamClause}
83-
(‘:’ GivenBody | ‘<:’ Type ‘=’ Expr)
84-
GivenBody ::= [ConstrApp {‘,’ ConstrApp }] [TemplateBody]
85-
| Type ‘=’ Expr
81+
GivenDef ::= [GivenSig (‘:’ | <:)] Type ‘=’ Expr
82+
| [GivenSig ‘:’] [ConstrApp {‘,’ ConstrApp }] [TemplateBody]
83+
GivenSig ::= [id] [DefTypeParamClause] {GivenParamClause}
8684
GivenParamClause ::= ‘(’ ‘given’ (DefParams | GivenTypes) ‘)’
8785
GivenTypes ::= AnnotType {‘,’ AnnotType}
8886
```

0 commit comments

Comments
 (0)
Please sign in to comment.