Skip to content

Commit a9b0b7d

Browse files
committed
Officialize syntax
- cleanup rules - drop sidebar with tree node info - put in reference directory and link with sidebar
1 parent a09ea56 commit a9b0b7d

File tree

2 files changed

+432
-12
lines changed

2 files changed

+432
-12
lines changed

docs/docs/internals/syntax.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ FunArgType ::= Type
174174
| ‘=>’ Type PrefixOp(=>, t)
175175
ParamType ::= [‘=>’] ParamValueType
176176
ParamValueType ::= Type [‘*’] PostfixOp(t, "*")
177-
TypeArgs ::= ‘[’ Types ‘]’ ts
177+
TypeArgs ::= ‘[’ Types ‘]’ ts
178178
Refinement ::= ‘{’ [RefineDcl] {semi [RefineDcl]} ‘}’ ds
179179
TypeBounds ::= [‘>:’ Type] [‘<:’ Type] TypeBoundsTree(lo, hi)
180180
TypeParamBounds ::= TypeBounds {‘:’ Type} ContextBounds(typeBounds, tps)
@@ -219,7 +219,7 @@ SimpleExpr ::= SimpleRef
219219
| BlockExpr
220220
| ‘$’ ‘{’ Block ‘}’
221221
| Quoted
222-
| quoteId // only inside splices
222+
| quoteId -- only inside splices
223223
| ‘new’ ConstrApp {‘with’ ConstrApp} New(constr | templ)
224224
[[colonEol] TemplateBody
225225
| ‘new’ [colonEol] TemplateBody
@@ -228,8 +228,8 @@ SimpleExpr ::= SimpleRef
228228
| SimpleExpr ‘.’ MatchClause
229229
| SimpleExpr TypeArgs TypeApply(expr, args)
230230
| SimpleExpr ArgumentExprs Apply(expr, args)
231-
| SimpleExpr ‘_’ PostfixOp(expr, _)
232-
| XmlExpr
231+
| SimpleExpr ‘_’ PostfixOp(expr, _) (to be dropped)
232+
| XmlExpr (to be dropped)
233233
Quoted ::= ‘'’ ‘{’ Block ‘}’
234234
| ‘'’ ‘[’ Type ‘]’
235235
ExprsInParens ::= ExprInParens {‘,’ ExprInParens}
@@ -272,7 +272,7 @@ SimplePattern ::= PatVar
272272
| Literal Bind(name, Ident(wildcard))
273273
| ‘(’ [Patterns] ‘)’ Parens(pats) Tuple(pats)
274274
| Quoted
275-
| XmlPattern
275+
| XmlPattern (to be dropped)
276276
| SimplePattern1 [TypeArgs] [ArgumentPatterns]
277277
| ‘given’ RefinedType
278278
SimplePattern1 ::= SimpleRef
@@ -307,14 +307,12 @@ ClsParams ::= ClsParam {‘,’ ClsParam}
307307
ClsParam ::= {Annotation} ValDef(mods, id, tpe, expr) -- point of mods on val/var
308308
[{Modifier} (‘val’ | ‘var’) | ‘inline’] Param
309309
Param ::= id ‘:’ ParamType [‘=’ Expr]
310-
| INT
311310
312311
DefParamClauses ::= {DefParamClause} [[nl] ‘(’ [‘implicit’] DefParams ‘)’]
313312
DefParamClause ::= [nl] ‘(’ DefParams ‘)’ | UsingParamClause
314313
UsingParamClause ::= [nl] ‘(’ ‘using’ (DefParams | Types) ‘)’
315314
DefParams ::= DefParam {‘,’ DefParam}
316315
DefParam ::= {Annotation} [‘inline’] Param ValDef(mods, id, tpe, expr) -- point of mods at id.
317-
ClosureMods ::= { ‘implicit’ | ‘given’}
318316
```
319317

320318
### Bindings and Imports
@@ -336,7 +334,7 @@ LocalModifier ::= ‘abstract’
336334
AccessModifier ::= (‘private’ | ‘protected’) [AccessQualifier]
337335
AccessQualifier ::= ‘[’ id ‘]’
338336
339-
Annotation ::= ‘@’ SimpleType1 {ParArgumentExprs} Apply(tpe, args)
337+
Annotation ::= ‘@’ SimpleType1 {ParArgumentExprs} Apply(tpe, args)
340338
341339
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
342340
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec Import(expr, sels)
@@ -348,7 +346,7 @@ ImportSelectors ::= id [‘=>’ id | ‘=>’ ‘_’] [‘,’ ImportSelect
348346
| WildCardSelector {‘,’ WildCardSelector}
349347
WildCardSelector ::= ‘given’ [InfixType]
350348
| ‘_'
351-
Export ::= [‘given’] ImportExpr {‘,’ ImportExpr}
349+
Export ::= ‘export’ ImportExpr {‘,’ ImportExpr}
352350
353351
EndMarker ::= ‘end’ EndMarkerTag -- when followed by EOL
354352
EndMarkerTag ::= id | ‘if’ | ‘while’ | ‘for’ | ‘match’ | ‘try’
@@ -367,7 +365,6 @@ ValDcl ::= ids ‘:’ Type
367365
VarDcl ::= ids ‘:’ Type PatDef(_, ids, tpe, EmptyTree)
368366
DefDcl ::= DefSig ‘:’ Type DefDef(_, name, tparams, vparamss, tpe, EmptyTree)
369367
DefSig ::= id [DefTypeParamClause] DefParamClauses
370-
| ExtParamClause {nl} [‘.’] id DefParamClauses
371368
TypeDcl ::= id [TypeParamClause] {FunParamClause} TypeBounds TypeDefTree(_, name, tparams, bound
372369
[‘=’ Type]
373370
@@ -376,7 +373,6 @@ Def ::= ‘val’ PatDef
376373
| ‘def’ DefDef
377374
| ‘type’ {nl} TypeDcl
378375
| TmplDef
379-
| INT
380376
PatDef ::= ids [‘:’ Type] ‘=’ Expr
381377
| Pattern2 [‘:’ Type | Ascription] ‘=’ Expr PatDef(_, pats, tpe?, expr)
382378
VarDef ::= PatDef
@@ -402,7 +398,7 @@ ExtMethods ::= ExtMethod | [nl] ‘{’ ExtMethod {semi ExtMethod ‘}
402398
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
403399
Template ::= InheritClauses [colonEol] [TemplateBody] Template(constr, parents, self, stats)
404400
InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}]
405-
ConstrApps ::= ConstrApp {(‘,’ | ‘with’) ConstrApp}
401+
ConstrApps ::= ConstrApp ({‘,’ ConstrApp} | {‘with’ ConstrApp})
406402
ConstrApp ::= SimpleType1 {Annotation} {ParArgumentExprs} Apply(tp, args)
407403
ConstrExpr ::= SelfInvocation
408404
| ‘{’ SelfInvocation {semi BlockStat} ‘}’

0 commit comments

Comments
 (0)