summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-02-03 22:06:02 +0000
committerKarl Berry <karl@freefriends.org>2023-02-03 22:06:02 +0000
commitb0a15dc509283b0c9875d5600471468471369c2d (patch)
tree99ae4ebbac5a0f352262a2cf85757cc93943ee5d /Master
parentb8fde89c617bfc6ab70fc54a64c50ef744545670 (diff)
naive-ebnf (3feb23)
git-svn-id: svn://tug.org/texlive/trunk@65723 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdfbin542463 -> 542835 bytes
-rw-r--r--Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx19
-rw-r--r--Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty11
3 files changed, 21 insertions, 9 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
index cfb0270b4c7..cd63e8dc841 100644
--- a/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf
+++ b/Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf
Binary files differ
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 cdd047a30f0..a69bc2f578a 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-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,14 +136,15 @@
% \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}
% \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@nonterminal[1]{
+ \tl_set:Nn \l_ebnf_tl { }
+ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
+ \nonterminal{\l_ebnf_tl}
+}
\ExplSyntaxOff
\newcommand\ebnf@to
{\ebnf@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@grouping}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { \[([^\]]+?)\] }
{\c{ebnf@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@nonterminal}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { "([^"]+)" }
{\c{ebnf@terminal}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { \^^M\s*\| }
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 f5266d4888e..549ea50b16d 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-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@nonterminal[1]{
+ \tl_set:Nn \l_ebnf_tl { }
+ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 }
+ \nonterminal{\l_ebnf_tl}
+}
\ExplSyntaxOff
\newcommand\ebnf@to
{\ebnf@color{gray}{\(\to\)}}
@@ -107,8 +112,8 @@
{\c{ebnf@grouping}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { \[([^\]]+?)\] }
{\c{ebnf@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@nonterminal}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { "([^"]+)" }
{\c{ebnf@terminal}{\1}} \l__ebnf_tmp_tl
\regex_replace_all:nnN { \^^M\s*\| }