Skip to content

Commit 27eda37

Browse files
Eeliszygoloid
authored andcommitted
[re.grammar] Improve grammar typesetting.
1 parent 97977a1 commit 27eda37

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

source/macros.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
\newcommand{\keyword}[1]{\tcode{#1}\indextext{\idxcode{#1}}}
212212
\newcommand{\grammarterm}[1]{\indexgram{\idxgram{#1}}\gterm{#1}}
213213
\newcommand{\grammartermnc}[1]{\indexgram{\idxgram{#1}}\gterm{#1\nocorr}}
214+
\newcommand{\regrammarterm}[1]{\gterm{#1}}
214215
\newcommand{\placeholder}[1]{\textit{#1}}
215216
\newcommand{\placeholdernc}[1]{\textit{#1\nocorr}}
216217
\newcommand{\exposid}[1]{\tcode{\placeholder{#1}}}
@@ -528,6 +529,7 @@
528529
\newenvironment{bnfbase}
529530
{
530531
\newcommand{\nontermdef}[1]{{\BnfNontermshape##1\itcorr}\indexgrammar{\idxgram{##1}}\textnormal{:}}
532+
\newcommand{\renontermdef}[1]{{\BnfNontermshape##1\itcorr}\,\textnormal{::}}
531533
\newcommand{\terminal}[1]{{\BnfTermshape ##1}}
532534
\renewcommand{\keyword}[1]{\terminal{##1}\indextext{\idxcode{##1}}}
533535
\renewcommand{\exposid}[1]{\terminal{\placeholder{##1}}}

source/regex.tex

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,42 +3680,42 @@
36803680
\pnum
36813681
The following productions within the ECMAScript grammar are modified as follows:
36823682

3683-
\begin{codeblock}
3684-
ClassAtom ::
3685-
-
3686-
ClassAtomNoDash
3687-
ClassAtomExClass
3688-
ClassAtomCollatingElement
3683+
\begin{ncbnf}
3684+
\renontermdef{ClassAtom}\br
3685+
\terminal{-}\br
3686+
ClassAtomNoDash\br
3687+
ClassAtomExClass\br
3688+
ClassAtomCollatingElement\br
36893689
ClassAtomEquivalence
36903690

3691-
IdentityEscape ::
3692-
SourceCharacter but not c
3693-
\end{codeblock}
3691+
\renontermdef{IdentityEscape}\br
3692+
SourceCharacter \textnormal{\textbf{but not}} \terminal{c}
3693+
\end{ncbnf}
36943694

36953695
\pnum
36963696
The following new productions are then added:
36973697

3698-
\begin{codeblock}
3699-
ClassAtomExClass ::
3700-
[: ClassName :]
3698+
\begin{ncbnf}
3699+
\renontermdef{ClassAtomExClass}\br
3700+
\terminal{[:} ClassName \terminal{:]}
37013701

3702-
ClassAtomCollatingElement ::
3703-
[. ClassName .]
3702+
\renontermdef{ClassAtomCollatingElement}\br
3703+
\terminal{[.} ClassName \terminal{.]}
37043704

3705-
ClassAtomEquivalence ::
3706-
[= ClassName =]
3705+
\renontermdef{ClassAtomEquivalence}\br
3706+
\terminal{[=} ClassName \terminal{=]}
37073707

3708-
ClassName ::
3709-
ClassNameCharacter
3708+
\renontermdef{ClassName}\br
3709+
ClassNameCharacter\br
37103710
ClassNameCharacter ClassName
37113711

3712-
ClassNameCharacter ::
3713-
SourceCharacter but not one of "." "=" ":"
3714-
\end{codeblock}
3712+
\renontermdef{ClassNameCharacter}\br
3713+
SourceCharacter \textnormal{\textbf{but not one of}} \terminal{.} \textnormal{\textbf{or}} \terminal{=} \textnormal{\textbf{or}} \terminal{:}
3714+
\end{ncbnf}
37153715

37163716
\pnum
3717-
The productions \tcode{ClassAtomExClass}, \tcode{ClassAtomCollatingElement}
3718-
and \tcode{ClassAtomEquivalence} provide functionality
3717+
The productions \regrammarterm{ClassAtomExClass}, \regrammarterm{ClassAtomCollatingElement}
3718+
and \regrammarterm{ClassAtomEquivalence} provide functionality
37193719
equivalent to that of the same features in regular expressions in POSIX.
37203720

37213721
\pnum
@@ -3725,9 +3725,9 @@
37253725
according to the rules in \tref{re.synopt}.
37263726

37273727
\pnum
3728-
A \tcode{ClassName} production, when used in \tcode{ClassAtomExClass},
3728+
A \regrammarterm{ClassName} production, when used in \regrammarterm{ClassAtomExClass},
37293729
is not valid if \tcode{traits_inst.lookup_classname} returns zero for
3730-
that name. The names recognized as valid \tcode{ClassName}s are
3730+
that name. The names recognized as valid \regrammarterm{ClassName}s are
37313731
determined by the type of the traits class, but at least the following
37323732
names shall be recognized:
37333733
\tcode{alnum}, \tcode{alpha}, \tcode{blank}, \tcode{cntrl}, \tcode{digit},
@@ -3752,8 +3752,8 @@
37523752
\pnum
37533753
\indexlibrary{regular expression traits!\idxcode{lookup_collatename}}%
37543754
\indexlibrary{\idxcode{lookup_collatename}!regular expression traits}%
3755-
A \tcode{ClassName} production when used in
3756-
a \tcode{ClassAtomCollatingElement} production is not valid
3755+
A \regrammarterm{ClassName} production when used in
3756+
a \regrammarterm{ClassAtomCollatingElement} production is not valid
37573757
if the value returned by \tcode{traits_inst.lookup_collatename} for
37583758
that name is an empty string.
37593759

@@ -3769,8 +3769,8 @@
37693769
\pnum
37703770
\indexlibrary{regular expression traits!\idxcode{transform_primary}}%
37713771
\indextext{\idxcode{transform_primary}!regular expression traits}%
3772-
A \tcode{ClassName} production when used in
3773-
a \tcode{ClassAtomEquivalence} production is not valid if the value
3772+
A \regrammarterm{ClassName} production when used in
3773+
a \regrammarterm{ClassAtomEquivalence} production is not valid if the value
37743774
returned by \tcode{traits_inst.lookup_collatename} for that name is an
37753775
empty string or if the value returned by \tcode{traits_inst\brk.transform_primary}
37763776
for the result of the call to \tcode{traits_inst.lookup_collatename}

0 commit comments

Comments
 (0)