texlive[65723] Master/texmf-dist: naive-ebnf (3feb23)
commits+karl at tug.org
commits+karl at tug.org
Fri Feb 3 23:06:02 CET 2023
Revision: 65723
http://tug.org/svn/texlive?view=revision&revision=65723
Author: karl
Date: 2023-02-03 23:06:02 +0100 (Fri, 03 Feb 2023)
Log Message:
-----------
naive-ebnf (3feb23)
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-02-03 22:05:49 UTC (rev 65722)
+++ trunk/Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx 2023-02-03 22:06:02 UTC (rev 65723)
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{naive-ebnf}
%<*package>
-[2023-01-30 0.0.3 EBNF in Plain Text]
+[2023-02-03 0.0.4 EBNF in Plain Text]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -90,7 +90,7 @@
% \usepackage{mathtools}
% \begin{document}
% \begin{ebnf}
-% <Expr> := <Var>
+% <$\lambda$-Expr> := <Var>
% | "$\lambda$" <Var> "." <Expr>
% | "$\lparen$" <Expr> <Expr> "$\rparen$"
% \end{ebnf}
@@ -136,7 +136,7 @@
% \end{document}
% \end{docshot}
% It's possible to use them in math-mode too, for example:
-% \docshotOptions{firstline=6,lastline=8}
+% \docshotOptions{firstline=6,lastline=9}
% \begin{docshot}
% \documentclass{article}
% \pagestyle{empty}
@@ -143,7 +143,8 @@
% \usepackage[paperwidth=3in]{geometry}
% \usepackage{naive-ebnf}
% \begin{document}
-% If $\terminal{(} f_1 \nonterminal{Var}
+% If $\terminal{(} f_1
+% \nonterminal{$\lambda$-Var}
% \terminal{)}$ is always true, then
% $f_1$ is a tautology.
% \end{document}
@@ -243,6 +244,11 @@
\tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
\terminal{\l_ebnf_tl}
}
+\newcommand\ebnf at nonterminal[1]{
+ \tl_set:Nn \l_ebnf_tl { }
+ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
+ \nonterminal{\l_ebnf_tl}
+}
\ExplSyntaxOff
\newcommand\ebnf at to
{\ebnf at color{gray}{\(\to\)}}
@@ -253,6 +259,7 @@
% \end{macrocode}
% \begin{macro}{ebnf}
+% \changes{0.0.4}{2023/02/03}{Any symbols are allowed inside \texttt{\char`\\nonterminal} commands and inside the \texttt{ebnf} environment, where non-terminals are mentioned.}
% Then, we define the |ebnf| environment:
% \begin{macrocode}
\ExplSyntaxOn
@@ -267,8 +274,8 @@
{\c{ebnf at grouping}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { \[([^\]]+?)\] }
{\c{ebnf at optional}{\1}} \l__ebnf_tmp_tl
- \regex_replace_all:nnN { <([A-Za-z][a-z-]+)> }
- {\c{nonterminal}{\1}} \l__ebnf_tmp_tl
+ \regex_replace_all:nnN { <([^>]+)> }
+ {\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 { \^^M\s*\| }
Modified: trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty 2023-02-03 22:05:49 UTC (rev 65722)
+++ trunk/Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty 2023-02-03 22:06:02 UTC (rev 65723)
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{naive-ebnf}
-[2023-01-30 0.0.3 EBNF in Plain Text]
+[2023-02-03 0.0.4 EBNF in Plain Text]
@@ -87,6 +87,11 @@
\tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
\terminal{\l_ebnf_tl}
}
+\newcommand\ebnf at nonterminal[1]{
+ \tl_set:Nn \l_ebnf_tl { }
+ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
+ \nonterminal{\l_ebnf_tl}
+}
\ExplSyntaxOff
\newcommand\ebnf at to
{\ebnf at color{gray}{\(\to\)}}
@@ -107,8 +112,8 @@
{\c{ebnf at grouping}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { \[([^\]]+?)\] }
{\c{ebnf at optional}{\1}} \l__ebnf_tmp_tl
- \regex_replace_all:nnN { <([A-Za-z][a-z-]+)> }
- {\c{nonterminal}{\1}} \l__ebnf_tmp_tl
+ \regex_replace_all:nnN { <([^>]+)> }
+ {\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 { \^^M\s*\| }
More information about the tex-live-commits
mailing list.