diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/naive-ebnf/naive-ebnf.pdf | bin | 591999 -> 631010 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/naive-ebnf/naive-ebnf.dtx | 49 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/naive-ebnf/naive-ebnf.sty | 33 |
3 files changed, 53 insertions, 29 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 96b2f8a7d3d..d15fe959a64 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 8f7768f156e..d3105b2b875 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-05-27 0.0.6 EBNF in Plain Text] +[2023-06-30 0.0.7 EBNF in Plain Text] %</package> %<*driver> \documentclass{ltxdoc} @@ -133,7 +133,7 @@ % \begin{ebnf}[1.5in] % <VeryLongVariable> := <X> | <Y> \\ % <X> := "X" 'EOL' \\ -% <Y> := "Y" +% <Y> := "Y" \\ % \end{ebnf} % \end{document} % \end{docshot} @@ -171,6 +171,21 @@ % \end{document} % \end{docshot} +% Special symbols are interpreted correctly, if they stay inside quotes: +% \docshotOptions{} +% \begin{docshot} +% \documentclass{minimal} +% \usepackage[T1]{fontenc} +% \usepackage{naive-ebnf} +% \begin{document}\noindent +% \begin{ebnf}[1.5in] +% <X> := 'EOL' "'" "|" \\ +% <Y> := ">" "<" "]" "[" \\ +% <Z> := "\LaTeX" "\textdollar" \\ +% \end{ebnf} +% \end{document} +% \end{docshot} + % \section{Package Options} % It's possible to configure the behavior of the package with the help of a few package options: @@ -215,7 +230,6 @@ bw/.store in=\ebnf@bw, trail/.store in=\ebnf@trail, trail/.default=naive-ebnf.tmp.tex, - trail } \ProcessPgfPackageOptions{/ebnf} % \end{macrocode} @@ -257,10 +271,10 @@ % Then, we a command to render a single non-terminal: % \begin{macrocode} \makeatletter -\newcommand\nonterminal[1]{% +\newcommand\nonterminal[1]{{% \ebnf@color{gray}{\relax\ifmmode\langle\else\(\langle\)\fi}% \relax\ifmmode\textsf{#1}\else{\sffamily#1}\fi% - \ebnf@color{gray}{\relax\ifmmode\rangle\else\(\rangle\)\fi}} + \ebnf@color{gray}{\relax\ifmmode\rangle\else\(\rangle\)\fi}}} \makeatother % \end{macrocode} % \end{macro} @@ -270,7 +284,7 @@ % Then, we a command to render a single non-terminal: % \begin{macrocode} \makeatletter -\newcommand\sterminal[1]{\relax\ifmmode\else\ttfamily\fi#1}% +\newcommand\sterminal[1]{{\relax\ifmmode\else\ttfamily\fi#1}}% \makeatother % \end{macrocode} % \end{macro} @@ -286,18 +300,18 @@ {\ebnf@color{gray}{(}#1\ebnf@color{gray}{)}} \ExplSyntaxOn \newcommand\ebnf@terminal[1]{ - \tl_set:Nn \l_ebnf_tl { } - \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } + \tl_set:Nn \l_ebnf_tl {} + \tl_set_rescan:Nnn \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 } + \tl_set:Nn \l_ebnf_tl {} + \tl_set_rescan:Nnn \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 } + \tl_set:Nn \l_ebnf_tl {} + \tl_set_rescan:Nnn \l_ebnf_tl {} { #1 } \nonterminal{\l_ebnf_tl} } \ExplSyntaxOff @@ -318,11 +332,16 @@ \NewDocumentEnvironment{ebnf}{O{4em}+b} {\tl_set:Nn\l__ebnf_tmp_tl{#2}} {% - \regex_replace_all:nnN { \{(.+?)\} }% + \regex_replace_all:nnN { ([^\ ])< } {\1\\textless{}} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { >([^\ ]) } {\\textgreater{}\1} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { ([^\ ])'([^\ ]) } {\1\\textquotesingle{}\2} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { ([^\ ])\|([^\ ]) } {\1\\textbar{}\2} \l__ebnf_tmp_tl% + % + \regex_replace_all:nnN { \{\ (.+?)\ \} }% {\c{ebnf@repetition}{\1}} \l__ebnf_tmp_tl% - \regex_replace_all:nnN { \((.+?)\) }% + \regex_replace_all:nnN { \(\ (.+?)\ \) }% {\c{ebnf@grouping}{\1}} \l__ebnf_tmp_tl% - \regex_replace_all:nnN { \[(.+?)\] }% + \regex_replace_all:nnN { \[\ (.+?)\ \] }% {\c{ebnf@optional}{\1}} \l__ebnf_tmp_tl% \regex_replace_all:nnN { (<[^>]+?>\ :=) }% {\c{makebox}[#1][r]{\1}} \l__ebnf_tmp_tl% 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 1576491b599..3cf36a048d7 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,8 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{naive-ebnf} -[2023-05-27 0.0.6 EBNF in Plain Text] +[2023-06-30 0.0.7 EBNF in Plain Text] + @@ -50,7 +51,6 @@ bw/.store in=\ebnf@bw, trail/.store in=\ebnf@trail, trail/.default=naive-ebnf.tmp.tex, - trail } \ProcessPgfPackageOptions{/ebnf} @@ -72,14 +72,14 @@ \makeatother \makeatletter -\newcommand\nonterminal[1]{% +\newcommand\nonterminal[1]{{% \ebnf@color{gray}{\relax\ifmmode\langle\else\(\langle\)\fi}% \relax\ifmmode\textsf{#1}\else{\sffamily#1}\fi% - \ebnf@color{gray}{\relax\ifmmode\rangle\else\(\rangle\)\fi}} + \ebnf@color{gray}{\relax\ifmmode\rangle\else\(\rangle\)\fi}}} \makeatother \makeatletter -\newcommand\sterminal[1]{\relax\ifmmode\else\ttfamily\fi#1}% +\newcommand\sterminal[1]{{\relax\ifmmode\else\ttfamily\fi#1}}% \makeatother \makeatletter @@ -91,18 +91,18 @@ {\ebnf@color{gray}{(}#1\ebnf@color{gray}{)}} \ExplSyntaxOn \newcommand\ebnf@terminal[1]{ - \tl_set:Nn \l_ebnf_tl { } - \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } + \tl_set:Nn \l_ebnf_tl {} + \tl_set_rescan:Nnn \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 } + \tl_set:Nn \l_ebnf_tl {} + \tl_set_rescan:Nnn \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 } + \tl_set:Nn \l_ebnf_tl {} + \tl_set_rescan:Nnn \l_ebnf_tl {} { #1 } \nonterminal{\l_ebnf_tl} } \ExplSyntaxOff @@ -118,11 +118,16 @@ \NewDocumentEnvironment{ebnf}{O{4em}+b} {\tl_set:Nn\l__ebnf_tmp_tl{#2}} {% - \regex_replace_all:nnN { \{(.+?)\} }% + \regex_replace_all:nnN { ([^\ ])< } {\1\\textless{}} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { >([^\ ]) } {\\textgreater{}\1} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { ([^\ ])'([^\ ]) } {\1\\textquotesingle{}\2} \l__ebnf_tmp_tl% + \regex_replace_all:nnN { ([^\ ])\|([^\ ]) } {\1\\textbar{}\2} \l__ebnf_tmp_tl% + % + \regex_replace_all:nnN { \{\ (.+?)\ \} }% {\c{ebnf@repetition}{\1}} \l__ebnf_tmp_tl% - \regex_replace_all:nnN { \((.+?)\) }% + \regex_replace_all:nnN { \(\ (.+?)\ \) }% {\c{ebnf@grouping}{\1}} \l__ebnf_tmp_tl% - \regex_replace_all:nnN { \[(.+?)\] }% + \regex_replace_all:nnN { \[\ (.+?)\ \] }% {\c{ebnf@optional}{\1}} \l__ebnf_tmp_tl% \regex_replace_all:nnN { (<[^>]+?>\ :=) }% {\c{makebox}[#1][r]{\1}} \l__ebnf_tmp_tl% |