diff options
author | Karl Berry <karl@freefriends.org> | 2020-12-28 22:32:43 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-12-28 22:32:43 +0000 |
commit | 1933be51c625ec25039db7f381bd84abdeeadee5 (patch) | |
tree | d7e33825717d67a98dc52f027a13529ebcbeda7b /Master/texmf-dist/tex/generic | |
parent | 3f516ebc134388ce112da396f5fa48763112c68a (diff) |
expkv (28dec20)
git-svn-id: svn://tug.org/texlive/trunk@57247 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r-- | Master/texmf-dist/tex/generic/expkv/expkv.tex | 183 |
1 files changed, 71 insertions, 112 deletions
diff --git a/Master/texmf-dist/tex/generic/expkv/expkv.tex b/Master/texmf-dist/tex/generic/expkv/expkv.tex index 5897ca8c924..79cbaac18b9 100644 --- a/Master/texmf-dist/tex/generic/expkv/expkv.tex +++ b/Master/texmf-dist/tex/generic/expkv/expkv.tex @@ -39,8 +39,8 @@ \errmessage{expkv requires e-TeX} \expandafter\endinput \fi -\def\ekvVersion{1.5} -\def\ekvDate{2020-10-10} +\def\ekvVersion{1.6} +\def\ekvDate{2020-12-28} \csname ekv@tmp\endcsname \expandafter\chardef\csname ekv@tmp\endcsname=\catcode`\@ \catcode`\@=11 @@ -119,18 +119,17 @@ ##1\ekv@nil \ekv@mark#1% #1\ekv@nil - \ekv@stop }% \long\def\ekv@strip@a##1\ekv@mark#1{\ekv@strip@b##1\ekv@mark}% - \long\def\ekv@strip@b##1#1\ekv@nil {\ekv@strip@c##1\ekv@nil}% } \ekv@strip{ } -\long\def\ekv@strip@c\ekv@mark#1\ekv@nil\ekv@mark#2\ekv@nil\ekv@stop#3{#3{#1}} -\long\def\ekv@expB@unbraceA#1#2% - {% - \expandafter\ekv@expB@unbraceA@\expandafter{#2}{#1}% - } -\long\def\ekv@expB@unbraceA@#1#2{#2{#1}}% +\long\def\ekv@strip@b#1 \ekv@nil{\ekv@strip@c#1\ekv@nil} +\long\def\ekv@strip@c\ekv@mark#1\ekv@nil\ekv@mark#2\ekv@nil#3{#3{#1}} +\let\ekv@zero\z@ +\long\def\ekv@exparg#1#2{\expandafter\ekv@exparg@\expandafter{#2}{#1}} +\long\def\ekv@exparg@#1#2{#2{#1}}% +\long\def\ekv@expargtwice#1#2{\expandafter\ekv@expargtwice@\expandafter{#2}{#1}} +\def\ekv@expargtwice@{\expandafter\ekv@exparg@\expandafter} \def\ekv@name@set#1{ekv#1(} \def\ekv@name@key#1{#1)} \edef\ekv@name @@ -138,7 +137,7 @@ \unexpanded\expandafter{\ekv@name@set{#1}}% \unexpanded\expandafter{\ekv@name@key{\detokenize{#2}}}% } -\ekv@expB@unbraceA{\def\ekv@name#1#2}{\ekv@name} +\ekv@exparg{\def\ekv@name#1#2}{\ekv@name} \def\ekv@undefined@set#1{! expkv Error: Set `#1' undefined.} \edef\ekv@checkvalid {% @@ -161,10 +160,10 @@ }% \unexpanded{\@gobble}% } -\ekv@expB@unbraceA{\protected\def\ekv@checkvalid#1#2}{\ekv@checkvalid}% -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefined#1#2}}% +\ekv@exparg{\protected\def\ekv@checkvalid#1#2}{\ekv@checkvalid}% +\ekv@expargtwice{\def\ekvifdefined#1#2}% {\expandafter\ekv@ifdefined\expandafter{\ekv@name{#1}{#2}}} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefinedNoVal#1#2}}% +\ekv@expargtwice{\def\ekvifdefinedNoVal#1#2}% {\expandafter\ekv@ifdefined\expandafter{\ekv@name{#1}{#2}N}} \def\ekvdef#1#2#3#4% {% @@ -176,27 +175,27 @@ {#1{\expandafter\let\csname#2\endcsname##3#3}}% \protected\def\ekvletNoVal##1##2##3% {#1{\expandafter\let\csname#2N\endcsname##3#3}}% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% - \protected\long\def\ekvdefunknown##1##2}}}% + \ekv@expargtwice{\protected\long\def\ekvdefunknown##1##2}% {% - \expandafter\ekv@expB@unbraceA@\expandafter + \romannumeral + \expandafter\ekv@exparg@\expandafter {% \expandafter\expandafter\expandafter \def\expandafter\csname\ekv@name{##1}{}u\endcsname####1####2{##2}% #3% }% - {\ekv@checkvalid{##1}.}% + {\ekv@zero\ekv@checkvalid{##1}.}% }% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% - \protected\long\def\ekvdefunknownNoVal##1##2}}}% + \ekv@expargtwice{\protected\long\def\ekvdefunknownNoVal##1##2}% {% - \expandafter\ekv@expB@unbraceA@\expandafter + \romannumeral + \expandafter\ekv@exparg@\expandafter {% \expandafter\expandafter\expandafter \def\expandafter\csname\ekv@name{##1}{}uN\endcsname####1{##2}% #3% }% - {\ekv@checkvalid{##1}.}% + {\ekv@zero\ekv@checkvalid{##1}.}% }% \protected\def\ekvletkv##1##2##3##4% {% @@ -237,15 +236,13 @@ }% \unexpanded{\fi}% } -\ekv@expB@unbraceA{\protected\def\ekv@defsetmacro#1#2}{\ekv@defsetmacro} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefinedset#1}}% - {% - \expandafter\ekv@ifdefined\expandafter{\ekv@undefined@set{#1}}% - } +\ekv@exparg{\protected\def\ekv@defsetmacro#1#2}{\ekv@defsetmacro} +\ekv@expargtwice{\def\ekvifdefinedset#1}% + {\expandafter\ekv@ifdefined\expandafter{\ekv@undefined@set{#1}}} \begingroup \def\ekvset#1#2{% \endgroup -\ekv@expB@unbraceA{\long\def\ekvset##1##2}% +\ekv@exparg{\long\def\ekvset##1##2}% {% \expandafter\expandafter\expandafter \ekv@set\expandafter\csname\ekv@undefined@set{##1}\endcsname @@ -259,14 +256,8 @@ \long\def\ekv@endset \ekv@stop\ekv@set@other##1\ekv@mark\ekv@stop,\ekv@stop,##2% {##2} -\long\def\ekv@eq@other##1=##2\ekv@mark##3% - {% - ##3##1\ekv@stop\ekv@mark##2% - } -\long\def\ekv@eq@active##1#2##2\ekv@mark##3% - {% - ##3##1\ekv@stop\ekv@mark##2% - } +\long\def\ekv@eq@other##1=##2\ekv@mark##3{##3##1\ekv@stop\ekv@mark##2} +\long\def\ekv@eq@active##1#2##2\ekv@mark##3{##3##1\ekv@stop\ekv@mark##2} \long\def\ekv@set@other##1##2,% {% \ekv@gobble@from@mark@to@stop##2\ekv@endset@other\ekv@stop @@ -280,14 +271,14 @@ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@set@eq@other@active #2\ekv@mark\ekv@set@eq@other@b } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@set@eq@other@b ##1\ekv@nil\ekv@mark\ekv@set@eq@other@active\ekv@stop\ekv@mark ##2\ekv@nil=\ekv@mark\ekv@set@eq@active }% {\ekv@strip{##1}{\expandafter\ekv@set@pair\detokenize}\ekv@mark##2\ekv@nil} -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@set@eq@other@active ##1\ekv@stop##2\ekv@nil#2\ekv@mark @@ -300,11 +291,9 @@ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@set@eq@active@ #2\ekv@mark\ekv@set@noeq } -\ekv@expB@unbraceA +\ekv@exparg {\long\def\ekv@set@eq@active@##1\ekv@stop##2\ekv@nil#2\ekv@mark\ekv@set@noeq}% - {% - \ekv@strip{##1}{\expandafter\ekv@set@pair\detokenize}\ekv@mark##2\ekv@nil - } + {\ekv@strip{##1}{\expandafter\ekv@set@pair\detokenize}\ekv@mark##2\ekv@nil} \edef\ekv@set@noeq {% \unexpanded @@ -315,21 +304,16 @@ \unexpanded\expandafter {\ekv@strip{##1}{\expandafter\ekv@set@key\detokenize}\ekv@mark}% } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@set@noeq ##1\ekv@nil\ekv@mark\ekv@set@eq@active@\ekv@stop\ekv@mark }% {\ekv@set@noeq} -\def\ekv@set@was@blank##1% - {% - \def\ekv@set@was@blank - \ekv@ifempty@A\ekv@ifempty@B - \ekv@strip@a\ekv@mark####1\ekv@nil\ekv@mark##1##1\ekv@nil\ekv@stop - ####2\ekv@mark - {\ekv@set@other}% - } -\ekv@set@was@blank{ } +\expandafter\def\expandafter\ekv@set@was@blank + \expandafter\ekv@ifempty@A\expandafter\ekv@ifempty@B + \ekv@strip{\ekv@mark##1}##2\ekv@mark + {\ekv@set@other} \long\def\ekv@endset@other \ekv@stop \ekv@eq@other\ekv@mark\ekv@stop\ekv@nil\ekv@mark\ekv@set@eq@other@a @@ -338,22 +322,13 @@ \long\def\ekvbreak##1##2\ekv@stop#1##3{##1} \long\def\ekvbreakPreSneak ##1##2\ekv@stop#1##3{##1##3} \long\def\ekvbreakPostSneak##1##2\ekv@stop#1##3{##3##1} -\long\def\ekvsneak##1##2\ekv@stop#1##3% - {% - ##2\ekv@stop#1{##3##1}% - } -\long\def\ekvsneakPre##1##2\ekv@stop#1##3% - {% - ##2\ekv@stop#1{##1##3}% - } -\long\def\ekvparse##1##2##3% - {% - \ekv@parse##1##2\ekv@mark##3#1\ekv@stop#1% - } +\long\def\ekvsneak##1##2\ekv@stop#1##3{##2\ekv@stop#1{##3##1}} +\long\def\ekvsneakPre##1##2\ekv@stop#1##3{##2\ekv@stop#1{##1##3}} +\long\def\ekvparse##1##2##3{\ekv@parse{##1}{##2}\ekv@mark##3#1\ekv@stop#1} \long\def\ekv@parse##1##2##3#1% {% \ekv@gobble@from@mark@to@stop##3\ekv@endparse\ekv@stop - \ekv@parse@other##1##2##3,\ekv@stop,% + \ekv@parse@other{##1}{##2}##3,\ekv@stop,% } \long\def\ekv@endparse \ekv@stop\ekv@parse@other##1\ekv@mark\ekv@stop,\ekv@stop,% @@ -363,7 +338,7 @@ \ekv@gobble@from@mark@to@stop##3\ekv@endparse@other\ekv@stop \ekv@eq@other##3\ekv@nil\ekv@mark\ekv@parse@eq@other@a =\ekv@mark\ekv@parse@eq@active - ##1##2% + {##1}{##2}% \ekv@mark } \long\def\ekv@parse@eq@other@a##1\ekv@stop @@ -371,14 +346,14 @@ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@parse@eq@other@active #2\ekv@mark\ekv@parse@eq@other@b } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@parse@eq@other@b ##1\ekv@nil\ekv@mark\ekv@parse@eq@other@active\ekv@stop\ekv@mark ##2\ekv@nil=\ekv@mark\ekv@parse@eq@active }% {\ekv@strip{##1}\ekv@parse@pair##2\ekv@nil} -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@parse@eq@other@active ##1\ekv@stop##2\ekv@nil#2\ekv@mark @@ -391,11 +366,9 @@ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@parse@eq@active@ #2\ekv@mark\ekv@parse@noeq } -\ekv@expB@unbraceA +\ekv@exparg {\long\def\ekv@parse@eq@active@##1\ekv@stop##2#2\ekv@mark\ekv@parse@noeq}% - {% - \ekv@strip{##1}\ekv@parse@pair##2% - } + {\ekv@strip{##1}\ekv@parse@pair##2} \edef\ekv@parse@noeq {% \unexpanded @@ -405,39 +378,32 @@ }% \unexpanded\expandafter{\ekv@strip{##1}\ekv@parse@key}% } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@parse@noeq ##1\ekv@nil\ekv@mark\ekv@parse@eq@active@\ekv@stop\ekv@mark }% {\ekv@parse@noeq} -\def\ekv@parse@was@blank##1% - {% - \def\ekv@parse@was@blank - \ekv@ifempty@A\ekv@ifempty@B - \ekv@strip@a\ekv@mark####1\ekv@nil\ekv@mark##1##1\ekv@nil\ekv@stop - \ekv@parse@key - {\ekv@parse@other}% - } -\ekv@parse@was@blank{ } +\expandafter\def\expandafter\ekv@parse@was@blank + \expandafter\ekv@ifempty@A\expandafter\ekv@ifempty@B + \ekv@strip{\ekv@mark##1}\ekv@parse@key + {\ekv@parse@other} \long\def\ekv@endparse@other \ekv@stop \ekv@eq@other\ekv@mark\ekv@stop\ekv@nil\ekv@mark\ekv@parse@eq@other@a =\ekv@mark\ekv@parse@eq@active {\ekv@parse} -\ekv@expB@unbraceA{\long\def\ekv@parse@pair##1##2\ekv@nil}% - {% - \ekv@strip{##2}\ekv@parse@pair@{##1}% - } +\ekv@exparg{\long\def\ekv@parse@pair##1##2\ekv@nil}% + {\ekv@strip{##2}\ekv@parse@pair@{##1}} \long\def\ekv@parse@pair@##1##2##3##4% {% \unexpanded{##4{##2}{##1}}% - \ekv@parse@other##3##4% + \ekv@parse@other{##3}{##4}% } -\long\def\ekv@parse@key##1##2##3% +\long\def\ekv@parse@key##1##2% {% \unexpanded{##2{##1}}% - \ekv@parse@other##2##3% + \ekv@parse@other{##2}% } } \catcode`\,=13 @@ -448,17 +414,13 @@ \unexpanded{\ekvsneak{#2}}% \unexpanded\expandafter{\ekvset{#1}{#3}}% } -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def\ekvsetSneaked#1#2#3}}% - {\ekvsetSneaked} -\ekv@expB@unbraceA{\def\ekvchangeset#1}% +\ekv@expargtwice{\long\def\ekvsetSneaked#1#2#3}{\ekvsetSneaked} +\ekv@exparg{\def\ekvchangeset#1}% {% \expandafter\expandafter\expandafter \ekv@changeset\expandafter\csname\ekv@undefined@set{#1}\endcsname\ekv@empty } -\long\def\ekv@changeset#1#2\ekv@set@other#3% - {% - #2\ekv@set@other#1% - } +\long\def\ekv@changeset#1#2\ekv@set@other#3{#2\ekv@set@other#1} \ekv@if@lastnamedcs {% \long\def\ekv@set@pair#1\ekv@mark#2\ekv@nil#3% @@ -511,7 +473,7 @@ \fi \ekv@set@pair@d#1% } -\ekv@expB@unbraceA{\long\def\ekv@set@pair@d#1#2#3}{\ekv@strip{#2}#1} +\ekv@exparg{\long\def\ekv@set@pair@d#1#2#3}{\ekv@strip{#2}#1} \long\def\ekv@set@pair@e\fi\ekv@set@pair@d#1#2#3{\fi#3} \ekv@if@lastnamedcs {% @@ -560,22 +522,22 @@ \fi \@firstoftwo#1% } -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% -\protected\def\ekvsetdef#1#2}}}}% +\ekv@expargtwice{\protected\def\ekvsetdef#1#2}% {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def#1##1}}% + \romannumeral + \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1}}% {\ekvset{#2}{##1}}% } -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% -\protected\def\ekvsetSneakeddef#1#2}}}}% +\ekv@expargtwice{\protected\def\ekvsetSneakeddef#1#2}% {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def#1##1##2}}% + \romannumeral + \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1##2}}% {\ekvsetSneaked{#2}{##1}{##2}}% } -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% -\protected\def\ekvsetdefSneaked#1#2#3}}}}% +\ekv@expargtwice{\protected\def\ekvsetdefSneaked#1#2#3}% {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def#1##1}}% + \romannumeral + \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1}}% {\ekvsetSneaked{#2}{#3}{##1}}% } \begingroup @@ -593,12 +555,9 @@ \def\ekv@err@{\expandafter\ekv@gobbleto@stop} \long\def\ekv@err@common #1#2{\expandafter\ekv@err@common@\string#2{#1}} \long\def\ekv@err@common@#1`#2' #3.#4#5{\ekv@err{#4 (`#5', set `#2')}} -\ekv@expB@unbraceA{\long\def\ekv@err@unknown#1}% - {\ekv@err@common{unknown key}{#1}} -\ekv@expB@unbraceA{\long\def\ekv@err@noarg #1}% - {\ekv@err@common{value forbidden}{#1}} -\ekv@expB@unbraceA{\long\def\ekv@err@reqval #1}% - {\ekv@err@common{value required}{#1}} +\ekv@exparg{\long\def\ekv@err@unknown#1}{\ekv@err@common{unknown key}{#1}} +\ekv@exparg{\long\def\ekv@err@noarg #1}{\ekv@err@common{value forbidden}{#1}} +\ekv@exparg{\long\def\ekv@err@reqval #1}{\ekv@err@common{value required}{#1}} \catcode`\@=\ekv@tmp %% %% |