You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Operator characters. These consist of all printable ASCII characters (`\u0020` - `\u007E`) that are in none of the sets above, mathematical symbols (`Sm`) and other symbols (`So`).
22
22
23
+
## Optional Braces
24
+
25
+
The principle of optional braces is that any keyword that can be followed by `{` can also be followed by an indented block, without needing an intervening `:`.
26
+
(Allowing an optional `:` would be counterproductive since it would introduce several ways to do the same thing.)
27
+
28
+
The lexical analyzer inserts `indent` and `outdent` tokens that represent regions of indented code [at certain points](./other-new-features/indentation.md).
29
+
30
+
´\color{red}{\text{TODO SCALA3: Port soft-modifier.md and link it here.}}´
31
+
32
+
In the context-free productions below we use the notation `<<< ts >>>` to indicate a token sequence `ts` that is either enclosed in a pair of braces `{ ts }` or that constitutes an indented region `indent ts outdent`.
33
+
Analogously, the notation `:<<< ts >>>` indicates a token sequence `ts` that is either enclosed in a pair of braces `{ ts }` or that constitutes an indented region `indent ts outdent` that follows a `colon` token.
34
+
35
+
A `colon` token reads as the standard colon "`:`" but is generated instead of it where `colon` is legal according to the context free syntax, but only if the previous token is an alphanumeric identifier, a backticked identifier, or one of the tokens `this`, `super`, `new`, "`)`", and "`]`".
36
+
37
+
```
38
+
colon ::= ':' -- with side conditions explained above
39
+
<<< ts >>> ::= ‘{’ ts ‘}’
40
+
| indent ts outdent
41
+
:<<< ts >>> ::= [nl] ‘{’ ts ‘}’
42
+
| colon indent ts outdent
43
+
```
44
+
23
45
## Identifiers
24
46
25
47
```ebnf
@@ -80,28 +102,30 @@ Some examples of constant identifiers are
80
102
The ‘$’ character is reserved for compiler-synthesized identifiers.
81
103
User programs should not define identifiers that contain ‘$’ characters.
82
104
105
+
###Regular keywords
106
+
83
107
The following names are reserved words instead of being members of the syntactic class`id` of lexical identifiers.
84
108
85
109
```scala
86
-
abstractcasecatchclassdef
87
-
doelseextendsfalsefinal
88
-
finallyfor forSome ifimplicit
89
-
importlazymacromatchnew
90
-
nullobjectoverridepackageprivate
91
-
protectedreturnsealedsuperthis
92
-
throwtraittrytruetype
93
-
valvarwhilewithyield
94
-
_ :==><-<:<%>:#@
110
+
abstractcasecatchclassdefdoelse
111
+
enumexportextendsfalsefinalfinallyfor
112
+
givenifimplicitimportlazymatchnew
113
+
nullobjectoverridepackageprivateprotectedreturn
114
+
sealedsuperthenthrowtraittruetry
115
+
typevalvarwhilewithyield
116
+
:=<-=><:>:#
117
+
@=>>?=>
95
118
```
96
119
97
-
The Unicode operators `\u21D2` ‘´\Rightarrow´’ and `\u2190` ‘´\leftarrow´’, which have the ASCII equivalents `=>` and `<-`, are also reserved.
120
+
### Soft keywords
98
121
99
-
> Here are examples of identifiers:
100
-
> ```scala
101
-
> x Object maxIndex p2p empty_?
102
-
>+ `yield` αρετη _y dot_product_*
103
-
> __system _MAX_LEN_
104
-
> ```
122
+
Additionally, the following soft keywords are reserved only in some situations.
123
+
124
+
´\color{red}{\text{TODO SCALA3: Port soft-modifier.md and link it here.}}´
125
+
126
+
```
127
+
as derives end extension infix inline opaque open transparent using | * + -
0 commit comments