Skip to content

Commit 35320eb

Browse files
committed
fix: ensure syntax blocks for ebnf are marked as such
I see that this was done in the past in https://github.com/lampepfl/dotty/pull/14958/files, but then reverted in #14958. Like many commits, there really isn't an explanation of the revert, but from reading between the lines I assume the `;` was the actual issue, not the syntax highlighting. As it was pointed out, syntax.js doesn't actually support `ebnf`. They do say they support `bnf`, but that didn't really work when I was testing. Either way, this pr makes sure that we _do_ mark the snippets as `ebnf`. The reason for this isn't necessarily so that we _get_ syntax highlighting for these, but so that syntax.js doesn't infer the wrong type of syntax and provide odd highlighting like we currently have. This also helps to ensure screen readers know what type of codeblock this is. fixes #14697
1 parent a356581 commit 35320eb

22 files changed

+30
-30
lines changed

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

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

4747
## Syntax
4848

49-
```
49+
```ebnf
5050
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
5151
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
5252
| SimpleRef `as` id

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ 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 ::= ...
5252
| InfixExpr MatchClause
5353
SimpleExpr ::= ...

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ 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-
```
53+
```ebnf
5454
Generator ::= [‘case’] Pattern1 ‘<-’ Expr
5555
```
5656

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nightlyOf: https://docs.scala-lang.org/scala3/reference/changed-features/structu
66

77
## Syntax
88

9-
```
9+
```ebnf
1010
SimpleType ::= ... | Refinement
1111
Refinement ::= ‘{’ RefineStatSeq ‘}’
1212
RefineStatSeq ::= RefineStat {semi RefineStat}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The old syntax for splice arguments will be phased out.
2424

2525
## Syntax
2626

27-
```
27+
```ebnf
2828
ArgumentPatterns ::= ‘(’ [Patterns] ‘)’
2929
| ‘(’ [Patterns ‘,’] Pattern2 ‘*’ ‘)’
3030

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ done automatically under `-rewrite`.
4747

4848
## Syntax
4949

50-
```
50+
```ebnf
5151
TypeParamBounds ::= [SubtypeBounds] {ContextBound}
5252
ContextBound ::= ‘:’ Type
5353
```

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nightlyOf: https://docs.scala-lang.org/scala3/reference/contextual/context-funct
66

77
## Syntax
88

9-
```
9+
```ebnf
1010
Type ::= ...
1111
| FunArgTypes ‘?=>’ Type
1212
Expr ::= ...

docs/_docs/reference/contextual/derivation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ method please read more at [How to write a type class `derived` method using mac
486486

487487
## Syntax
488488

489-
```
489+
```ebnf
490490
Template ::= InheritClauses [TemplateBody]
491491
EnumDef ::= id ClassConstr InheritClauses EnumBody
492492
InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ 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-
```
288+
```ebnf
289289
BlockStat ::= ... | Extension
290290
TemplateStat ::= ... | Extension
291291
TopStat ::= ... | Extension

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ given instances once their user base has migrated.
103103

104104
## Syntax
105105

106-
```
106+
```ebnf
107107
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
108108
Export ::= ‘export’ ImportExpr {‘,’ ImportExpr}
109109
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec

docs/_docs/reference/contextual/givens.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ that serve for synthesizing arguments to [context parameters](./using-clauses.md
1010
```scala
1111
trait Ord[T]:
1212
def compare(x: T, y: T): Int
13-
extension (x: T)
13+
extension (x: T)
1414
def < (y: T) = compare(x, y) < 0
1515
def > (y: T) = compare(x, y) > 0
1616

@@ -174,7 +174,7 @@ is created for each reference.
174174

175175
Here is the syntax for given instances:
176176

177-
```
177+
```ebnf
178178
TmplDef ::= ...
179179
| ‘given’ GivenDef
180180
GivenDef ::= [GivenSig] StructuralInstance

docs/_docs/reference/contextual/using-clauses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def summon[T](using x: T): x.type = x
151151

152152
Here is the new syntax of parameters and arguments seen as a delta from the [standard context free syntax of Scala 3](../syntax.md). `using` is a soft keyword, recognized only at the start of a parameter or argument list. It can be used as a normal identifier everywhere else.
153153

154-
```
154+
```ebnf
155155
ClsParamClause ::= ... | UsingClsParamClause
156156
DefParamClause ::= ... | UsingParamClause
157157
UsingClsParamClause ::= ‘(’ ‘using’ (ClsParams | Types) ‘)’

docs/_docs/reference/enums/adts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The changes are specified below as deltas with respect to the Scala syntax given
154154

155155
1. Enum definitions are defined as follows:
156156

157-
```
157+
```ebnf
158158
TmplDef ::= `enum' EnumDef
159159
EnumDef ::= id ClassConstr [`extends' [ConstrApps]] EnumBody
160160
EnumBody ::= [nl] ‘{’ [SelfType] EnumStat {semi EnumStat} ‘}’
@@ -164,7 +164,7 @@ The changes are specified below as deltas with respect to the Scala syntax given
164164
165165
2. Cases of enums are defined as follows:
166166
167-
```
167+
```ebnf
168168
EnumCase ::= `case' (id ClassConstr [`extends' ConstrApps]] | ids)
169169
```
170170

docs/_docs/reference/experimental/named-typeargs-spec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In this section we give more details about the [named type arguments](named-type
1010

1111
The addition to the grammar is:
1212

13-
```
13+
```ebnf
1414
SimpleExpr1 ::= ...
1515
| SimpleExpr (TypeArgs | NamedTypeArgs)
1616
NamedTypeArgs ::= ‘[’ NamedTypeArg {‘,’ NamedTypeArg} ‘]’
@@ -19,7 +19,7 @@ NamedTypeArg ::= id ‘=’ Type
1919

2020
Note in particular that named arguments cannot be passed to type constructors:
2121

22-
``` scala
22+
```scala
2323
class C[T]
2424

2525
val x: C[T = Int] = // error

docs/_docs/reference/metaprogramming/macros-spec.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extends simply-typed lambda calculus with quotes and splices.
5757
### Syntax
5858

5959
The syntax of terms, values, and types is given as follows:
60-
```
60+
```ebnf
6161
Terms t ::= x variable
6262
(x: T) => t lambda
6363
t t application
@@ -77,7 +77,7 @@ Typing rules are formulated using a stack of environments
7777
`Es`. Individual environments `E` consist as usual of variable
7878
bindings `x: T`. Environments can be combined using the two
7979
combinators `'` and `$`.
80-
```
80+
```ebnf
8181
Environment E ::= () empty
8282
E, x: T
8383
@@ -108,7 +108,7 @@ rule says that splice and quotes cancel each other out. The third rule
108108
is a context rule; it says that reduction is allowed in the hole `[ ]`
109109
position of an evaluation context. Evaluation contexts `e` and
110110
splice evaluation context `e_s` are defined syntactically as follows:
111-
```
111+
```ebnf
112112
Eval context e ::= [ ] | e t | v e | 'e_s[${e}]
113113
Splice context e_s ::= [ ] | (x: T) => e_s | e_s t | u e_s
114114
```

docs/_docs/reference/metaprogramming/simple-smp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ replace evaluation contexts with contextual typing rules. While this
2323
is more verbose, it makes it easier to set up the meta theory.
2424

2525
## Syntax
26-
```
26+
```ebnf
2727
Terms t ::= x variable
2828
(x: T) => t lambda
2929
t t application

docs/_docs/reference/new-types/dependent-function-types-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Initial implementation in [PR #3464](https://github.com/lampepfl/dotty/pull/3464
88

99
## Syntax
1010

11-
```
11+
```ebnf
1212
FunArgTypes ::= InfixType
1313
| ‘(’ [ FunArgType {',' FunArgType } ] ‘)’
1414
| ‘(’ TypedFunParam {',' TypedFunParam } ‘)’

docs/_docs/reference/new-types/intersection-types-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ with the usual precedence and subject to usual resolving rules.
1212
Unless shadowed by another definition, it resolves to the type `scala.&`,
1313
which acts as a type alias to an internal representation of intersection types.
1414

15-
```
15+
```ebnf
1616
Type ::= ...| InfixType
1717
InfixType ::= RefinedType {id [nl] RefinedType}
1818
```

docs/_docs/reference/new-types/type-lambdas-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nightlyOf: https://docs.scala-lang.org/scala3/reference/new-types/type-lambdas-s
66

77
## Syntax
88

9-
```
9+
```ebnf
1010
Type ::= ... | TypeParamClause ‘=>>’ Type
1111
TypeParamClause ::= ‘[’ TypeParam {‘,’ TypeParam} ‘]’
1212
TypeParam ::= {Annotation} (id [HkTypeParamClause] | ‘_’) TypeBounds

docs/_docs/reference/other-new-features/export.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ extension (x: String)
176176

177177
## Syntax changes:
178178

179-
```
179+
```ebnf
180180
TemplateStat ::= ...
181181
| Export
182182
TopStat ::= ...

docs/_docs/reference/other-new-features/indentation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ The syntax changes allowing this are as follows:
174174

175175
Define for an arbitrary sequence of tokens or non-terminals `TS`:
176176

177-
```
177+
```ebnf
178178
:<<< TS >>> ::= ‘{’ TS ‘}’
179179
| <colon> <indent" TS <outdent>
180180
```
181181
Then the grammar changes as follows:
182-
```
182+
```ebnf
183183
TemplateBody ::= :<<< [SelfType] TemplateStat {semi TemplateStat} >>>
184184
EnumBody ::= :<<< [SelfType] EnumStat {semi EnumStat} >>>
185185
Refinement ::= :<<< [RefineDcl] {semi [RefineDcl]} >>>
@@ -229,7 +229,7 @@ xs.foldLeft(0): (x, y) =>
229229
230230
The grammar changes for optional braces around arguments are as follows.
231231
232-
```
232+
```ebnf
233233
SimpleExpr ::= ...
234234
| SimpleExpr ColonArgument
235235
InfixExpr ::= ...
@@ -430,7 +430,7 @@ If none of these criteria apply, it's often better to not use an end marker sinc
430430

431431
### Syntax
432432

433-
```
433+
```ebnf
434434
EndMarker ::= ‘end’ EndMarkerTag -- when followed by EOL
435435
EndMarkerTag ::= id |if|while|for|match|try
436436
|new|this|given| ‘extension’ |val

docs/_docs/reference/other-new-features/opaques-details.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/opaqu
66

77
## Syntax
88

9-
```
9+
```ebnf
1010
Modifier ::= ...
1111
| ‘opaque’
1212
```

0 commit comments

Comments
 (0)