Skip to content

[std] Switch grammar to \sffamily \itshape #3370

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
Nov 26, 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
1 change: 0 additions & 1 deletion source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5740,7 +5740,6 @@
\end{codeblock}
\end{example}
\begin{note}
\setlength{\emergencystretch}{1em}
The initialization
performed by each \grammarterm{mem-initializer}
constitutes a full-expres\-sion\iref{intro.execution}.
Expand Down
2 changes: 1 addition & 1 deletion source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6251,7 +6251,7 @@
A coroutine behaves as if its \grammarterm{function-body} were replaced by:
\begin{ncsimplebnf}
\terminal{\{}\br
\bnfindent promise-type \exposid{promise} promise-constructor-arguments \terminal{;}\br
\bnfindent \placeholder{promise-type} \exposid{promise} \placeholder{promise-constructor-arguments} \terminal{;}\br
% FIXME: \bnfindent \exposid{promise}\terminal{.get_return_object()} \terminal{;}
% ... except that it's not a discarded-value expression
\bnfindent \terminal{co_await} \terminal{\exposid{promise}.initial_suspend()} \terminal{;}\br
Expand Down
29 changes: 22 additions & 7 deletions source/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,10 @@
\newcommand{\CodeStyle}{\ttfamily}
\newcommand{\CodeStylex}[1]{\texttt{#1}}

\definecolor{grammar-gray}{gray}{0.2}

% General grammar style
\newcommand{\GrammarStyle}{\itfamily}
\newcommand{\GrammarStylex}[1]{\textit{#1}}
\newcommand{\GrammarStylex}[1]{\textcolor{grammar-gray}{\textsf{\textit{#1}}}}

% Code and definitions embedded in text.
\newcommand{\tcode}[1]{\CodeStylex{#1}}
Expand All @@ -214,7 +215,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{\regrammarterm}[1]{\textit{#1}}
\newcommand{\placeholder}[1]{\textit{#1}}
\newcommand{\placeholdernc}[1]{\textit{#1\nocorr}}
\newcommand{\exposid}[1]{\tcode{\placeholder{#1}}}
Expand All @@ -240,7 +241,7 @@
\newcommand{\CppXI}{\Cpp{} 2011}
\newcommand{\CppXIV}{\Cpp{} 2014}
\newcommand{\CppXVII}{\Cpp{} 2017}
\newcommand{\opt}[1]{#1\ensuremath{_\mathit{opt}}}
\newcommand{\opt}[1]{#1\ensuremath{_\mathit{\color{black}opt}}}
\newcommand{\dcr}{-{-}}
\newcommand{\bigoh}[1]{\ensuremath{\mathscr{O}(#1)}}

Expand Down Expand Up @@ -526,16 +527,17 @@
\setlength{\BnfInc}{\BnfIndent}
\newlength{\BnfRest}
\setlength{\BnfRest}{2\BnfIndent}
\newcommand{\BnfNontermshape}{\small\rmfamily\itshape}
\newcommand{\BnfNontermshape}{\small\color{grammar-gray}\sffamily\itshape}
\newcommand{\BnfReNontermshape}{\small\rmfamily\itshape}
\newcommand{\BnfTermshape}{\small\ttfamily\upshape}

\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}}}
\renewcommand{\exposid}[1]{\terminal{\textit{##1}}}
\renewcommand{\placeholder}[1]{\textrm{\textit{##1}}}
\newcommand{\descr}[1]{\textnormal{##1}}
\newcommand{\bnfindent}{\hspace*{\bnfindentfirst}}
\newcommand{\bnfindentfirst}{\BnfIndent}
Expand Down Expand Up @@ -572,6 +574,19 @@
\end{bnfbase}
}

\newenvironment{ncrebnf}
{
\begin{bnfbase}
\newcommand{\renontermdef}[1]{{\BnfReNontermshape##1\itcorr}\,\textnormal{::}}
\begin{bnflist}
\BnfReNontermshape
\item\relax
}
{
\end{bnflist}
\end{bnfbase}
}

% non-copied versions of bnf environments
\let\ncsimplebnf\simplebnf
\let\endncsimplebnf\endsimplebnf
Expand Down
8 changes: 4 additions & 4 deletions source/regex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3680,7 +3680,7 @@
\pnum
The following productions within the ECMAScript grammar are modified as follows:

\begin{ncbnf}
\begin{ncrebnf}
\renontermdef{ClassAtom}\br
\terminal{-}\br
ClassAtomNoDash\br
Expand All @@ -3690,12 +3690,12 @@

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

\pnum
The following new productions are then added:

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

Expand All @@ -3711,7 +3711,7 @@

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

\pnum
The productions \regrammarterm{ClassAtomExClass}, \regrammarterm{ClassAtomCollatingElement}
Expand Down
1 change: 1 addition & 0 deletions source/std.tex
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
\usepackage[final]{microtype}
\usepackage{multicol}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage[pdftex, final]{graphicx}
\usepackage[pdftex,
Expand Down