Skip to content

Commit e207506

Browse files
committed
[macros, back] Put all mentions of \grammarterm into the grammar index; adjust introductory text for index of grammar productions. (#1858)
1 parent 7eeecd1 commit e207506

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

source/back.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ \chapter{Bibliography}
5555

5656
\clearpage
5757
\renewcommand{\indexname}{Index of grammar productions}
58-
\renewcommand{\preindexhook}{The first page number for each entry is the page in the
59-
general text where the grammar production is defined. The second page number is the
60-
corresponding page in the Grammar summary\iref{gram}.\\}
58+
\renewcommand{\preindexhook}{The first bold page number for each entry is the page in the
59+
general text where the grammar production is defined. The second bold page number is the
60+
corresponding page in the Grammar summary\iref{gram}. Other page numbers refer to pages where the grammar production is mentioned in the general text.\\}
6161
\renewcommand{\leftmark}{\indexname}
6262
{
6363
\raggedright

source/classes.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
simple-template-id
2323
\end{bnf}
2424

25-
\grammarterm{Class-specifier}{s} and
26-
\grammarterm{elaborated-type-specifier}{s}\iref{dcl.type.elab} are used to
27-
make \grammarterm{class-name}{s}. An object of a class consists of a
25+
A \grammarterm{class-specifier} or
26+
an \grammarterm{elaborated-type-specifier}\iref{dcl.type.elab} is used to
27+
make a \grammarterm{class-name}. An object of a class consists of a
2828
(possibly empty) sequence of members and base class objects.
2929

3030
\begin{bnf}

source/declarators.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@
102102
shall not be present when the declarator does not declare a
103103
function\iref{dcl.fct}.
104104
%
105+
\indextext{trailing requires-clause@trailing \textit{requires-clause}|see{\textit{requires-clause}, trailing}}%
105106
When present after a declarator, the \grammarterm{requires-clause}
106-
is called the \defnx{trailing \grammarterm{requires-clause}{}}{%
107-
trailing requires-clause@trailing \grammarterm{requires-clause}}.
107+
is called the \defnx{trailing \grammarterm{requires-clause}}{%
108+
\idxgram{requires-clause}!trailing}.
108109
The trailing \grammarterm{requires-clause} introduces the
109110
\grammarterm{constraint-expression} that results from interpreting
110111
its \grammarterm{constraint-logical-or-expression} as a

source/expressions.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4004,11 +4004,10 @@
40044004
padding necessary to align the allocated objects within the allocated memory.
40054005

40064006
\pnum
4007-
\indextext{placement syntax!\idxcode{new}}%
4008-
\indextext{new-expression@\grammarterm{new-expression}!placement}%
4007+
\indextext{placement new-expression@placement \gterm{new-expression}|see{\gterm{new-expression}, placement}}%
40094008
The \grammarterm{new-placement} syntax is used to supply additional
40104009
arguments to an allocation function; such an expression is called
4011-
a \defnx{placement \grammarterm{new-expression}}{placement new-expression@placement \grammarterm{new-expression}}{.}
4010+
a \defnx{placement \grammarterm{new-expression}}{\idxgram{new-expression}!placement}.
40124011

40134012
\pnum
40144013
Overload resolution is

source/macros.tex

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,21 @@
141141
\let\BreakableUnderscore\textunderscore%
142142
\edef\x{#1}%
143143
\let\tcode\otcode%
144-
\let\grammarterm\ogrammarterm%
144+
\let\grammarterm\gterm%
145145
\let\mname\omname%
146146
\let\Cpp\oCpp%
147147
\let\BreakableUnderscore\oBreakableUnderscore%
148148
\index[impldefindex]{\x@#1}%
149+
\let\grammarterm\ogrammarterm%
149150
\let\textup\otextup%
150151
}
151152

152-
% These three commands use the "cooked" \indeximpldef command to emit index
153+
\newcommand{\indexdefn}[1]{\indextext{#1}}
154+
\newcommand{\idxbfpage}[1]{\textbf{\hyperpage{#1}}}
155+
\newcommand{\indexgrammar}[1]{\indextext{#1}\indexgram{#1|idxbfpage}}
156+
% This command uses the "cooked" \indeximpldef command to emit index
153157
% entries; thus they only work for simple index entries that do not contain
154158
% special indexing instructions.
155-
\newcommand{\indexdefn}[1]{\indextext{#1}}
156-
\newcommand{\indexgrammar}[1]{\indextext{#1}\indexgram{#1}}
157159
\newcommand{\impldef}[1]{\indeximpldef{#1}implementation-defined}
158160
% \impldefplain passes the argument directly to the index, allowing you to
159161
% use special indexing instructions (!, @, |).
@@ -162,7 +164,7 @@
162164
% appearance
163165
\newcommand{\idxcode}[1]{#1@\tcode{#1}}
164166
\newcommand{\idxhdr}[1]{#1@\tcode{<#1>}}
165-
\newcommand{\idxgram}[1]{#1@\textit{#1}}
167+
\newcommand{\idxgram}[1]{#1@\gterm{#1}}
166168

167169
% class member library index
168170
\newcommand{\indexlibrarymember}[2]{\indexlibrary{\idxcode{#1}!\idxcode{#2}}\indexlibrary{\idxcode{#2}!\idxcode{#1}}}
@@ -172,14 +174,19 @@
172174
\newcommand{\CodeStyle}{\ttfamily}
173175
\newcommand{\CodeStylex}[1]{\texttt{#1}}
174176

177+
% General grammar style
178+
\newcommand{\GrammarStyle}{\itfamily}
179+
\newcommand{\GrammarStylex}[1]{\textit{#1}}
180+
175181
% Code and definitions embedded in text.
176182
\newcommand{\tcode}[1]{\CodeStylex{#1}}
177183
\newcommand{\techterm}[1]{\textit{#1}}
178184
\newcommand{\defnx}[2]{\indexdefn{#2}\textit{#1}}
179185
\newcommand{\defn}[1]{\defnx{#1}{#1}}
180186
\newcommand{\term}[1]{\textit{#1}}
181-
\newcommand{\grammarterm}[1]{\textit{#1}}
182-
\newcommand{\grammartermnc}[1]{\textit{#1}\nocorr}
187+
\newcommand{\gterm}[1]{\GrammarStylex{#1}}
188+
\newcommand{\grammarterm}[1]{\indexgram{\idxgram{#1}}\gterm{#1}}
189+
\newcommand{\grammartermnc}[1]{\indexgram{\idxgram{#1}}\gterm{#1}\nocorr}
183190
\newcommand{\placeholder}[1]{\textit{#1}}
184191
\newcommand{\placeholdernc}[1]{\textit{#1\nocorr}}
185192

@@ -194,9 +201,7 @@
194201
\newcommand{\CppXI}{\Cpp{} 2011}
195202
\newcommand{\CppXIV}{\Cpp{} 2014}
196203
\newcommand{\CppXVII}{\Cpp{} 2017}
197-
\newcommand{\opt}[1]{\ifthenelse{\equal{#1}{}}
198-
{\PackageError{main}{argument must not be empty}{}}
199-
{#1\ensuremath{_\mathit{opt}}}}
204+
\newcommand{\opt}[1]{#1\ensuremath{_\mathit{opt}}}
200205
\newcommand{\dcr}{-{-}}
201206
\newcommand{\bigoh}[1]{\ensuremath{\mathscr{O}(#1)}}
202207

@@ -356,7 +361,7 @@
356361
\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}}
357362
\renewcommand{\techterm}[1]{\textit{\CodeStylex{##1}}}
358363
\renewcommand{\term}[1]{\textit{##1}}
359-
\renewcommand{\grammarterm}[1]{\textit{##1}}
364+
\renewcommand{\grammarterm}[1]{\gterm{##1}}
360365
}
361366

362367
\lstnewenvironment{codeblock}{\CodeBlockSetup}{}

0 commit comments

Comments
 (0)