Skip to content

Commit 94055b3

Browse files
eisenwavetkoeppe
authored andcommitted
CWG3094 Rework phases for string literal concatenation and token formation
Fixes NB US 6-020 (C++26 CD). Fixes NB US 7-019 (C++26 CD).
1 parent 14f03aa commit 94055b3

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

source/lex.tex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@
165165
as specified in \ref{lex.string}.
166166
Each such \grammarterm{string-literal} preprocessing token is then considered to have
167167
that common \grammarterm{encoding-prefix}.
168-
169-
\item
170168
\indextext{concatenation!string}%
171-
Adjacent \grammarterm{string-literal} preprocessing tokens are concatenated\iref{lex.string}.
169+
Then, adjacent \grammarterm{string-literal} preprocessing tokens are concatenated\iref{lex.string}.
172170

173171
\item
174172
Each preprocessing token is converted into a token\iref{lex.token}.
175-
The resulting tokens constitute a \defn{translation unit} and
173+
174+
\item
175+
The tokens constitute a \defn{translation unit} and
176176
are syntactically and
177177
semantically analyzed as a \grammarterm{translation-unit}\iref{basic.link} and
178178
translated.
@@ -547,7 +547,7 @@
547547

548548
\pnum
549549
A preprocessing token is the minimal lexical element of the language in translation
550-
phases 3 through 6.
550+
phases 3 through 5.
551551
In this document,
552552
glyphs are used to identify
553553
elements of the basic character set\iref{lex.charset}.
@@ -807,7 +807,7 @@
807807
\end{bnf}
808808

809809
Each \grammarterm{operator-or-punctuator} is converted to a single token
810-
in translation phase 7\iref{lex.phases}.%
810+
in translation phase 6\iref{lex.phases}.%
811811
\indextext{punctuator|)}%
812812
\indextext{operator|)}
813813

@@ -1971,7 +1971,7 @@
19711971
\end{note}
19721972

19731973
\pnum
1974-
In translation phase 6\iref{lex.phases},
1974+
In translation phase 5\iref{lex.phases},
19751975
adjacent \grammarterm{string-literal}s are concatenated.
19761976
The lexical structure and grouping of
19771977
the contents of the individual \grammarterm{string-literal}s is retained.
@@ -2320,11 +2320,11 @@
23202320
\end{example}
23212321

23222322
\pnum
2323-
In translation phase 6\iref{lex.phases}, adjacent \grammarterm{string-literal}s are concatenated and
2323+
In translation phase 5\iref{lex.phases}, adjacent \grammarterm{string-literal}s are concatenated and
23242324
\grammarterm{user-defined-string-literal}{s} are considered \grammarterm{string-literal}s for that
23252325
purpose. During concatenation, \grammarterm{ud-suffix}{es} are removed and ignored and
23262326
the concatenation process occurs as described in~\ref{lex.string}. At the end of phase
2327-
6, if a \grammarterm{string-literal} is the result of a concatenation involving at least one
2327+
5, if a \grammarterm{string-literal} is the result of a concatenation involving at least one
23282328
\grammarterm{user-defined-string-literal}, all the participating
23292329
\grammarterm{user-defined-string-literal}{s} shall have the same \grammarterm{ud-suffix}
23302330
and that suffix is applied to the result of the concatenation.

source/meta.tex

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6552,22 +6552,19 @@
65526552
\item
65536553
\tcode{holds_alternative<u8string>(options.name->\exposid{contents})} is \tcode{true}
65546554
and \tcode{get<u8string>(\brk{}options.name->\exposid{contents})}
6555-
contains a valid identifier\iref{lex.name}
6556-
that is not a keyword\iref{lex.key}
6555+
contains the spelling of a valid \grammarterm{token}
6556+
that is an \grammarterm{identifier}\iref{lex.name}
65576557
when interpreted with UTF-8, or
65586558
\item
65596559
\tcode{holds_alternative<string>(options.name->\exposid{contents})} is \tcode{true}
65606560
and \tcode{get<string>(opt\-ions.name->\exposid{contents})}
6561-
contains a valid identifier\iref{lex.name}
6562-
that is not a keyword\iref{lex.key}
6561+
contains the spelling of a valid \grammarterm{token}
6562+
that is an \grammarterm{identifier}\iref{lex.name}
65636563
when interpreted with the ordinary literal encoding;
65646564
\end{itemize}
65656565
\begin{note}
6566-
The name corresponds to the spelling of an identifier~token
6567-
after phase~6 of translation\iref{lex.phases}.
65686566
Lexical constructs like
6569-
\grammarterm{universal-character-name}s\iref{lex.universal.char} are not processed
6570-
and will cause evaluation to fail.
6567+
\grammarterm{universal-character-name}s\iref{lex.universal.char} are not processed.
65716568
For example, \tcode{R"(\textbackslash u03B1)"} is an invalid identifier
65726569
and is not interpreted as \tcode{"$\alpha$"}.
65736570
\end{note}

0 commit comments

Comments
 (0)