texlive[67234] Master/texmf-dist: naive-ebnf (27may23)

commits+karl at tug.org commits+karl at tug.org
Sat May 27 22:23:48 CEST 2023


Revision: 67234
          http://tug.org/svn/texlive?view=revision&revision=67234
Author:   karl
Date:     2023-05-27 22:23:48 +0200 (Sat, 27 May 2023)
Log Message:
-----------
naive-ebnf (27may23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf
    trunk/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx
    trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty

Modified: trunk/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx	2023-05-27 20:23:26 UTC (rev 67233)
+++ trunk/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx	2023-05-27 20:23:48 UTC (rev 67234)
@@ -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 at sterminal[1]{
+  \tl_set:Nn \l_ebnf_tl { }
+  \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
+  \sterminal{\l_ebnf_tl}
+}
 \newcommand\ebnf at nonterminal[1]{
   \tl_set:Nn \l_ebnf_tl { }
   \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
@@ -313,6 +330,8 @@
     {\c{ebnf at nonterminal}{\1}} \l__ebnf_tmp_tl%
   \regex_replace_all:nnN { "(.+?)" }%
     {\c{ebnf at terminal}{\1}} \l__ebnf_tmp_tl%
+  \regex_replace_all:nnN { '(.+?)' }%
+    {\c{ebnf at sterminal}{\1}} \l__ebnf_tmp_tl%
   \regex_replace_all:nnN { \|(\|) }%
     {\c{makebox}[#1][r]{ \1 }} \l__ebnf_tmp_tl%
   \regex_replace_all:nnN { \| }%

Modified: trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty	2023-05-27 20:23:26 UTC (rev 67233)
+++ trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty	2023-05-27 20:23:48 UTC (rev 67234)
@@ -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 at optional[1]
   {\ebnf at color{gray}{[}#1\ebnf at color{gray}{]}}
 \newcommand\ebnf at repetition[1]
@@ -91,6 +95,11 @@
   \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
   \terminal{\l_ebnf_tl}
 }
+\newcommand\ebnf at sterminal[1]{
+  \tl_set:Nn \l_ebnf_tl { }
+  \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
+  \sterminal{\l_ebnf_tl}
+}
 \newcommand\ebnf at nonterminal[1]{
   \tl_set:Nn \l_ebnf_tl { }
   \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
@@ -121,6 +130,8 @@
     {\c{ebnf at nonterminal}{\1}} \l__ebnf_tmp_tl%
   \regex_replace_all:nnN { "(.+?)" }%
     {\c{ebnf at terminal}{\1}} \l__ebnf_tmp_tl%
+  \regex_replace_all:nnN { '(.+?)' }%
+    {\c{ebnf at sterminal}{\1}} \l__ebnf_tmp_tl%
   \regex_replace_all:nnN { \|(\|) }%
     {\c{makebox}[#1][r]{ \1 }} \l__ebnf_tmp_tl%
   \regex_replace_all:nnN { \| }%



More information about the tex-live-commits mailing list.