summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/keyparse/keyparse.sty
blob: 25d354bb750aee2d31520cd79e0fde0a88556ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
%%
%% This is file `keyparse.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% keyparse.dtx  (with options: `package')
%% -----------------------------------------------------------------------------
%% keyparse ---  key-based parser
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------------------
%% 
 \NeedsTeXFormat{LaTeX2e}[2021-06-01]
 \RequirePackage{expl3, xparse, l3keys2e}[2021-06-01]
 \ProvidesExplPackage
 {keyparse}                                             % Package name
 {2021-08-18}                                           % Release date
 {1.1}                                                  % Release version
 {keyparse --- key-based parser  }                      % Description
\ExplSyntaxOn
\msg_new:nnn
{__keyparse}
{not-set}
{recursion~for~rule~#1~is~not~set}
\cs_new_protected:Nn
\__keyparse_keyparse_rule_w:n
{\clist_clear_new:c{__keyparse_keys_#1_clist}
  \cs_new:cpn
  {__keyparse_keyparse_eval_#1:w} ##1 ##2 \q_recursion_stop
  {\quark_if_recursion_tail_stop:n{##1}
    \use:c{__keyparse_keyparse_eval_#1_##1:w}##2\q_recursion_stop }}
\cs_new_protected:Nn
\__keyparse_keyparse_rule:n{\__keyparse_keyparse_rule_w:n{#1}}
\cs_new:Nn
\__keyparse_keyparse_eval_aux:nn
{\cs_if_exist:cTF
  {__keyparse_keyparse_eval_#1:w}
  { \use:c{__keyparse_keyparse_eval_#1:w}#2
    \q_recursion_tail
    \q_recursion_stop}
  {\msg_error:nnn{__keyparse}
    {not-set}
    {#1}}}
\cs_generate_variant:Nn\__keyparse_keyparse_eval_aux:nn{ne}
\cs_new:Nn
\keyparse_eval:nn
{\__keyparse_keyparse_eval_aux:ne{#1}
  {\tl_trim_spaces:n{#2}}}
\cs_new_protected:Nn
\keyparse_set:nnnnn
{\cs_if_exist:cTF
  {__keyparse_keyparse_eval_#1:w}
  {\clist_put_right:cn
    {__keyparse_keys_#1_clist}{\texttt{\tl_to_str:n{#2}}}
    \cs_new:cpn
    {__keyparse_keyparse_eval_#1_#2:w}#3 \q_recursion_stop
    {#4\use:c{__keyparse_keyparse_eval_#1:w}#5 \q_recursion_stop}}
  {\__keyparse_keyparse_rule:n{#1}
    \keyparse_set:nnnnn
    {#1}{#2}{#3}{#4}{#5}}}
\ProvideDocumentCommand
{\KeyparseKeys}
{m}
{\clist_use:cnnn
  {__keyparse_keys_#1_clist}
  {~and~}{,~}{~and~}}
\NewDocumentCommand{\KeyparseEval}
{mm}
{\keyparse_eval:nn{#1}{#2}}
\cs_new:Nn\keyparse_argspec_e:n{{e{#1}}}
\keyparse_set:nnnnn{argspec}{e}{#1#2}
{  \tl_map_function:nN{#1}\keyparse_argspec_e:n}{#2}
\keyparse_set:nnnnn{argspec}{d}{#1#2#3}{{d#1#2}}{#3}
\keyparse_set:nnnnn{argspec}{m}{#1}{{m}}{#1}
\keyparse_set:nnnnn{argspec}{o}{#1}{{o}}{#1}
\keyparse_set:nnnnn{argspec}{r}{#1#2#3}{{r#1#2}}{#3}
\keyparse_set:nnnnn{argspec}{s}{#1}{{s}}{#1}
\keyparse_set:nnnnn{argspec}{t}{#1#2}{{t#1}}{#2}
\keyparse_set:nnnnn{pair/first}{>}{#1#2#3}{#1}{#3}
\keyparse_set:nnnnn{pair/merge}{>}{#1#2#3}{#1#2}{#3}
\ExplSyntaxOff
%% 
%% Copyright (C) 2021 by Erwann Rogard
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in the file:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%% Erwann Rogard.
%% 
%% This work consists of the file keyparse.dtx and the derived files:
%% keyparse.sty, and keyparse.pdf.
%% 
%%
%% End of file `keyparse.sty'.