Skip to content

Commit d12479a

Browse files
committed
More cosmetiques
1 parent 0445ad6 commit d12479a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

docs/docs/internals/syntax.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ nl ::= “new line character”
8686
semi ::= ‘;’ | nl {nl}
8787
```
8888

89+
8990
## Context-free Syntax
9091

9192
The context-free syntax of Scala is given by the following EBNF
@@ -202,12 +203,9 @@ BlockStat ::= Import
202203
| {Annotation} [‘implicit’ | ‘lazy’] Def
203204
| {Annotation} {LocalModifier} TmplDef
204205
| Expr1
205-
|
206206
207-
ForExpr ::= ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’)
208-
{nl} [‘yield’] Expr
207+
ForExpr ::= ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’) {nl} [‘yield’] Expr
209208
| ‘for’ Enumerators (‘do’ Expr | ‘yield’ Expr)
210-
211209
Enumerators ::= Generator {semi Enumerator | Guard}
212210
Enumerator ::= Generator
213211
| Guard
@@ -217,7 +215,6 @@ Guard ::= ‘if’ PostfixExpr
217215
218216
CaseClauses ::= CaseClause { CaseClause }
219217
CaseClause ::= ‘case’ (Pattern [Guard] ‘=>’ Block | INT)
220-
221218
Pattern ::= Pattern1 { ‘|’ Pattern1 }
222219
Pattern1 ::= PatVar ‘:’ RefinedType
223220
| Pattern2
@@ -330,27 +327,24 @@ DefDef ::= DefSig [‘:’ Type] ‘=’ Expr
330327
331328
TmplDef ::= ([‘case’] ‘class’ | ‘trait’) ClassDef
332329
| [‘case’] ‘object’ ObjectDef
333-
ClassDef ::= id [ClsTypeParamClause]
334-
[ConstrMods] ClsParamClauses TemplateOpt
330+
ClassDef ::= id [ClsTypeParamClause] [ConstrMods] ClsParamClauses TemplateOpt
335331
ConstrMods ::= AccessModifier
336332
| Annotation {Annotation} (AccessModifier | ‘this’)
337333
ObjectDef ::= id TemplateOpt
338334
TemplateOpt ::= [‘extends’ Template | [nl] TemplateBody]
339335
Template ::= ConstrApps [TemplateBody] | TemplateBody
340336
ConstrApps ::= ConstrApp {‘with’ ConstrApp}
341337
ConstrApp ::= AnnotType {ArgumentExprs}
342-
343338
ConstrExpr ::= SelfInvocation
344339
| ConstrBlock
345-
ConstrBlock ::= ‘{’ SelfInvocation {semi BlockStat} ‘}’
346340
SelfInvocation ::= ‘this’ ArgumentExprs {ArgumentExprs}
341+
ConstrBlock ::= ‘{’ SelfInvocation {semi BlockStat} ‘}’
347342
348343
TopStatSeq ::= TopStat {semi TopStat}
349344
TopStat ::= {Annotation [nl]} {Modifier} TmplDef
350345
| Import
351346
| Packaging
352347
| PackageObject
353-
|
354348
Packaging ::= ‘package’ QualId [nl] ‘{’ TopStatSeq ‘}’
355349
PackageObject ::= ‘package’ ‘object’ ObjectDef
356350

0 commit comments

Comments
 (0)