diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/expkv/expkv.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/expkv/expkv.tex | 80 |
1 files changed, 66 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/generic/expkv/expkv.tex b/Master/texmf-dist/tex/generic/expkv/expkv.tex index 3eaadbaa4a6..7e99c8897a8 100644 --- a/Master/texmf-dist/tex/generic/expkv/expkv.tex +++ b/Master/texmf-dist/tex/generic/expkv/expkv.tex @@ -34,13 +34,18 @@ \else \expandafter\endinput \fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname numexpr\endcsname\relax - \errmessage{expkv requires e-TeX} +\begingroup + \edef\ekvtmpa{\string\expanded} + \edef\ekvtmpb{\meaning\expanded} + \expandafter +\endgroup +\ifx\ekvtmpa\ekvtmpb +\else + \errmessage{expkv Error: e-TeX and \noexpand\expanded required} \expandafter\endinput \fi -\def\ekvVersion{1.7a} -\def\ekvDate{2021-04-11} +\def\ekvVersion{1.8} +\def\ekvDate{2021-05-24} \csname ekv@tmp\endcsname \expandafter\chardef\csname ekv@tmp\endcsname=\catcode`\@ \catcode`\@=11 @@ -427,7 +432,8 @@ \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\ekvparse##1##2##3% + {\unexpanded\expanded{{\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 @@ -643,19 +649,65 @@ \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1}}% {\ekvsetSneaked{#2}{#3}{##1}}% } -\def\ekv@err#1% +\begingroup +\catcode`\^^@=2 +\@firstofone{\endgroup + \def\ekv@alignsafe{\romannumeral\iffalse{\fi`^^@ } +} +\def\ekv@endalignsafe{\ifnum`{=\ekv@zero}\fi} +\begingroup +\def\ekvoptarg#1#2{% +\endgroup +\long\def\ekvoptarg##1##2##3% {% - \long\def\ekv@err##1{\expandafter\ekv@err@\@firstofone{#1##1.}\ekv@stop}% + \romannumeral + #1% + \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optarg\ekv@mark[\ekv@mark + #2% + \@firstofone{\ekv@zero##1}{##2}{##3}% } -\begingroup\expandafter\endgroup -\expandafter\ekv@err\csname ! expkv Error:\endcsname -\def\ekv@err@{\expandafter\ekv@gobbleto@stop} +\long\def\ekvoptargTF##1##2##3% + {% + \romannumeral + #1% + \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optargTF{##1}\ekv@mark[\ekv@mark + #2% + \@firstofone{\ekv@zero##2}{##3}% + } +\long\def\ekv@optarg\ekv@mark[\ekv@mark\ifnum`##1\fi\@firstofone##2##3##4##5]% + {#2##2{##5}} +\long\def\ekv@optargTF##1\ekv@mark[\ekv@mark\ifnum`##2\fi\@firstofone##3##4##5]% + {#2\ekv@zero##1{##5}} +} +\ekv@exparg{\expandafter\ekvoptarg\expandafter{\ekv@alignsafe}}\ekv@endalignsafe +\long\def\ekv@optarg@if#1\ekv@mark[\ekv@mark{} +\def\ekv@err@cleanup\par{} +\def\ekv@err@collect#1% + {% + \def\ekv@err@collect##1\par##2% + {% + \expandafter + \ekv@err@cleanup + #1! ##2 Error: ##1\par + }% + \def#1##1\thanks@jfbu{}% + } +\def\ekverr{ } +\expandafter\ekv@err@collect\csname <an-expandable-macro>^^J% + completed due to above exception. \ekverr If the error^^J% + summary is \ekverr not comprehensible \ekverr see the package^^J% + documentation.^^J% + I will try to recover now. \ekverr If you're in inter-^^J% + active mode hit <return> \ekverr at the ? prompt and I^^J% + continue hoping recovery\endcsname +\long\def\ekverr#1#2{\expandafter\ekv@err@collect\detokenize{#2}\par{#1}} +\ekv@exparg{\long\def\ekv@err#1}{\ekverr{expkv}{#1}} \long\def\ekv@err@common #1#2{\expandafter\ekv@err@common@\string#2{#1}} \ekv@exparg{\long\def\ekv@err@common@#1`#2' #3.#4#5}% - {\ekv@err{#4 (`#5', set `#2')}} + {\ekv@err{#4 `#5' in set `#2'}} \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}} +\ekv@exparg{\long\def\ekv@err@noarg #1}{\ekv@err@common{unwanted value for}{#1}} +\ekv@exparg{\long\def\ekv@err@reqval #1}{\ekv@err@common{missing value for}{#1}} \ekv@exparg{\long\def\ekv@err@redirect@kv@notfound#1#2#3\ekv@stop}% {\ekv@err{no key `#2' in sets #3}} \ekv@exparg{\def\ekv@err@redirect@k@notfound#1#2\ekv@stop}% |