diff --git a/source/macros.tex b/source/macros.tex index 5e81f4df44..73b01f4ed5 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -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}}} @@ -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}}} diff --git a/source/regex.tex b/source/regex.tex index 0699c284cd..60ee37fe5a 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -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 @@ -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}, @@ -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. @@ -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}