Skip to content

Commit 73678d4

Browse files
dsbosadriaanm
authored andcommitted
Add language to code blocks in spec (scala#5502)
* Add "scala" language code to pure-Scala code blocks. * Add "java" language code to Java code block. * Add "scala" language code to almost-pure-Scala code blocks. Add "scala" language code to two code blocks whose content was Scala except for containing ellipses (\ldots). * Add "scala" language code to non-literal-Scala code blocks. Add "scala" language code to code blocks that contain Scala but also special elements, such as identifiers that are italicized or have prime marks (e.g., e′, e′′), ellipses (\ldots), etc.
1 parent 6b44da1 commit 73678d4

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

spec/03-types.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ corresponding function type.
587587

588588
The declarations
589589

590-
```
590+
```scala
591591
def a: Int
592592
def b (x: Int): Boolean
593593
def c (x: Int) (y: String, z: String): String
@@ -642,7 +642,7 @@ the corresponding type parameter clause.
642642

643643
Consider this fragment of the `Iterable[+X]` class:
644644

645-
```
645+
```scala
646646
trait Iterable[+X] {
647647
def flatMap[newType[+X] <: Iterable[X], S](f: X => newType[S]): newType[S]
648648
}
@@ -660,7 +660,7 @@ same name, we model
660660
An overloaded type consisting of type alternatives $T_1 \commadots T_n (n \geq 2)$ is denoted internally $T_1 \overload \ldots \overload T_n$.
661661
662662
###### Example
663-
```
663+
```scala
664664
def println: Unit
665665
def println(s: String): Unit = $\ldots$
666666
def println(x: Float): Unit = $\ldots$
@@ -678,7 +678,7 @@ println: => Unit $\overload$
678678
```
679679
680680
###### Example
681-
```
681+
```scala
682682
def f(x: T): T = $\ldots$
683683
val f = 0
684684
```
@@ -979,7 +979,7 @@ after applying [eta-expansion](06-expressions.html#eta-expansion). If $T$ is a m
979979

980980
Given the definitions
981981

982-
```
982+
```scala
983983
def foo(x: Int => String): Unit
984984
def foo(x: ToString): Unit
985985

spec/04-basic-declarations-and-definitions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The class definition `case class X(), Y(n: Int) extends Z` expands to
8888
`case class X extends Z; case class Y(n: Int) extends Z`.
8989
- The object definition `case object Red, Green, Blue extends Color`~
9090
expands to
91-
```
91+
```scala
9292
case object Red extends Color
9393
case object Green extends Color
9494
case object Blue extends Color .

spec/05-classes-and-objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ Here,
725725

726726
- $t$ is a [template](#templates) of the form
727727

728-
```
728+
```scala
729729
$sc$ with $mt_1$ with $\ldots$ with $mt_m$ { $\mathit{stats}$ } // $m \geq 0$
730730
```
731731

spec/06-expressions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -945,29 +945,29 @@ comprehensions have been eliminated.
945945
`$e$.foreach { case $p$ => $e'$ }`.
946946
- A for comprehension
947947

948-
```
948+
```scala
949949
for ($p$ <- $e$; $p'$ <- $e'; \ldots$) yield $e''$
950950
```
951951

952952
where `$\ldots$` is a (possibly empty)
953953
sequence of generators, definitions, or guards,
954954
is translated to
955955

956-
```
956+
```scala
957957
$e$.flatMap { case $p$ => for ($p'$ <- $e'; \ldots$) yield $e''$ }
958958
```
959959

960960
- A for loop
961961

962-
```
962+
```scala
963963
for ($p$ <- $e$; $p'$ <- $e'; \ldots$) $e''$
964964
```
965965

966966
where `$\ldots$` is a (possibly empty)
967967
sequence of generators, definitions, or guards,
968968
is translated to
969969

970-
```
970+
```scala
971971
$e$.foreach { case $p$ => for ($p'$ <- $e'; \ldots$) $e''$ }
972972
```
973973

@@ -980,7 +980,7 @@ comprehensions have been eliminated.
980980
`$p'$ = $e'$` is translated to the following generator of pairs of values, where
981981
$x$ and $x'$ are fresh names:
982982

983-
```
983+
```scala
984984
($p$, $p'$) <- for ($x @ p$ <- $e$) yield { val $x' @ p'$ = $e'$; ($x$, $x'$) }
985985
```
986986

spec/11-annotations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Java platform, the following annotations have a standard meaning.
5656
This is equivalent to a the following field
5757
definition in Java:
5858

59-
```
59+
```java
6060
private final static SerialVersionUID = <longlit>
6161
```
6262

@@ -103,7 +103,7 @@ Java platform, the following annotations have a standard meaning.
103103
matches which would otherwise be emitted. For instance, no warnings
104104
would be produced for the method definition below.
105105

106-
```
106+
```scala
107107
def f(x: Option[Int]) = (x: @unchecked) match {
108108
case Some(y) => y
109109
}
@@ -117,7 +117,7 @@ Java platform, the following annotations have a standard meaning.
117117
value to appear in a path, even if its type is [volatile](03-types.html#volatile-types).
118118
For instance, the following member definitions are legal:
119119

120-
```
120+
```scala
121121
type A { type T }
122122
type B
123123
@uncheckedStable val x: A with B // volatile type
@@ -140,7 +140,7 @@ Java platform, the following annotations have a standard meaning.
140140
For instance, the following code would generate specialized traits for
141141
`Unit`, `Int` and `Double`
142142

143-
```
143+
```scala
144144
trait Function0[@specialized(Unit, Int, Double) T] {
145145
def apply: T
146146
}

spec/12-the-scala-standard-library.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ The available high-priority implicits include definitions falling into the follo
777777
* An implicit wrapper that adds `ensuring` methods
778778
with the following overloaded variants to type `Any`.
779779

780-
```
780+
```scala
781781
def ensuring(cond: Boolean): A = { assert(cond); x }
782782
def ensuring(cond: Boolean, msg: Any): A = { assert(cond, msg); x }
783783
def ensuring(cond: A => Boolean): A = { assert(cond(x)); x }
@@ -787,7 +787,7 @@ The available high-priority implicits include definitions falling into the follo
787787
* An implicit wrapper that adds a `->` method with the following implementation
788788
to type `Any`.
789789

790-
```
790+
```scala
791791
def -> [B](y: B): (A, B) = (x, y)
792792
```
793793

@@ -801,7 +801,7 @@ The available high-priority implicits include definitions falling into the follo
801801
* An implicit wrapper that adds `+` and `formatted` method with the following
802802
implementations to type `Any`.
803803

804-
```
804+
```scala
805805
def +(other: String) = String.valueOf(self) + other
806806
def formatted(fmtstr: String): String = fmtstr format self
807807
```
@@ -835,7 +835,7 @@ The available high-priority implicits include definitions falling into the follo
835835
* An implicit definition that generates instances of type `T <:< T`, for
836836
any type `T`. Here, `<:<` is a class defined as follows.
837837

838-
```
838+
```scala
839839
sealed abstract class <:<[-From, +To] extends (From => To)
840840
```
841841

0 commit comments

Comments
 (0)