Skip to content

[re.grammar] Improve grammar typesetting. #3193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
\newcommand{\keyword}[1]{\tcode{#1}\indextext{\idxcode{#1}}}
\newcommand{\grammarterm}[1]{\indexgram{\idxgram{#1}}\gterm{#1}}
\newcommand{\grammartermnc}[1]{\indexgram{\idxgram{#1}}\gterm{#1\nocorr}}
\newcommand{\regrammarterm}[1]{\gterm{#1}}
\newcommand{\placeholder}[1]{\textit{#1}}
\newcommand{\placeholdernc}[1]{\textit{#1\nocorr}}
\newcommand{\exposid}[1]{\tcode{\placeholder{#1}}}
Expand Down Expand Up @@ -497,6 +498,7 @@
\newenvironment{bnfbase}
{
\newcommand{\nontermdef}[1]{{\BnfNontermshape##1\itcorr}\indexgrammar{\idxgram{##1}}\textnormal{:}}
\newcommand{\renontermdef}[1]{{\BnfNontermshape##1\itcorr}\,\textnormal{::}}
\newcommand{\terminal}[1]{{\BnfTermshape ##1}}
\renewcommand{\keyword}[1]{\terminal{##1}\indextext{\idxcode{##1}}}
\renewcommand{\exposid}[1]{\terminal{\placeholder{##1}}}
Expand Down
58 changes: 29 additions & 29 deletions source/regex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3475,42 +3475,42 @@
\pnum
The following productions within the ECMAScript grammar are modified as follows:

\begin{codeblock}
ClassAtom ::
-
ClassAtomNoDash
ClassAtomExClass
ClassAtomCollatingElement
\begin{ncbnf}
\renontermdef{ClassAtom}\br
\terminal{-}\br
ClassAtomNoDash\br
ClassAtomExClass\br
ClassAtomCollatingElement\br
ClassAtomEquivalence

IdentityEscape ::
SourceCharacter but not c
\end{codeblock}
\renontermdef{IdentityEscape}\br
SourceCharacter \textnormal{\textbf{but not}} \terminal{c}
\end{ncbnf}

\pnum
The following new productions are then added:

\begin{codeblock}
ClassAtomExClass ::
[: ClassName :]
\begin{ncbnf}
\renontermdef{ClassAtomExClass}\br
\terminal{[:} ClassName \terminal{:]}

ClassAtomCollatingElement ::
[. ClassName .]
\renontermdef{ClassAtomCollatingElement}\br
\terminal{[.} ClassName \terminal{.]}

ClassAtomEquivalence ::
[= ClassName =]
\renontermdef{ClassAtomEquivalence}\br
\terminal{[=} ClassName \terminal{=]}

ClassName ::
ClassNameCharacter
\renontermdef{ClassName}\br
ClassNameCharacter\br
ClassNameCharacter ClassName

ClassNameCharacter ::
SourceCharacter but not one of "." "=" ":"
\end{codeblock}
\renontermdef{ClassNameCharacter}\br
SourceCharacter \textnormal{\textbf{but not one of}} \terminal{.} \textnormal{\textbf{or}} \terminal{=} \textnormal{\textbf{or}} \terminal{:}
\end{ncbnf}

\pnum
The productions \tcode{ClassAtomExClass}, \tcode{ClassAtomCollatingElement}
and \tcode{ClassAtomEquivalence} provide functionality
The productions \regrammarterm{ClassAtomExClass}, \regrammarterm{ClassAtomCollatingElement}
and \regrammarterm{ClassAtomEquivalence} provide functionality
equivalent to that of the same features in regular expressions in POSIX.

\pnum
Expand All @@ -3520,9 +3520,9 @@
according to the rules in \tref{re.synopt}.

\pnum
A \tcode{ClassName} production, when used in \tcode{ClassAtomExClass},
A \regrammarterm{ClassName} production, when used in \regrammarterm{ClassAtomExClass},
is not valid if \tcode{traits_inst.lookup_classname} returns zero for
that name. The names recognized as valid \tcode{ClassName}s are
that name. The names recognized as valid \regrammarterm{ClassName}s are
determined by the type of the traits class, but at least the following
names shall be recognized:
\tcode{alnum}, \tcode{alpha}, \tcode{blank}, \tcode{cntrl}, \tcode{digit},
Expand All @@ -3547,8 +3547,8 @@
\pnum
\indexlibrary{regular expression traits!\idxcode{lookup_collatename}}%
\indexlibrary{\idxcode{lookup_collatename}!regular expression traits}%
A \tcode{ClassName} production when used in
a \tcode{ClassAtomCollatingElement} production is not valid
A \regrammarterm{ClassName} production when used in
a \regrammarterm{ClassAtomCollatingElement} production is not valid
if the value returned by \tcode{traits_inst.lookup_collatename} for
that name is an empty string.

Expand All @@ -3564,8 +3564,8 @@
\pnum
\indexlibrary{regular expression traits!\idxcode{transform_primary}}%
\indextext{\idxcode{transform_primary}!regular expression traits}%
A \tcode{ClassName} production when used in
a \tcode{ClassAtomEquivalence} production is not valid if the value
A \regrammarterm{ClassName} production when used in
a \regrammarterm{ClassAtomEquivalence} production is not valid if the value
returned by \tcode{traits_inst.lookup_collatename} for that name is an
empty string or if the value returned by \tcode{traits_inst\brk.transform_primary}
for the result of the call to \tcode{traits_inst.lookup_collatename}
Expand Down