summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/expkv/expkv.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-11 22:21:50 +0000
committerKarl Berry <karl@freefriends.org>2020-04-11 22:21:50 +0000
commita028b56d2f5651b6aeefd34cc75b550617fa9989 (patch)
treed9cd6a7d466373dafb497b1f9c9e99cd7769b160 /Master/texmf-dist/tex/generic/expkv/expkv.tex
parent2ce8fab99cc0add24a98b8765b5324aa0fa3f573 (diff)
expkv (10apr20)
git-svn-id: svn://tug.org/texlive/trunk@54654 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/expkv/expkv.tex')
-rw-r--r--Master/texmf-dist/tex/generic/expkv/expkv.tex270
1 files changed, 148 insertions, 122 deletions
diff --git a/Master/texmf-dist/tex/generic/expkv/expkv.tex b/Master/texmf-dist/tex/generic/expkv/expkv.tex
index fc64fb4fac2..3e356834d73 100644
--- a/Master/texmf-dist/tex/generic/expkv/expkv.tex
+++ b/Master/texmf-dist/tex/generic/expkv/expkv.tex
@@ -30,17 +30,17 @@
%% expkv.sty
%% expkv.tex
%%
+\expandafter\ifx\csname ekvVersion\endcsname\relax
+\else
+ \expandafter\endinput
+\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname numexpr\endcsname\relax
\errmessage{expkv requires e-TeX}
\expandafter\endinput
\fi
-\expandafter\ifx\csname ekvVersion\endcsname\relax
-\else
- \expandafter\endinput
-\fi
-\def\ekvVersion{0.5a}
-\def\ekvDate{2020-02-27}
+\def\ekvVersion{1.2}
+\def\ekvDate{2020-04-10}
\csname ekv@tmp\endcsname
\expandafter\chardef\csname ekv@tmp\endcsname=\catcode`\@
\catcode`\@=11
@@ -51,6 +51,7 @@
\long\def\ekv@fi@secondoftwo\fi\@firstoftwo#1#2{\fi#2}
\long\def\ekv@gobbleto@stop#1\ekv@stop{}
\def\ekv@gobble@mark\ekv@mark{}
+\long\def\ekv@gobble@from@mark@to@stop\ekv@mark#1\ekv@stop{}
\long\def\ekv@ifempty#1%
{%
\ekv@ifempty@\ekv@ifempty@A#1\ekv@ifempty@B\ekv@ifempty@true
@@ -60,6 +61,11 @@
\long\def\ekv@ifempty@true\ekv@ifempty@A\ekv@ifempty@B\@secondoftwo#1#2{#1}
\long\def\ekv@ifempty@false\ekv@ifempty@A\ekv@ifempty@B\@firstoftwo#1#2{#2}
\long\def\ekv@ifempty@true@F\ekv@ifempty@A\ekv@ifempty@B\@firstofone#1{}
+\long\def\ekv@ifempty@true@F@gobble\ekv@ifempty@A\ekv@ifempty@B\@firstofone#1#2%
+ {}
+\long\def\ekv@ifempty@true@F@gobbletwo
+ \ekv@ifempty@A\ekv@ifempty@B\@firstofone#1#2#3%
+ {}
\long\def\ekv@ifblank@\ekv@mark#1{\ekv@ifempty@\ekv@ifempty@A}
\def\ekv@ifdefined#1%
{%
@@ -69,44 +75,6 @@
\fi
\@firstoftwo
}
- % \begin{macro}[internal]
-\def\ekv@ifdefined@pair#1#2%
- {%
- \expandafter\ekv@ifdefined@pair@
- \csname
- \ifcsname #1{#2}\endcsname
- #1{#2}%
- \else
- relax%
- \fi
- \endcsname
- }
-\def\ekv@ifdefined@pair@#1%
- {%
- \ifx#1\relax
- \ekv@fi@secondoftwo
- \fi
- \@firstoftwo
- {\ekv@set@pair@#1\ekv@mark}%
- }
-\def\ekv@ifdefined@key#1#2%
- {%
- \expandafter\ekv@ifdefined@key@
- \csname
- \ifcsname #1{#2}N\endcsname
- #1{#2}N%
- \else
- relax%
- \fi
- \endcsname
- }
-\def\ekv@ifdefined@key@#1%
- {%
- \ifx#1\relax
- \ekv@fi@secondoftwo
- \fi
- \@firstoftwo#1%
- }
\def\ekv@name#1#2{\ekv@name@set{#1}\ekv@name@key{#2}}
\def\ekv@name@set#1{ekv#1(}
\def\ekv@name@key#1{#1)}
@@ -135,7 +103,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\def\csname\ekv@name{#1}{#2}\endcsname##1{#3}%
- \ekv@defset{#1}%
+ \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\long\def\ekvdefNoVal#1#2#3%
@@ -143,7 +111,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\def\csname\ekv@name{#1}{#2}N\endcsname{#3}%
- \ekv@defset{#1}%
+ \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvlet#1#2#3%
@@ -151,7 +119,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\let\csname\ekv@name{#1}{#2}\endcsname#3%
- \ekv@defset{#1}%
+ \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvletNoVal#1#2#3%
@@ -159,7 +127,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\let\csname\ekv@name{#1}{#2}N\endcsname#3%
- \ekv@defset{#1}%
+ \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvletkv#1#2#3#4%
@@ -168,7 +136,7 @@
{%
\expandafter\let\csname\ekv@name{#1}{#2}\expandafter\endcsname
\csname\ekv@name{#3}{#4}\endcsname
- \ekv@defset{#1}%
+ \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvletkvNoVal#1#2#3#4%
@@ -177,13 +145,14 @@
{%
\expandafter\let\csname\ekv@name{#1}{#2}N\expandafter\endcsname
\csname\ekv@name{#3}{#4}N\endcsname
- \ekv@defset{#1}%
+ \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
-\protected\def\ekv@defset#1%
+\protected\def\ekv@defset#1#2%
{%
- \expandafter\edef\csname\ekv@undefined@set{#1}\endcsname##1%
- {\ekv@name@set{#1}\ekv@name@key{##1}}%
+ \ifx#1\relax
+ \edef#1##1{\ekv@name@set{#2}\ekv@name@key{##1}}%
+ \fi
}
\def\ekvset#1#2{%
\endgroup
@@ -194,49 +163,68 @@
}
\long\def\ekv@set##1##2#1%
{%
- \ekv@gobbleto@markstop##2\ekv@endset\ekv@mark\ekv@stop
+ \ekv@gobble@from@mark@to@stop##2\ekv@endset\ekv@stop
\ekv@set@other##1##2,\ekv@stop,%
\ekv@set##1\ekv@mark
}
\long\def\ekv@endset
- \ekv@mark\ekv@stop\ekv@set@other##1,\ekv@stop,\ekv@set##2\ekv@mark
+ \ekv@stop\ekv@set@other##1,\ekv@stop,\ekv@set##2\ekv@mark
##3%
{##3}
+\long\def\ekv@eq@other##1=##2\ekv@mark##3##4\ekv@stop
+ {%
+ ##3##1\ekv@stop\ekv@mark##2%
+ }
+\long\def\ekv@eq@active##1#2##2\ekv@mark##3##4\ekv@stop
+ {%
+ ##3##1\ekv@stop\ekv@mark##2%
+ }
\long\def\ekv@set@other##1##2,%
{%
- \ekv@gobbleto@markstop##2\ekv@endset@other\ekv@mark\ekv@stop
- \ekv@ifhas@eq@other##2=\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
- {\ekv@set@eq@other##1##2\ekv@stop}%
- {%
- \ekv@ifhas@eq@active##2#2\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
- {\ekv@set@eq@active##1##2\ekv@stop}%
- {%
- \ekv@ifblank@##2\ekv@nil\ekv@ifempty@B\ekv@ifempty@true@F
- \ekv@ifempty@A\ekv@ifempty@B\@firstofone
- {\ekv@strip{##2}\ekv@set@key##1}%
- }%
- }%
- \ekv@set@other##1\ekv@mark%
+ \ekv@gobble@from@mark@to@stop##2\ekv@endset@other\ekv@stop
+ \ekv@eq@other##2\ekv@nil\ekv@mark\ekv@set@eq@other@a
+ =\ekv@mark\ekv@set@eq@active\ekv@stop
+ ##1%
+ \ekv@set@other##1\ekv@mark
}
-\long\def\ekv@set@eq@other##1##2=%
+\long\def\ekv@set@eq@other@a##1\ekv@stop
{%
- \ekv@ifhas@eq@active##2#2\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
- {\ekv@set@eq@active##1##2=}%
- {\ekv@strip{##2}\ekv@set@pair##1}%
+ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@set@eq@other@active@a
+ #2\ekv@mark\ekv@set@eq@other@b\ekv@stop
}
-\long\def\ekv@set@eq@active##1##2#2%
+\long\def\ekv@set@eq@other@b
+ ##1\ekv@nil\ekv@mark\ekv@set@eq@other@active@a\ekv@stop\ekv@mark
{%
- \ekv@strip{##2}\ekv@set@pair##1%
+ \ekv@strip{##1}\ekv@set@pair
+ }
+\long\def\ekv@set@eq@other@active@a##1\ekv@stop##2\ekv@nil\ekv@mark
+ {%
+ \ekv@set@eq@other@active@b{##1}##2=%
+ }
+\long\def\ekv@set@eq@other@active@b##1%
+ {%
+ \ekv@strip{##1}\ekv@set@pair
+ }
+\long\def\ekv@set@eq@active
+ ##1\ekv@nil\ekv@mark\ekv@set@eq@other@a\ekv@stop\ekv@mark
+ {%
+ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@set@eq@active@
+ #2\ekv@mark\ekv@set@noeq\ekv@stop
+ }
+\long\def\ekv@set@eq@active@##1\ekv@stop
+ {%
+ \ekv@strip{##1}\ekv@set@pair
+ }
+\long\def\ekv@set@noeq##1\ekv@nil\ekv@mark\ekv@set@eq@active@\ekv@stop\ekv@mark
+ {%
+ \ekv@ifblank@##1\ekv@nil\ekv@ifempty@B\ekv@ifempty@true@F@gobble
+ \ekv@ifempty@A\ekv@ifempty@B\@firstofone
+ {\ekv@strip{##1}\ekv@set@key}%
}
-\long\def\ekv@ifhas@eq@other\ekv@mark##1={\ekv@ifempty@\ekv@ifempty@A}
-\long\def\ekv@ifhas@eq@active\ekv@mark##1#2{\ekv@ifempty@\ekv@ifempty@A}
\long\def\ekv@endset@other
- \ekv@mark\ekv@stop
- \ekv@ifhas@eq@other##1=\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
+ \ekv@stop
+ \ekv@eq@other##1\ekv@nil\ekv@mark\ekv@set@eq@other@a
+ =\ekv@mark\ekv@set@eq@active\ekv@stop
##2%
\ekv@set@other##3\ekv@mark
{}
@@ -257,58 +245,72 @@
}
\long\def\ekv@parse##1##2##3#1%
{%
- \ekv@gobbleto@markstop##3\ekv@endparse\ekv@mark\ekv@stop
+ \ekv@gobble@from@mark@to@stop##3\ekv@endparse\ekv@stop
\ekv@parse@other##1##2##3,\ekv@stop,%
\ekv@parse##1##2\ekv@mark
}
\long\def\ekv@endparse
- \ekv@mark\ekv@stop\ekv@parse@other##1,\ekv@stop,\ekv@parse##2\ekv@mark
+ \ekv@stop\ekv@parse@other##1,\ekv@stop,\ekv@parse##2\ekv@mark
{}
\long\def\ekv@parse@other##1##2##3,%
{%
- \ekv@gobbleto@markstop##3\ekv@endparse@other\ekv@mark\ekv@stop
- \ekv@ifhas@eq@other##3=\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
- {\ekv@parse@eq@other##3\ekv@stop##2}%
- {%
- \ekv@ifhas@eq@active##3#2\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
- {\ekv@parse@eq@active##3\ekv@stop##2}%
- {%
- \ekv@ifblank@##3\ekv@nil\ekv@ifempty@B\ekv@ifempty@true@F
- \ekv@ifempty@A\ekv@ifempty@B\@firstofone
- {\ekv@strip{##3}\ekv@parse@key##1}%
- }%
- }%
+ \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\ekv@stop
+ ##1##2%
\ekv@parse@other##1##2\ekv@mark
}
-\long\def\ekv@parse@eq@other##1=%
+\long\def\ekv@parse@eq@other@a##1\ekv@stop
+ {%
+ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@parse@eq@other@active@a
+ #2\ekv@mark\ekv@parse@eq@other@b\ekv@stop
+ }
+\long\def\ekv@parse@eq@other@b
+ ##1\ekv@nil\ekv@mark\ekv@parse@eq@other@active@a\ekv@stop\ekv@mark
+ {%
+ \ekv@strip{##1}\ekv@parse@pair
+ }
+\long\def\ekv@parse@eq@other@active@a##1\ekv@stop##2\ekv@nil\ekv@mark
{%
- \ekv@ifhas@eq@active##1#2\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
- {\ekv@parse@eq@active##1=}%
- {\ekv@strip{##1}\ekv@parse@pair\ekv@mark}%
+ \ekv@parse@eq@other@active@b{##1}##2=%
}
-\long\def\ekv@parse@eq@active##1#2%
+\long\def\ekv@parse@eq@other@active@b##1%
{%
- \ekv@strip{##1}\ekv@parse@pair\ekv@mark
+ \ekv@strip{##1}\ekv@parse@pair
+ }
+\long\def\ekv@parse@eq@active
+ ##1\ekv@nil\ekv@mark\ekv@parse@eq@other@a\ekv@stop\ekv@mark
+ {%
+ \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@parse@eq@active@
+ #2\ekv@mark\ekv@parse@noeq\ekv@stop
+ }
+\long\def\ekv@parse@eq@active@##1\ekv@stop
+ {%
+ \ekv@strip{##1}\ekv@parse@pair
+ }
+\long\def\ekv@parse@noeq
+ ##1\ekv@nil\ekv@mark\ekv@parse@eq@active@\ekv@stop\ekv@mark
+ {%
+ \ekv@ifblank@##1\ekv@nil\ekv@ifempty@B\ekv@ifempty@true@F@gobbletwo
+ \ekv@ifempty@A\ekv@ifempty@B\@firstofone
+ {\ekv@strip{##1}\ekv@parse@key}%
}
\long\def\ekv@endparse@other
- \ekv@mark\ekv@stop
- \ekv@ifhas@eq@other##1=\ekv@ifempty@B\ekv@ifempty@false
- \ekv@ifempty@A\ekv@ifempty@B\@firstoftwo
+ \ekv@stop
+ \ekv@eq@other##1\ekv@nil\ekv@mark\ekv@parse@eq@other@a
+ =\ekv@mark\ekv@parse@eq@active\ekv@stop
##2%
\ekv@parse@other##3\ekv@mark
{}
-\long\def\ekv@parse@pair##1##2\ekv@stop
+\long\def\ekv@parse@pair##1##2\ekv@nil
{%
\ekv@strip{##2}\ekv@parse@pair@{##1}%
}
-\long\def\ekv@parse@pair@##1##2##3%
+\long\def\ekv@parse@pair@##1##2##3##4%
{%
- \unexpanded{##3{##2}{##1}}%
+ \unexpanded{##4{##2}{##1}}%
}
-\long\def\ekv@parse@key##1##2%
+\long\def\ekv@parse@key##1##2##3%
{%
\unexpanded{##2{##1}}%
}
@@ -325,25 +327,42 @@
{%
\ekv@gobble@mark#2\ekv@set@other#1#4\ekv@set#1%
}
-\long\def\ekv@gobbleto@markstop#1\ekv@mark\ekv@stop{}
-\long\def\ekv@set@pair#1#2%
+\long\def\ekv@set@pair#1#2\ekv@nil#3%
{%
- \ekv@ifdefined@pair#2{#1}%
+ \expandafter\ekv@set@pair@
+ \csname
+ \ifcsname #3{#1}\endcsname
+ #3{#1}%
+ \else
+ relax%
+ \fi
+ \endcsname
+ {#2}%
{%
- \ekv@ifdefined{#2{#1}N}%
+ \ekv@ifdefined{#3{#1}N}%
\ekv@err@noarg
\ekv@err@unknown
- #2{#1}%
- \ekv@gobbleto@stop
+ #3{#1}%
}%
}
-\long\def\ekv@set@pair@#1#2\ekv@stop
+\long\def\ekv@set@pair@#1#2%
{%
- \ekv@strip{#2}#1%
+ \ifx#1\relax
+ \ekv@fi@secondoftwo
+ \fi
+ \@firstoftwo
+ {\ekv@strip{#2}#1}%
}
\long\def\ekv@set@key#1#2%
{%
- \ekv@ifdefined@key#2{#1}%
+ \expandafter\ekv@set@key@
+ \csname
+ \ifcsname #2{#1}N\endcsname
+ #2{#1}N%
+ \else
+ relax%
+ \fi
+ \endcsname
{%
\ekv@ifdefined{#2{#1}}%
\ekv@err@reqval
@@ -351,6 +370,13 @@
#2{#1}%
}%
}
+\def\ekv@set@key@#1%
+ {%
+ \ifx#1\relax
+ \ekv@fi@secondoftwo
+ \fi
+ \@firstoftwo#1%
+ }
\begingroup
\edef\ekv@err
{%
@@ -358,7 +384,7 @@
\unexpanded{\long\def\ekv@err}##1%
{%
\unexpanded{\expandafter\ekv@err@\@firstofone}%
- {\expandafter\noexpand\csname ! expkv Error:\endcsname ##1.}%
+ {\unexpanded\expandafter{\csname ! expkv Error:\endcsname}##1.}%
\unexpanded{\ekv@stop}%
}%
}