Skip to content

Commit df66f73

Browse files
committed
P3868R1 Allow #line before module declarations
Fixes NB US 55-102 (C++26 CD). - Retained position of #line alternative within control-line.
1 parent 25eff1f commit df66f73

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

source/preprocessor.tex

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
\begin{bnf}
2020
\nontermdef{module-file}\br
21-
\opt{pp-global-module-fragment} pp-module \opt{group} \opt{pp-private-module-fragment}
21+
\opt{line-directives} \opt{pp-global-module-fragment} pp-module \opt{group} \opt{pp-private-module-fragment}
2222
\end{bnf}
2323

2424
\begin{bnf}
@@ -55,13 +55,18 @@
5555
\terminal{\# define } identifier lparen \terminal{... )} replacement-list new-line\br
5656
\terminal{\# define } identifier lparen identifier-list \terminal{, ... )} replacement-list new-line\br
5757
\terminal{\# undef \ } identifier new-line\br
58-
\terminal{\# line \ \ } pp-tokens new-line\br
58+
line-directive\br
5959
\terminal{\# error \ } \opt{pp-tokens} new-line\br
6060
\terminal{\# warning} \opt{pp-tokens} new-line\br
6161
\terminal{\# pragma } \opt{pp-tokens} new-line\br
6262
\terminal{\# }new-line
6363
\end{bnf}
6464

65+
\begin{bnf}
66+
\nontermdef{line-directives}\br
67+
line-directive \opt{line-directives}
68+
\end{bnf}
69+
6570
\begin{bnf}
6671
\nontermdef{if-section}\br
6772
if-group \opt{elif-groups} \opt{else-group} endif-line
@@ -2070,6 +2075,11 @@
20702075
\indextext{preprocessing directive!line control}%
20712076
\indextext{\idxcode{\#line}|see{preprocessing directive, line control}}
20722077

2078+
\begin{bnf}
2079+
\nontermdef{line-directive}\br
2080+
\terminal{\# line} pp-tokens new-line\br
2081+
\end{bnf}
2082+
20732083
\pnum
20742084
The \grammarterm{string-literal} of a
20752085
\tcode{\#line}

0 commit comments

Comments
 (0)