summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/naive-ebnf
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-02-04 03:02:04 +0000
committerNorbert Preining <norbert@preining.info>2023-02-04 03:02:04 +0000
commitdc612812fbda1ab7fc28a6c80576bb1e8aae6ff2 (patch)
tree8dbf434ccbeee7e1c12016220d4d190cc2361f13 /macros/latex/contrib/naive-ebnf
parent51763fb353423ea7fb93ae80e06803d0dbcea834 (diff)
CTAN sync 202302040302
Diffstat (limited to 'macros/latex/contrib/naive-ebnf')
-rw-r--r--macros/latex/contrib/naive-ebnf/naive-ebnf.dtx19
-rw-r--r--macros/latex/contrib/naive-ebnf/naive-ebnf.pdfbin542463 -> 542835 bytes
2 files changed, 13 insertions, 6 deletions
diff --git a/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx b/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx
index cdd047a30f..a69bc2f578 100644
--- a/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx
+++ b/macros/latex/contrib/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/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf b/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf
index cfb0270b4c..cd63e8dc84 100644
--- a/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf
+++ b/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf
Binary files differ