Skip to content

Commit 7f84786

Browse files
committed
[cpp] Dissolve bnftab, use spaces for alignment.
The result looks neater because the spacing is tighter, it's simpler to edit, and it lets us get rid of the "tabular bnf" macros.
1 parent 1541232 commit 7f84786

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

source/preprocessor.tex

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,52 +47,52 @@
4747
\terminal{\#} conditionally-supported-directive
4848
\end{bnf}
4949

50-
\begin{bnftab}
50+
\begin{bnf}\obeyspaces
5151
\nontermdef{control-line}\br
52-
\>\terminal{\# include}\>\>pp-tokens new-line\br
53-
\>\terminal{\# define}\>\>identifier replacement-list new-line\br
54-
\>\terminal{\# define}\>\>identifier lparen \opt{identifier-list} \terminal{)} replacement-list new-line\br
55-
\>\terminal{\# define}\>\>identifier lparen \terminal{... )} replacement-list new-line\br
56-
\>\terminal{\# define}\>\>identifier lparen identifier-list \terminal{, ... )} replacement-list new-line\br
57-
\>\terminal{\# undef}\>\>identifier new-line\br
58-
\>\terminal{\# line}\>\>pp-tokens new-line\br
59-
\>\terminal{\# error}\>\>\opt{pp-tokens} new-line\br
60-
\>\terminal{\# pragma}\>\>\opt{pp-tokens} new-line\br
61-
\>\terminal{\# }new-line
62-
\end{bnftab}
52+
\terminal{\# include} pp-tokens new-line\br
53+
\terminal{\# define } identifier replacement-list new-line\br
54+
\terminal{\# define } identifier lparen \opt{identifier-list} \terminal{)} replacement-list new-line\br
55+
\terminal{\# define } identifier lparen \terminal{... )} replacement-list new-line\br
56+
\terminal{\# define } identifier lparen identifier-list \terminal{, ... )} replacement-list new-line\br
57+
\terminal{\# undef } identifier new-line\br
58+
\terminal{\# line } pp-tokens new-line\br
59+
\terminal{\# error } \opt{pp-tokens} new-line\br
60+
\terminal{\# pragma } \opt{pp-tokens} new-line\br
61+
\terminal{\# }new-line
62+
\end{bnf}
6363

6464
\begin{bnf}
6565
\nontermdef{if-section}\br
6666
if-group \opt{elif-groups} \opt{else-group} endif-line
6767
\end{bnf}
6868

69-
\begin{bnftab}
69+
\begin{bnf}\obeyspaces
7070
\nontermdef{if-group}\br
71-
\>\terminal{\# if}\>\>constant-expression new-line \opt{group}\br
72-
\>\terminal{\# ifdef}\>\>identifier new-line \opt{group}\br
73-
\>\terminal{\# ifndef}\>\>identifier new-line \opt{group}
74-
\end{bnftab}
71+
\terminal{\# if } constant-expression new-line \opt{group}\br
72+
\terminal{\# ifdef } identifier new-line \opt{group}\br
73+
\terminal{\# ifndef } identifier new-line \opt{group}
74+
\end{bnf}
7575

7676
\begin{bnf}
7777
\nontermdef{elif-groups}\br
7878
elif-group\br
7979
elif-groups elif-group
8080
\end{bnf}
8181

82-
\begin{bnftab}
82+
\begin{bnf}\obeyspaces
8383
\nontermdef{elif-group}\br
84-
\>\terminal{\# elif}\>\>constant-expression new-line \opt{group}
85-
\end{bnftab}
84+
\terminal{\# elif } constant-expression new-line \opt{group}
85+
\end{bnf}
8686

87-
\begin{bnftab}
87+
\begin{bnf}\obeyspaces
8888
\nontermdef{else-group}\br
89-
\>\terminal{\# else}\>\>new-line \opt{group}
90-
\end{bnftab}
89+
\terminal{\# else } new-line \opt{group}
90+
\end{bnf}
9191

92-
\begin{bnftab}
92+
\begin{bnf}\obeyspaces
9393
\nontermdef{endif-line}\br
94-
\>\terminal{\# endif}\>\>new-line
95-
\end{bnftab}
94+
\terminal{\# endif } new-line
95+
\end{bnf}
9696

9797
\begin{bnf}
9898
\nontermdef{text-line}\br
@@ -271,14 +271,12 @@
271271

272272
\pnum
273273
Preprocessing directives of the forms
274-
275-
\begin{ncbnftab}
274+
\begin{ncsimplebnf}\obeyspaces
276275
\indextext{\idxcode{\#if}}%
277-
\terminal{\# if}\>\>constant-expression new-line \opt{group}\br
276+
\terminal{\# if } constant-expression new-line \opt{group}\br
278277
\indextext{\idxcode{\#elif}}%
279-
\terminal{\# elif}\>\>constant-expression new-line \opt{group}
280-
\end{ncbnftab}
281-
278+
\terminal{\# elif } constant-expression new-line \opt{group}
279+
\end{ncsimplebnf}
282280
check whether the controlling constant expression evaluates to nonzero.
283281

284282
\pnum
@@ -367,14 +365,12 @@
367365

368366
\pnum
369367
Preprocessing directives of the forms
370-
371-
\begin{ncbnftab}
372-
\terminal{\# ifdef}\>\>identifier new-line \opt{group}\br
368+
\begin{ncsimplebnf}\obeyspaces
369+
\terminal{\# ifdef } identifier new-line \opt{group}\br
373370
\indextext{\idxcode{\#ifdef}}%
374-
\terminal{\# ifndef}\>\>identifier new-line \opt{group}
371+
\terminal{\# ifndef } identifier new-line \opt{group}
375372
\indextext{\idxcode{\#ifndef}}%
376-
\end{ncbnftab}
377-
373+
\end{ncsimplebnf}
378374
check whether the identifier is or is not currently defined as a macro name.
379375
Their conditions are equivalent to
380376
\tcode{\#if}

0 commit comments

Comments
 (0)