Skip to content

Commit 8cfeaf7

Browse files
committed
Update other syntax.md to match the first one
1 parent 21adde1 commit 8cfeaf7

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs/docs/reference/syntax.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,6 @@ ArgumentPatterns ::= ‘(’ [Patterns] ‘)’
310310
ClsTypeParamClause::= ‘[’ ClsTypeParam {‘,’ ClsTypeParam} ‘]’
311311
ClsTypeParam ::= {Annotation} [‘+’ | ‘-’] id [HkTypeParamClause] TypeParamBounds
312312
313-
DefTypeParamClause::= ‘[’ DefTypeParam {‘,’ DefTypeParam} ‘]’
314-
DefTypeParam ::= {Annotation} id [HkTypeParamClause] TypeParamBounds
315-
316313
TypTypeParamClause::= ‘[’ TypTypeParam {‘,’ TypTypeParam} ‘]’
317314
TypTypeParam ::= {Annotation} id [HkTypeParamClause] TypeBounds
318315
@@ -324,13 +321,24 @@ ClsParamClause ::= [nl] ‘(’ ClsParams ‘)’
324321
| [nl] ‘(’ ‘using’ (ClsParams | FunArgTypes) ‘)’
325322
ClsParams ::= ClsParam {‘,’ ClsParam}
326323
ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’) | ‘inline’] Param
327-
Param ::= id ‘:’ ParamType [‘=’ Expr]
328324
329-
DefParamClauses ::= {DefParamClause} [[nl] ‘(’ [‘implicit’] DefParams ‘)’]
330-
DefParamClause ::= [nl] ‘(’ DefParams ‘)’ | UsingParamClause
331-
UsingParamClause ::= [nl] ‘(’ ‘using’ (DefParams | FunArgTypes) ‘)’
332-
DefParams ::= DefParam {‘,’ DefParam}
333-
DefParam ::= {Annotation} [‘inline’] Param
325+
DefParamClauses ::= DefParamClause { DefParamClause }
326+
DefParamClause ::= DefTypeParamClause
327+
| DefTermParamClause
328+
| UsingParamClause
329+
TypelessClauses ::= TypelessClause {TypelessClause}
330+
TypelessClause ::= DefTermParamClause
331+
| UsingParamClause
332+
333+
DefTypeParamClause::= [nl] ‘[’ DefTypeParam {‘,’ DefTypeParam} ‘]’
334+
DefTypeParam ::= {Annotation} id [HkTypeParamClause] TypeParamBounds
335+
DefTermParamClause::= [nl] ‘(’ [DefTermParams] ‘)’
336+
UsingParamClause ::= [nl] ‘(’ ‘using’ (DefTermParams | FunArgTypes) ‘)’
337+
DefImplicitClause ::= [nl] ‘(’ ‘implicit’ DefTermParams ‘)’
338+
339+
DefTermParams ::= DefTermParam {‘,’ DefTermParam}
340+
DefTermParam ::= {Annotation} [‘inline’] Param
341+
Param ::= id ‘:’ ParamType [‘=’ Expr]
334342
```
335343

336344
### Bindings and Imports
@@ -381,8 +389,8 @@ Dcl ::= RefineDcl
381389
ValDcl ::= ids ‘:’ Type
382390
VarDcl ::= ids ‘:’ Type
383391
DefDcl ::= DefSig ‘:’ Type
384-
DefSig ::= id [DefTypeParamClause] DefParamClauses
385-
TypeDcl ::= id [TypeParamClause] {FunParamClause} TypeBounds [‘=’ Type]
392+
DefSig ::= id [DefParamClauses] [DefImplicitClause]
393+
TypeDcl ::= id [TypeParamClause] {FunParamClause} TypeBounds
386394
387395
Def ::= ‘val’ PatDef
388396
| ‘var’ PatDef
@@ -392,7 +400,7 @@ Def ::= ‘val’ PatDef
392400
PatDef ::= ids [‘:’ Type] ‘=’ Expr
393401
| Pattern2 [‘:’ Type] ‘=’ Expr
394402
DefDef ::= DefSig [‘:’ Type] ‘=’ Expr
395-
| ‘this’ DefParamClause DefParamClauses ‘=’ ConstrExpr
403+
| ‘this’ TypelessClauses [DefImplicitClause] ‘=’ ConstrExpr
396404
397405
TmplDef ::= ([‘case’] ‘class’ | ‘trait’) ClassDef
398406
| [‘case’] ‘object’ ObjectDef
@@ -404,10 +412,10 @@ ConstrMods ::= {Annotation} [AccessModifier]
404412
ObjectDef ::= id [Template]
405413
EnumDef ::= id ClassConstr InheritClauses EnumBody
406414
GivenDef ::= [GivenSig] (AnnotType [‘=’ Expr] | StructuralInstance)
407-
GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ -- one of `id`, `DefParamClause`, `UsingParamClause` must be present
415+
GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ -- one of `id`, `DefTypeParamClause`, `UsingParamClause` must be present
408416
StructuralInstance ::= ConstrApp {‘with’ ConstrApp} [‘with’ TemplateBody]
409417
Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause}
410-
‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods
418+
‘(’ DefTermParam ‘)’ {UsingParamClause} ExtMethods
411419
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
412420
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
413421
Template ::= InheritClauses [TemplateBody]

0 commit comments

Comments
 (0)