35
35
% version of the language which will actually be specified by the next stable
36
36
% release of this document.
37
37
%
38
+ % Mar 2023
39
+ % - Clarify how line breaks are handled in a multi-line string literal. Rename
40
+ % the lexical token NEWLINE to LINE\_BREAK (clarifying that it is not `\n`).
41
+ %
38
42
% Feb 2023
39
43
% - Change the specification of constant expressions of the form `e1 == e2`
40
44
% to use primitive equality.
@@ -9166,6 +9170,9 @@ \subsection{Strings}
9166
9170
It is a compile-time error if the value of the
9167
9171
\syntax{<HEX\_DIGIT\_SEQUENCE>}
9168
9172
is not a valid Unicode code point.
9173
+ \commentary{For example,}
9174
+ {\color{commentaryColor}{\syntax{`\\u{0A}'}}\color{normativeColor}}
9175
+ \commentary{is the code point U+000A.}
9169
9176
\item
9170
9177
\lit{\$} indicating the beginning of an interpolated expression.
9171
9178
\item
@@ -9183,8 +9190,9 @@ \subsection{Strings}
9183
9190
9184
9191
\LMHash{}%
9185
9192
Line breaks in a multiline string are represented by
9186
- the \synt{NEWLINE} production.
9187
- A line break introduces a single newline character into the string value.
9193
+ the \synt{LINE\_BREAK} production.
9194
+ A line break introduces a single newline character (U+000A)
9195
+ into the string value.
9188
9196
9189
9197
\LMHash{}%
9190
9198
It is a compile-time error if a non-raw string literal contains
@@ -9196,9 +9204,9 @@ \subsection{Strings}
9196
9204
or by curly brace delimited sequence of hexadecimal digits.
9197
9205
9198
9206
\begin{grammar}
9199
- <NEWLINE> ::= `\\n'
9200
- \alt `\\r'
9207
+ <LINE\_BREAK> ::= `\\n'
9201
9208
\alt `\\r\\n'
9209
+ \alt `\\r'
9202
9210
\end{grammar}
9203
9211
9204
9212
\LMHash{}%
@@ -16727,7 +16735,7 @@ \subsection{Identifier Reference}
16727
16735
16728
16736
<DIGIT> ::= `0' .. `9'
16729
16737
16730
- <WHITESPACE> ::= (`\\t' | ` ' | <NEWLINE >)+
16738
+ <WHITESPACE> ::= (`\\t' | ` ' | <LINE\_BREAK >)+
16731
16739
\end{grammar}
16732
16740
16733
16741
\LMHash{}%
@@ -19000,7 +19008,7 @@ \section{Libraries and Scripts}
19000
19008
<scriptTag>? <libraryName>? <importOrExport>* <partDirective>*
19001
19009
\gnewline{} (<metadata> <topLevelDeclaration>)* <EOF>
19002
19010
19003
- <scriptTag> ::= `#!' (\gtilde<NEWLINE>) * <NEWLINE >
19011
+ <scriptTag> ::= `#!' (\gtilde(`\\r' | `\\n')) * <LINE\_BREAK >
19004
19012
19005
19013
<libraryName> ::= <metadata> \LIBRARY{} <dottedIdentifierList> `;'
19006
19014
@@ -22423,7 +22431,8 @@ \subsubsection{Comments}
22423
22431
are sections of program text that are used for documentation.
22424
22432
22425
22433
\begin{grammar}
22426
- <SINGLE\_LINE\_COMMENT> ::= `//' \gtilde(<NEWLINE>)* (<NEWLINE>)?
22434
+ <SINGLE\_LINE\_COMMENT> ::= \gnewline{}
22435
+ `//' \gtilde(<LINE\_BREAK>)* (<LINE\_BREAK>)?
22427
22436
22428
22437
<MULTI\_LINE\_COMMENT> ::= \gnewline{}
22429
22438
`/*' (<MULTI\_LINE\_COMMENT> | \gtilde{} `*/')* `*/'
0 commit comments