@@ -11,13 +11,14 @@ Scala programs are written using the Unicode Basic Multilingual Plane
1111presently supported. This chapter defines the two modes of Scala's
1212lexical syntax, the Scala mode and the _ XML mode_ . If not
1313otherwise mentioned, the following descriptions of Scala tokens refer
14- to _ Scala mode_ , and literal characters ` ‘c’ ` refer to the ASCII fragment ` \u0000 ` – ` \u007F ` .
14+ to _ Scala mode_ , and literal characters ‘c’ refer to the ASCII fragment
15+ ` \u0000 ` – ` \u007F ` .
1516
1617In Scala mode, _ Unicode escapes_ are replaced by the corresponding
1718Unicode character with the given hexadecimal code.
1819
1920``` ebnf
20- UnicodeEscape ::= ‘\‘ ‘u‘ {‘u‘ } hexDigit hexDigit hexDigit hexDigit
21+ UnicodeEscape ::= ‘\’ ‘u’ {‘u’ } hexDigit hexDigit hexDigit hexDigit
2122hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ | … | ‘f’
2223```
2324
@@ -40,8 +41,8 @@ classes (Unicode general category given in parentheses):
40411 . Parentheses ` ‘(’ | ‘)’ | ‘[’ | ‘]’ | ‘{’ | ‘}’ ` .
41421 . Delimiter characters `` ‘`’ | ‘'’ | ‘"’ | ‘.’ | ‘;’ | ‘,’ `` .
42431 . Operator characters. These consist of all printable ASCII characters
43- ` \u0020 - \u007F ` which are in none of the sets above, mathematical symbols ( ` Sm ` )
44- and other symbols (` So ` ).
44+ ` \u0020 ` - ` \u007F ` which are in none of the sets above, mathematical
45+ symbols ( ` Sm ` ) and other symbols (` So ` ).
4546
4647## Identifiers
4748
@@ -58,7 +59,7 @@ idrest ::= {letter | digit} [‘_’ op]
5859
5960There are three ways to form an identifier. First, an identifier can
6061start with a letter which can be followed by an arbitrary sequence of
61- letters and digits. This may be followed by underscore ` ‘_’ `
62+ letters and digits. This may be followed by underscore ‘_ ’
6263characters and another string composed of either letters and digits or
6364of operator characters. Second, an identifier can start with an operator
6465character followed by an arbitrary sequence of operator characters.
@@ -79,8 +80,8 @@ decomposes into the three identifiers `big_bob`, `++=`, and
7980_ variable identifiers_ , which start with a lower case letter, and
8081_ constant identifiers_ , which do not.
8182
82- The ` ‘$’ ` character is reserved for compiler-synthesized identifiers.
83- User programs should not define identifiers which contain ` ‘$’ ` characters.
83+ The ‘ \$ ’ character is reserved for compiler-synthesized identifiers.
84+ User programs should not define identifiers which contain ‘ \$ ’ characters.
8485
8586The following names are reserved words instead of being members of the
8687syntactic class ` id ` of lexical identifiers.
@@ -97,11 +98,11 @@ var while with yield
9798_ : = => <- <: <% >: # @
9899```
99100
100- The Unicode operators ` \u21D2 $\Rightarrow$ ` and ` \u2190 $\leftarrow$ ` , which have the ASCII
101+ The Unicode operators ` \u21D2 ` ‘ $\Rightarrow$’ and ` \u2190 ` ‘ $\leftarrow$’ , which have the ASCII
101102equivalents ` => ` and ` <- ` , are also reserved.
102103
103104### Example
104-
105+ Here are examples of identifiers:
105106``` scala
106107 x Object maxIndex p2p empty_?
107108 + `yield` αρετη _y dot_product_*
@@ -217,7 +218,7 @@ if (x > 0)
217218 x = x - 1
218219
219220while (x > 0 )
220- x = x / 2
221+ x = x / 2
221222
222223for (x <- 1 to 10 )
223224 println(x)
@@ -338,9 +339,9 @@ octalDigit ::= ‘0’ | … | ‘7’
338339Integer literals are usually of type ` Int ` , or of type
339340` Long ` when followed by a ` L ` or
340341` l ` suffix. Values of type ` Int ` are all integer
341- numbers between $-2^{31}$ and $2^{31}-1$, inclusive. Values of
342- type ` Long ` are all integer numbers between $-2^{63}$ and
343- $2^{63}-1$, inclusive. A compile-time error occurs if an integer literal
342+ numbers between $-2\ ^ {31}$ and $2\ ^ {31}-1$, inclusive. Values of
343+ type ` Long ` are all integer numbers between $-2\ ^ {63}$ and
344+ $2\ ^ {63}-1$, inclusive. A compile-time error occurs if an integer literal
344345denotes a number outside these ranges.
345346
346347However, if the expected type [ _ pt_ ] ( 06-expressions.html#expression-typing ) of a literal
@@ -349,11 +350,11 @@ and the integer number fits in the numeric range defined by the type,
349350then the number is converted to type _ pt_ and the literal's type
350351is _ pt_ . The numeric ranges given by these types are:
351352
352- | | |
353- | ----------------| ------------------------|
354- | ` Byte ` | $-2^7$ to $2^7-1$ |
355- | ` Short ` | $-2^{15}$ to $2^{15}-1$|
356- | ` Char ` | $0$ to $2^{16}-1$ |
353+ | | |
354+ | ----------------| -------------------------- |
355+ | ` Byte ` | $-2\ ^ 7$ to $2\ ^ 7-1$ |
356+ | ` Short ` | $-2\ ^ {15}$ to $2\ ^ {15}-1$|
357+ | ` Char ` | $0$ to $2\ ^ {16}-1$ |
357358
358359
359360### Example
@@ -576,7 +577,7 @@ comment.
576577
577578In order to allow literal inclusion of XML fragments, lexical analysis
578579switches from Scala mode to XML mode when encountering an opening
579- angle bracket '<' in the following circumstance: The '<' must be
580+ angle bracket ‘<’ in the following circumstance: The ‘<’ must be
580581preceded either by whitespace, an opening parenthesis or an opening
581582brace and immediately followed by a character starting an XML name.
582583
0 commit comments