Skip to content

Commit f37c213

Browse files
authored
fix: ensure syntax blocks for ebnf are marked as such (#16837)
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
2 parents 048435e + 35320eb commit f37c213

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

0 commit comments

Comments
 (0)