Skip to content

Commit

Permalink
[lex.pptoken] Reorder paragraphs to define terms before they are used (
Browse files Browse the repository at this point in the history
…#7346)

First move p1 below p2, so that we do not refer to preprocessing tokens before they are defined.
Then move p4 up, as it is splitting some unrelated examples, neither of which use its contents.
  • Loading branch information
AlisdairM authored Oct 28, 2024
1 parent ac5b250 commit 324f564
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions source/lex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,6 @@
\textnormal{each non-whitespace character that cannot be one of the above}
\end{bnf}

\pnum
Each preprocessing token that is converted to a token\iref{lex.token}
shall have the lexical form of a keyword, an identifier, a literal,
or an operator or punctuator.

\pnum
A preprocessing token is the minimal lexical element of the language in translation
phases 3 through 6.
Expand Down Expand Up @@ -548,6 +543,22 @@
between the quotation characters in a character literal or
string literal.

\pnum
Each preprocessing token that is converted to a token\iref{lex.token}
shall have the lexical form of a keyword, an identifier, a literal,
or an operator or punctuator.

\pnum
The \grammarterm{import-keyword} is produced
by processing an \keyword{import} directive\iref{cpp.import},
the \grammarterm{module-keyword} is produced
by preprocessing a \keyword{module} directive\iref{cpp.module}, and
the \grammarterm{export-keyword} is produced
by preprocessing either of the previous two directives.
\begin{note}
None has any observable spelling.
\end{note}

\pnum
If the input stream has been parsed into preprocessing tokens up to a
given character:
Expand Down Expand Up @@ -587,24 +598,14 @@
\end{itemize}
\end{itemize}

\pnum
\begin{example}
\begin{codeblock}
#define R "x"
const char* s = R"y"; // ill-formed raw string, not \tcode{"x" "y"}
\end{codeblock}
\end{example}

\pnum
The \grammarterm{import-keyword} is produced
by preprocessing an \keyword{import} directive\iref{cpp.import},
the \grammarterm{module-keyword} is produced
by preprocessing a \keyword{module} directive\iref{cpp.module}, and
the \grammarterm{export-keyword} is produced
by preprocessing either of the previous two directives.
\begin{note}
None has any observable spelling.
\end{note}

\pnum
\begin{example}
The program fragment \tcode{0xe+foo} is parsed as a
Expand Down

0 comments on commit 324f564

Please # to comment.