diff options
author | Karl Berry <karl@freefriends.org> | 2023-05-27 20:23:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-05-27 20:23:48 +0000 |
commit | 1dae169ca5eef27db43551635335940ff21a8de5 (patch) | |
tree | fdc702743f568b4dfde5cb500625c7592bffe486 /Master | |
parent | 20c66c2bed5aacce90e2c856486481ffccf4df72 (diff) |
naive-ebnf (27may23)
git-svn-id: svn://tug.org/texlive/trunk@67234 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf | bin | 588553 -> 591999 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx | 27 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty | 13 |
3 files changed, 35 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf b/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf Binary files differindex 5d346ded12a..96b2f8a7d3d 100644 --- a/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf +++ b/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf diff --git a/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx b/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx index bbdbde0339b..8f7768f156e 100644 --- a/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx +++ b/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{naive-ebnf} %<*package> -[2023-02-21 0.0.5 EBNF in Plain Text] +[2023-05-27 0.0.6 EBNF in Plain Text] %</package> %<*driver> \documentclass{ltxdoc} @@ -104,6 +104,7 @@ % \item |:=| separates the left-hand side from the right-hand side of the production rule; % \item |<...>| denotes a non-terminal (variable); % \item |"..."| denotes a terminal symbol; +% \item |'...'| denotes a special non-printable terminal symbol, like |'EOL'|; % \item \texttt{(...\char`\|...)} denotes a series of options to choose from; % \item |[...]| denotes an optional substitution; % \item |{...}| denotes a zero or more times repetition; @@ -131,7 +132,7 @@ % the left hand side than usual: \par % \begin{ebnf}[1.5in] % <VeryLongVariable> := <X> | <Y> \\ -% <X> := "X" \\ +% <X> := "X" 'EOL' \\ % <Y> := "Y" % \end{ebnf} % \end{document} @@ -139,7 +140,8 @@ % \DescribeMacro{\terminal} % \DescribeMacro{\nonterminal} -% Inside the text, terminals and non-terminals may be formatted using two supplementary commands: +% \DescribeMacro{\sterminal} +% Inside the text, terminals, non-terminals, and special terminals may be formatted using three supplementary commands: % \docshotOptions{firstline=6,lastline=10} % \begin{docshot} % \documentclass{article} @@ -203,7 +205,7 @@ % \changes{0.0.1}{2023/01/28}{First draft.} % \changes{0.0.2}{2023/01/29}{Proper parsing of grouping.} % \changes{0.0.2}{2023/01/29}{Substitutions suggested for special symbols.} -% \changes{0.0.5}{2023/02/04}{New package option \texttt{trail} added, to enable saving generated \TeX{} content to a file, for debugging purposes.} +% \changes{0.0.5}{2023/02/04}{New package option \texttt{trail} added, to enable saving of the generated \TeX{} content to a file, for debugging purposes.} % First, we process package options: % \begin{macrocode} @@ -263,6 +265,16 @@ % \end{macrocode} % \end{macro} +% \begin{macro}{\sterminal} +% \changes{0.0.6}{2023/05/27}{New command \texttt{\char`\\sterminal} added, to enable rendering of special non-printable terminal symbols outside of the \texttt{ebnf} environment.} +% Then, we a command to render a single non-terminal: +% \begin{macrocode} +\makeatletter +\newcommand\sterminal[1]{\relax\ifmmode\else\ttfamily\fi#1}% +\makeatother +% \end{macrocode} +% \end{macro} + % Then, we define supplementary commands: % \begin{macrocode} \makeatletter @@ -278,6 +290,11 @@ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } \terminal{\l_ebnf_tl} } +\newcommand\ebnf@sterminal[1]{ + \tl_set:Nn \l_ebnf_tl { } + \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } + \sterminal{\l_ebnf_tl} +} \newcommand\ebnf@nonterminal[1]{ \tl_set:Nn \l_ebnf_tl { } \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } @@ -313,6 +330,8 @@ {\c{ebnf@nonterminal}{\1}} \l__ebnf_tmp_tl% \regex_replace_all:nnN { "(.+?)" }% {\c{ebnf@terminal}{\1}} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { '(.+?)' }% + {\c{ebnf@sterminal}{\1}} \l__ebnf_tmp_tl% \regex_replace_all:nnN { \|(\|) }% {\c{makebox}[#1][r]{ \1 }} \l__ebnf_tmp_tl% \regex_replace_all:nnN { \| }% diff --git a/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty b/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty index 48136fd5c0f..1576491b599 100644 --- a/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty +++ b/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty @@ -31,7 +31,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{naive-ebnf} -[2023-02-21 0.0.5 EBNF in Plain Text] +[2023-05-27 0.0.6 EBNF in Plain Text] @@ -79,6 +79,10 @@ \makeatother \makeatletter +\newcommand\sterminal[1]{\relax\ifmmode\else\ttfamily\fi#1}% +\makeatother + +\makeatletter \newcommand\ebnf@optional[1] {\ebnf@color{gray}{[}#1\ebnf@color{gray}{]}} \newcommand\ebnf@repetition[1] @@ -91,6 +95,11 @@ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } \terminal{\l_ebnf_tl} } +\newcommand\ebnf@sterminal[1]{ + \tl_set:Nn \l_ebnf_tl { } + \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } + \sterminal{\l_ebnf_tl} +} \newcommand\ebnf@nonterminal[1]{ \tl_set:Nn \l_ebnf_tl { } \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } @@ -121,6 +130,8 @@ {\c{ebnf@nonterminal}{\1}} \l__ebnf_tmp_tl% \regex_replace_all:nnN { "(.+?)" }% {\c{ebnf@terminal}{\1}} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { '(.+?)' }% + {\c{ebnf@sterminal}{\1}} \l__ebnf_tmp_tl% \regex_replace_all:nnN { \|(\|) }% {\c{makebox}[#1][r]{ \1 }} \l__ebnf_tmp_tl% \regex_replace_all:nnN { \| }% |