Skip to content

Commit a60c4e7

Browse files
committed
Highlight all EBNF snippets. Add missing semicolons.
1 parent 0443992 commit a60c4e7

23 files changed

+128
-128
lines changed

docs/_docs/reference/changed-features/imports.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ are offered under settings `-source 3.1-migration -rewrite`.
4646

4747
### Syntax
4848

49-
```
50-
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
51-
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
49+
```ebnf
50+
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr} ;
51+
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ;
5252
ImportSpec ::= NamedSelector
5353
| WildcardSelector
54-
| ‘{’ ImportSelectors) ‘}’
55-
NamedSelector ::= id [‘as’ (id | ‘_’)]
56-
WildCardSelector ::= ‘*' | ‘given’ [InfixType]
54+
| ‘{’ ImportSelectors) ‘}’ ;
55+
NamedSelector ::= id [‘as’ (id | ‘_’)] ;
56+
WildCardSelector ::= ‘*' | ‘given’ [InfixType] ;
5757
ImportSelectors ::= NamedSelector [‘,’ ImportSelectors]
58-
| WildCardSelector {‘,’ WildCardSelector}
58+
| WildCardSelector {‘,’ WildCardSelector} ;
5959
```

docs/_docs/reference/changed-features/match-syntax.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ The syntactical precedence of match expressions has been changed.
4747

4848
The new syntax of match expressions is as follows.
4949

50-
```
50+
```ebnf
5151
InfixExpr ::= ...
52-
| InfixExpr MatchClause
52+
| InfixExpr MatchClause ;
5353
SimpleExpr ::= ...
54-
| SimpleExpr ‘.’ MatchClause
55-
MatchClause ::= ‘match’ ‘{’ CaseClauses ‘}’
54+
| SimpleExpr ‘.’ MatchClause ;
55+
MatchClause ::=match’ ‘{’ CaseClauses ‘}’ ;
5656
```

docs/_docs/reference/changed-features/pattern-bindings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ for case (x, y) <- elems yield (y, x) // returns List((2, 1), (4, 3))
5050
## Syntax Changes
5151

5252
Generators in for expressions may be prefixed with `case`.
53-
```
54-
Generator ::= [‘case’] Pattern1 ‘<-’ Expr
53+
```ebnf
54+
Generator ::= [‘case’] Pattern1 ‘<-’ Expr ;
5555
```
5656

5757
## Migration

docs/_docs/reference/changed-features/structural-types-spec.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/structura
66

77
## Syntax
88

9-
```
10-
SimpleType ::= ... | Refinement
11-
Refinement ::= ‘{’ RefineStatSeq ‘}’
12-
RefineStatSeq ::= RefineStat {semi RefineStat}
13-
RefineStat ::= ‘val’ VarDcl | ‘def’ DefDcl | ‘type’ {nl} TypeDcl
9+
```ebnf
10+
SimpleType ::= ... | Refinement ;
11+
Refinement ::= ‘{’ RefineStatSeq ‘}’ ;
12+
RefineStatSeq ::= RefineStat {semi RefineStat} ;
13+
RefineStat ::= ‘val’ VarDcl | ‘def’ DefDcl | ‘type’ {nl} TypeDcl ;
1414
```
1515

1616
## Implementation of Structural Types

docs/_docs/reference/changed-features/vararg-splices.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ The old syntax for splice arguments will be phased out.
2424

2525
## Syntax
2626

27-
```
27+
```ebnf
2828
ArgumentPatterns ::= ‘(’ [Patterns] ‘)’
29-
| ‘(’ [Patterns ‘,’] Pattern2 ‘*’ ‘)’
29+
| ‘(’ [Patterns ‘,’] Pattern2 ‘*’ ‘)’ ;
3030
3131
ParArgumentExprs ::= ‘(’ [‘using’] ExprsInParens ‘)’
32-
| ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘*’ ‘)’
32+
| ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘*’ ‘)’ ;
3333
```
3434

3535
## Compatibility considerations

docs/_docs/reference/contextual/context-bounds.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ done automatically under `-rewrite`.
4040

4141
## Syntax
4242

43-
```
44-
TypeParamBounds ::= [SubtypeBounds] {ContextBound}
45-
ContextBound ::= ‘:’ Type
43+
```ebnf
44+
TypeParamBounds ::= [SubtypeBounds] {ContextBound} ;
45+
ContextBound ::= ‘:’ Type ;
4646
```

docs/_docs/reference/contextual/context-functions-spec.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ movedTo: https://docs.scala-lang.org/scala3/reference/contextual/context-functio
66

77
## Syntax
88

9-
```
9+
```ebnf
1010
Type ::= ...
11-
| FunArgTypes ‘?=>’ Type
11+
| FunArgTypes ‘?=>’ Type ;
1212
Expr ::= ...
13-
| FunParams ‘?=>’ Expr
13+
| FunParams ‘?=>’ Expr ;
1414
```
1515

1616
Context function types associate to the right, e.g.

docs/_docs/reference/contextual/derivation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,12 @@ hand side of this definition in the same way as an instance defined in ADT compa
354354

355355
### Syntax
356356

357-
```
358-
Template ::= InheritClauses [TemplateBody]
359-
EnumDef ::= id ClassConstr InheritClauses EnumBody
360-
InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}]
357+
```ebnf
358+
Template ::= InheritClauses [TemplateBody] ;
359+
EnumDef ::= id ClassConstr InheritClauses EnumBody ;
360+
InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}] ;
361361
ConstrApps ::= ConstrApp {‘with’ ConstrApp}
362-
| ConstrApp {‘,’ ConstrApp}
362+
| ConstrApp {‘,’ ConstrApp} ;
363363
```
364364

365365
**Note:** To align `extends` clauses and `derives` clauses, Scala 3 also allows multiple

docs/_docs/reference/contextual/extension-methods.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,20 @@ def position(s: String)(ch: Char, n: Int): Int =
285285
Here are the syntax changes for extension methods and collective extensions relative
286286
to the [current syntax](../syntax.md).
287287

288-
```
289-
BlockStat ::= ... | Extension
290-
TemplateStat ::= ... | Extension
291-
TopStat ::= ... | Extension
288+
```ebnf
289+
BlockStat ::= ... | Extension ;
290+
TemplateStat ::= ... | Extension ;
291+
TopStat ::= ... | Extension ;
292292
Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause}
293-
‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods
294-
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
295-
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
293+
‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods ;
294+
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>> ;
295+
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef ;
296296
```
297297

298298
In the above the notation `<<< ts >>>` in the production rule `ExtMethods` is defined as follows :
299299

300-
```
301-
<<< ts >>> ::= ‘{’ ts ‘}’ | indent ts outdent
300+
```ebnf
301+
<<< ts >>> ::= ‘{’ ts ‘}’ | indent ts outdent ;
302302
```
303303

304304
`extension` is a soft keyword. It is recognized as a keyword only if it appears

docs/_docs/reference/contextual/given-imports.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ given instances once their user base has migrated.
103103

104104
### Syntax
105105

106-
```
107-
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
108-
Export ::= ‘export’ ImportExpr {‘,’ ImportExpr}
109-
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
106+
```ebnf
107+
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr} ;
108+
Export ::= ‘export’ ImportExpr {‘,’ ImportExpr} ;
109+
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ;
110110
ImportSpec ::= NamedSelector
111111
| WildcardSelector
112-
| ‘{’ ImportSelectors) ‘}’
113-
NamedSelector ::= id [‘as’ (id | ‘_’)]
114-
WildCardSelector ::= ‘*' | ‘given’ [InfixType]
112+
| ‘{’ ImportSelectors) ‘}’ ;
113+
NamedSelector ::= id [‘as’ (id | ‘_’)] ;
114+
WildCardSelector ::= ‘*' | ‘given’ [InfixType] ;
115115
ImportSelectors ::= NamedSelector [‘,’ ImportSelectors]
116-
| WildCardSelector {‘,’ WildCardSelector}
116+
| WildCardSelector {‘,’ WildCardSelector} ;
117117
```

0 commit comments

Comments
 (0)