From 6ef2cb580688a5794ac0b552a21a6fb8d254de31 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Tue, 30 Jul 2024 16:15:43 -0400 Subject: [PATCH] [lex.pptoken] Do not use terms before they are defined This PR purely moves existing words around, and does not create any new content. 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. --- source/lex.tex | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/source/lex.tex b/source/lex.tex index d58678c2d9..d034d35f94 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -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. @@ -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: @@ -587,6 +598,7 @@ \end{itemize} \end{itemize} +\pnum \begin{example} \begin{codeblock} #define R "x" @@ -594,17 +606,6 @@ \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