summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-12-28 22:32:43 +0000
committerKarl Berry <karl@freefriends.org>2020-12-28 22:32:43 +0000
commit1933be51c625ec25039db7f381bd84abdeeadee5 (patch)
treed7e33825717d67a98dc52f027a13529ebcbeda7b
parent3f516ebc134388ce112da396f5fa48763112c68a (diff)
expkv (28dec20)
git-svn-id: svn://tug.org/texlive/trunk@57247 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/expkv/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/expkv/expkv.pdfbin410888 -> 411252 bytes
-rw-r--r--Master/texmf-dist/source/latex/expkv/expkv.dtx235
-rw-r--r--Master/texmf-dist/tex/generic/expkv/expkv.tex183
4 files changed, 173 insertions, 247 deletions
diff --git a/Master/texmf-dist/doc/latex/expkv/README.md b/Master/texmf-dist/doc/latex/expkv/README.md
index 730b302b5a4..beeba1ca09d 100644
--- a/Master/texmf-dist/doc/latex/expkv/README.md
+++ b/Master/texmf-dist/doc/latex/expkv/README.md
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv -- an expandable key=val implementation
-Version 2020-10-10 v1.5
+Version 2020-12-28 v1.6
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
diff --git a/Master/texmf-dist/doc/latex/expkv/expkv.pdf b/Master/texmf-dist/doc/latex/expkv/expkv.pdf
index 4396ddfee2f..ba39085660b 100644
--- a/Master/texmf-dist/doc/latex/expkv/expkv.pdf
+++ b/Master/texmf-dist/doc/latex/expkv/expkv.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/expkv/expkv.dtx b/Master/texmf-dist/source/latex/expkv/expkv.dtx
index 3cd8479be56..d3fc414f393 100644
--- a/Master/texmf-dist/source/latex/expkv/expkv.dtx
+++ b/Master/texmf-dist/source/latex/expkv/expkv.dtx
@@ -423,29 +423,40 @@ and the derived files expkv.pdf
%
% \begin{function}{\ekvparse}
% \begin{syntax}
-% \cs{ekvparse}\meta{cs1}\meta{cs2}\{\kv,\ldots\}
+% \cs{ekvparse}\marg{code1}\marg{code2}\{\kv,\ldots\}
% \end{syntax}
% This macro parses the \kv\ pairs and provides those list elements which are
-% only keys as the argument to \meta{cs1}, and those which are a \kv\ pair to
-% \meta{cs2} as two arguments. It is fully expandable as well and returns the
-% parsed list in |\unexpanded|, which has no effect outside of an |\expanded|
-% or |\edef| context\footnotemark.
+% only keys as an argument to \meta{code1}, and those which are a \kv\ pair
+% to \meta{code2} as two arguments. It is fully expandable as well and returns
+% each element of the parsed list in |\unexpanded|, which has no effect
+% outside of an |\expanded| or |\edef| context\footnotemark.
% If you need control over the necessary steps of expansion you
-% can use |\expanded| around it.
+% can use |\expanded| around it. You can use multiple tokens in \meta{code1}
+% and \meta{code2} or just a single control sequence name. In both cases the
+% found \key\ and \val\ are provided as a brace group following them.
%
% |\ekvbreak|, |\ekvsneak|, and |\ekvchangeset| and their relatives don't work
% in |\ekvparse|. It is analogue to \pkg{expl3}'s |\keyval_parse:NNn|, but
% not with the same parsing rules -- |\keyval_parse:NNn| throws an error on
% multiple equal signs per \kv\ pair and on empty \key\ names in a \kv\ pair,
% both of which |\ekvparse| doesn't deal with.
+% \end{function}
+% \footnotetext
+% {^^A
+% This is a change in behaviour, previously (v0.3 and before) \cs{ekvparse}
+% would expand in exactly two steps. This isn't always necessary, but makes
+% the parsing considerably slower. If this is necessary for your application
+% you can put an \cs[no-index]{expanded} around it and will still be faster
+% since you need only a single \cs[no-index]{expandafter} this way.^^A
+% }
%
% As a small example:
% \begin{lstlisting}
-% \ekvparse\handlekey\handlekeyval{foo = bar, key, baz={zzz}}
+% \ekvparse{\handlekey{S}}{\handlekeyval{S}}{foo = bar, key, baz={zzz}}
% \end{lstlisting}
-% would expand to
+% would be equivalent to
% \begin{lstlisting}
-% \handlekeyval{foo}{bar}\handlekey{key}\handlekeyval{baz}{zzz}
+% \handlekeyval{S}{foo}{bar}\handlekey{S}{key}\handlekeyval{S}{baz}{zzz}
% \end{lstlisting}
% and afterwards |\handlekey| and |\handlekeyval| would have to further handle
% the \key. There are no macros like these two contained in \expkv, you have
@@ -460,15 +471,6 @@ and the derived files expkv.pdf
% \begin{lstlisting}
% \handle\kv{foo}{bar}\k{key}\kv{baz}{zzz}
% \end{lstlisting}
-% \end{function}
-% \footnotetext
-% {^^A
-% This is a change in behaviour, previously (v0.3 and before) \cs{ekvparse}
-% would expand in exactly two steps. This isn't always necessary, but makes
-% the parsing considerably slower. If this is necessary for your application
-% you can put an \cs[no-index]{expanded} around it and will still be faster
-% since you need only a single \cs[no-index]{expandafter} this way.^^A
-% }.
%
% \subsection{Miscellaneous}
%
@@ -1082,8 +1084,8 @@ and the derived files expkv.pdf
% \begin{macro}{\ekvVersion,\ekvDate}
% We're on our first input, so lets store the version and date in a macro.
% \begin{macrocode}
-\def\ekvVersion{1.5}
-\def\ekvDate{2020-10-10}
+\def\ekvVersion{1.6}
+\def\ekvDate{2020-12-28}
% \end{macrocode}
% \end{macro}
%
@@ -1262,25 +1264,30 @@ and the derived files expkv.pdf
##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@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}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\ekv@expB@unbraceA,\ekv@expB@unbraceA@}
-% To reduce some code doublets while gaining some speed, it is often useful to
-% expand the first token in a definition once. Let's define a wrapper for this.
+% \begin{macro}[internal]
+% {\ekv@exparg,\ekv@exparg@,\ekv@expargtwice,\ekv@expargtwice@,\ekv@zero}
+% To reduce some code doublets while gaining some speed (and also as convenience
+% for other packages in the family), it is often useful to expand the first
+% token in a definition once. Let's define a wrapper for this.
+%
+% Also, to end a |\romannumeral| expansion, we want to use |\z@|, which is
+% contained in both plain \TeX\ and \LaTeX, but we use a private name for it to
+% make it easier to spot and hence easier to manage.
% \begin{macrocode}
-\long\def\ekv@expB@unbraceA#1#2%
- {%
- \expandafter\ekv@expB@unbraceA@\expandafter{#2}{#1}%
- }
-\long\def\ekv@expB@unbraceA@#1#2{#2{#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}
% \end{macrocode}
% \end{macro}
%
@@ -1294,7 +1301,7 @@ and the derived files expkv.pdf
\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}
% \end{macrocode}
% \end{macro}
%
@@ -1340,16 +1347,16 @@ and the derived files expkv.pdf
}%
\unexpanded{\@gobble}%
}
-\ekv@expB@unbraceA{\protected\def\ekv@checkvalid#1#2}{\ekv@checkvalid}%
+\ekv@exparg{\protected\def\ekv@checkvalid#1#2}{\ekv@checkvalid}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ekvifdefined,\ekvifdefinedNoVal}
% And provide user-level macros to test whether a key is defined.
% \begin{macrocode}
-\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefined#1#2}}%
+\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}}
% \end{macrocode}
% \end{macro}
@@ -1372,27 +1379,27 @@ and the derived files expkv.pdf
{#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%
{%
@@ -1441,16 +1448,14 @@ and the derived files expkv.pdf
}%
\unexpanded{\fi}%
}
-\ekv@expB@unbraceA{\protected\def\ekv@defsetmacro#1#2}{\ekv@defsetmacro}
+\ekv@exparg{\protected\def\ekv@defsetmacro#1#2}{\ekv@defsetmacro}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ekvifdefinedset}
% \begin{macrocode}
-\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefinedset#1}}%
- {%
- \expandafter\ekv@ifdefined\expandafter{\ekv@undefined@set{#1}}%
- }
+\ekv@expargtwice{\def\ekvifdefinedset#1}%
+ {\expandafter\ekv@ifdefined\expandafter{\ekv@undefined@set{#1}}}
% \end{macrocode}
% \end{macro}
%
@@ -1466,7 +1471,7 @@ and the derived files expkv.pdf
\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
@@ -1515,14 +1520,8 @@ and the derived files expkv.pdf
% fast branching based on \TeX's argument grabbing rules and we don't have to
% split after the branching if the equal sign was there.
% \begin{macrocode}
-\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}
% \end{macrocode}
% \end{macro}
%
@@ -1568,7 +1567,7 @@ and the derived files expkv.pdf
% needed to delimit |\ekv@set@pair|'s argument anyway, so we just leave it
% there.
% \begin{macrocode}
-\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
@@ -1585,7 +1584,7 @@ and the derived files expkv.pdf
% |##2| everything that remains until the first found other equal sign. It has
% to reinsert the equal sign and forward things to |\ekv@set@pair|.
% \begin{macrocode}
-\ekv@expB@unbraceA
+\ekv@exparg
{%
\long\def\ekv@set@eq@other@active
##1\ekv@stop##2\ekv@nil#2\ekv@mark
@@ -1610,11 +1609,9 @@ and the derived files expkv.pdf
% If an active equal sign was found in |\ekv@set@eq@active| we'll have to pass
% the now split \kv\ pair on to |\ekv@set@pair|.
% \begin{macrocode}
-\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}
% \end{macrocode}
% \end{macro}
%
@@ -1635,21 +1632,16 @@ and the derived files expkv.pdf
\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}
% \end{macrocode}
% \end{macro}
%
@@ -1679,14 +1671,8 @@ and the derived files expkv.pdf
% One last thing we want to do for |\ekvset| is to provide macros that just
% smuggle stuff after |\ekvset|'s effects.
% \begin{macrocode}
-\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\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}}
% \end{macrocode}
% \end{macro}
%
@@ -1697,10 +1683,7 @@ and the derived files expkv.pdf
% |\unexpanded| here and there instead of other macros to stop the |\expanded|
% on our output.
% \begin{macrocode}
-\long\def\ekvparse##1##2##3%
- {%
- \ekv@parse##1##2\ekv@mark##3#1\ekv@stop#1%
- }
+\long\def\ekvparse##1##2##3{\ekv@parse{##1}{##2}\ekv@mark##3#1\ekv@stop#1}
% \end{macrocode}
% \end{macro}
%
@@ -1709,7 +1692,7 @@ and the derived files expkv.pdf
\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,%
}
% \end{macrocode}
% \end{macro}
@@ -1729,7 +1712,7 @@ and the derived files expkv.pdf
\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
}
% \end{macrocode}
@@ -1742,7 +1725,7 @@ and the derived files expkv.pdf
\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
@@ -1754,7 +1737,7 @@ and the derived files expkv.pdf
%
% \begin{macro}[internal]{\ekv@parse@eq@other@active}
% \begin{macrocode}
-\ekv@expB@unbraceA
+\ekv@exparg
{%
\long\def\ekv@parse@eq@other@active
##1\ekv@stop##2\ekv@nil#2\ekv@mark
@@ -1772,11 +1755,9 @@ and the derived files expkv.pdf
\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}
% \end{macrocode}
% \end{macro}
%
@@ -1791,21 +1772,16 @@ and the derived files expkv.pdf
}%
\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}
% \end{macrocode}
% \end{macro}
%
@@ -1821,24 +1797,22 @@ and the derived files expkv.pdf
%
% \begin{macro}[internal]{\ekv@parse@pair,\ekv@parse@pair@}
% \begin{macrocode}
-\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}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\ekv@parse@key}
% \begin{macrocode}
-\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}%
}
% \end{macrocode}
% \end{macro}
@@ -1861,8 +1835,7 @@ and the derived files expkv.pdf
\unexpanded{\ekvsneak{#2}}%
\unexpanded\expandafter{\ekvset{#1}{#3}}%
}
-\ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def\ekvsetSneaked#1#2#3}}%
- {\ekvsetSneaked}
+\ekv@expargtwice{\long\def\ekvsetSneaked#1#2#3}{\ekvsetSneaked}
% \end{macrocode}
% \end{macro}
%
@@ -1875,7 +1848,7 @@ and the derived files expkv.pdf
% switch out the set expandably, so this works similar to the |\ekvsneak| macros
% reading and reinserting the remainder of the \kv\ list.
% \begin{macrocode}
-\ekv@expB@unbraceA{\def\ekvchangeset#1}%
+\ekv@exparg{\def\ekvchangeset#1}%
{%
\expandafter\expandafter\expandafter
\ekv@changeset\expandafter\csname\ekv@undefined@set{#1}\endcsname\ekv@empty
@@ -1888,10 +1861,7 @@ and the derived files expkv.pdf
% leading |\ekv@empty| so that braces aren't stripped accidentally, but that
% will not hurt and just expand to nothing in one step.
% \begin{macrocode}
-\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}
% \end{macrocode}
% \end{macro}
%
@@ -1964,7 +1934,7 @@ and the derived files expkv.pdf
\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}
% \end{macrocode}
% \end{macro}
@@ -2028,13 +1998,13 @@ and the derived files expkv.pdf
% \begin{macro}{\ekvsetdef}
% Provide a macro to define a shorthand to use |\ekvset| on a specified \set.
% To gain the maximum speed |\ekvset| is expanded twice by
-% |\ekv@expB@unbraceA| so that during runtime the macro storing the set name
+% |\ekv@exparg| so that during runtime the macro storing the set name
% is already built and one |\expandafter| doesn't have to be used.
% \begin{macrocode}
-\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}}%
}
% \end{macrocode}
@@ -2044,16 +2014,16 @@ and the derived files expkv.pdf
% And do the same for |\ekvsetSneaked| in the two possible ways, with a fixed
% sneaked argument and with a flexible one.
% \begin{macrocode}
-\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}}%
}
% \end{macrocode}
@@ -2090,12 +2060,9 @@ and the derived files expkv.pdf
% \begin{macrocode}
\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}}
% \end{macrocode}
% \end{macro}
%
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
%%
%%