From ee676f2d10679c6a962e64519409048a8a280ee3 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Sat, 18 Oct 2025 11:45:00 -0400 Subject: [PATCH] [cpp.pre][cpp.module] Consolidate preprocessor grammar in one clause The grammar around module directives is quite precise and involved, yet spread across two clauses, the preamble and the module directive clauses. This change set consolidates all the grannar for a _module-file_ into the module directive clause, making it easier to grasp all at once. None of these terms are referenced from outside the clause. --- source/preprocessor.tex | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/source/preprocessor.tex b/source/preprocessor.tex index 38c595333c..78dabde136 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -16,21 +16,6 @@ module-file \end{bnf} -\begin{bnf} -\nontermdef{module-file}\br - \opt{pp-global-module-fragment} pp-module \opt{group} \opt{pp-private-module-fragment} -\end{bnf} - -\begin{bnf} -\nontermdef{pp-global-module-fragment}\br - \keyword{module} \terminal{;} new-line \opt{group} -\end{bnf} - -\begin{bnf} -\nontermdef{pp-private-module-fragment}\br - \keyword{module} \terminal{:} \keyword{private} \terminal{;} new-line \opt{group} -\end{bnf} - \begin{bnf} \nontermdef{group}\br group-part\br @@ -1214,6 +1199,21 @@ \rSec1[cpp.module]{Module directive} \indextext{preprocessing directive!module}% +\begin{bnf} +\nontermdef{module-file}\br + \opt{pp-global-module-fragment} pp-module \opt{group} \opt{pp-private-module-fragment} +\end{bnf} + +\begin{bnf} +\nontermdef{pp-global-module-fragment}\br + \keyword{module} \terminal{;} new-line \opt{group} +\end{bnf} + +\begin{bnf} +\nontermdef{pp-private-module-fragment}\br + \keyword{module} \terminal{:} \keyword{private} \terminal{;} new-line \opt{group} +\end{bnf} + \begin{bnf} \nontermdef{pp-module}\br \opt{\keyword{export}} \keyword{module} \opt{pp-tokens} \terminal{;} new-line