summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
blob: b9743d48f7e9ed63d08dfab380dc0f540ebb3356 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
%%
%% This is file `xparse.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xparse.dtx  (with options: `package')
%% 
%% Copyright (C) 2009-2021 The LaTeX Project
%% 
%% It 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 file is part of the "l3packages bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: xparse.dtx
\RequirePackage{expl3}[2018-04-12]
\@ifpackagelater{expl3}{2018-04-12}
  {}
  {%
    \PackageError{xparse}{Support package l3kernel too old}
      {%
        Please install an up to date version of l3kernel\MessageBreak
        using your TeX package manager or from CTAN.\MessageBreak
        \MessageBreak
        Loading xparse will abort!%
      }%
    \endinput
  }
\ExplSyntaxOn
\cs_set_protected:Npn \__cmd_tmp:w #1
  {
    \DeclareOption* { \PassOptionsToPackage { \CurrentOption } {#1} }
    \ProcessOptions \relax
    \RequirePackage {#1}
  }
\cs_if_free:NTF \NewDocumentCommand
  {
    \ExplSyntaxOff
    \ifnum\expandafter
        \@parse@version\fmtversion//00\@nil <
        \@parse@version 2020-10-01//00\@nil
      \__cmd_tmp:w { xparse-2018-04-12 }
    \else
      \__cmd_tmp:w { xparse-2020-10-01 }
    \fi
    \file_input_stop:
  }
  {
    \ExplSyntaxOff
    \cs_if_exist:NF \__cmd_start:nNNnnn
      {
        \__cmd_tmp:w { xparse-2020-10-01 }
        \file_input_stop:
      }
  }
\ExplSyntaxOff
\ProvidesExplPackage{xparse}{2021-05-07}{}
  {L3 Experimental document command parser}
\clist_new:N \l__cmd_options_clist
\DeclareOption* { \clist_put_right:NV \l__cmd_options_clist \CurrentOption }
\ProcessOptions \relax
\keys_define:nn { ltcmd }
  {
    log-declarations .bool_set:N = \l__cmd_log_bool ,
    log-declarations .initial:n  = false
  }
\keys_set:nV { ltcmd } \l__cmd_options_clist
\bool_if:NF \l__cmd_log_bool
  { \msg_redirect_module:nnn { LaTeX / ltcmd } { info } { none } }
\cs_gset_protected:Npn \__cmd_normalize_arg_spec_loop:n #1
  {
    \quark_if_recursion_tail_stop:n {#1}
    \int_incr:N \l__cmd_current_arg_int
    \cs_if_exist_use:cF { __cmd_normalize_type_ \tl_to_str:n {#1} :w }
      {
        \__kernel_msg_error:nnxx { ltcmd } { unknown-argument-type }
          { \__cmd_environment_or_command: } { \tl_to_str:n {#1} }
        \__cmd_bad_def:wn
      }
  }
\cs_new_protected:Npx \__cmd_normalize_type_g:w
  { \exp_not:N \__cmd_normalize_type_G:w { \exp_not:V \c_novalue_tl } }
\cs_new_protected:Npn \__cmd_normalize_type_G:w #1
  {
    \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
    \__cmd_normalize_check_gv:N G
    \__cmd_add_arg_spec:n { G {#1} }
    \tl_put_right:Nn \l__cmd_last_delimiters_tl { { } }
    \__cmd_normalize_arg_spec_loop:n
  }
\cs_new_protected:Npn \__cmd_normalize_type_l:w
  {
    \__cmd_normalize_check_lu:N l
    \__cmd_add_arg_spec_mandatory:n { l }
    \__cmd_normalize_arg_spec_loop:n
  }
\cs_new_protected:Npn \__cmd_normalize_type_u:w #1
  {
    \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
    \__cmd_normalize_check_lu:N u
    \__cmd_add_arg_spec_mandatory:n { u {#1} }
    \__cmd_normalize_arg_spec_loop:n
  }
\cs_new_protected:Npn \__cmd_add_type_G:w #1
  {
    \__cmd_flush_m_args:
    \__cmd_add_default:n {#1}
    \__cmd_add_grabber:N G
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_add_type_l:w
  {
    \__cmd_flush_m_args:
    \__cmd_add_default:
    \__cmd_add_grabber:N l
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_add_type_u:w #1
  {
    \__cmd_flush_m_args:
    \__cmd_add_default:
    \__cmd_add_grabber:N u
    \tl_put_right:Nn \l__cmd_signature_tl { {#1} }
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_add_expandable_type_l:w
  { \__cmd_add_expandable_type_u:w ## }
\cs_new_protected:Npn \__cmd_add_expandable_type_u:w #1
  {
    \__cmd_add_default:
    \bool_if:NTF \l__cmd_long_bool
      { \cs_set:cpn }
      { \cs_set_nopar:cpn }
      { \l__cmd_expandable_aux_name_tl } ##1 \q__cmd ##2 ##3 ##4 #1
      { ##1 {##4} \q__cmd ##2 ##3 }
    \__cmd_add_expandable_grabber:nn { u }
      { \exp_not:c  { \l__cmd_expandable_aux_name_tl } }
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_grab_G:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
      \__cmd_peek_nonspace:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_long:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected:Npn
      \__cmd_peek_nonspace:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_obey_spaces:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
      \peek_meaning:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_long_obey_spaces:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected:Npn
      \peek_meaning:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_aux:nNN #1#2#3
  {
    \tl_set:Nn \l__cmd_signature_tl {#1}
    \exp_after:wN #2 \l__cmd_fn_tl ##1
      { \__cmd_add_arg:n {##1} }
    #3 \c_group_begin_token
      { \l__cmd_fn_tl }
      { \__cmd_add_arg:o \c_novalue_tl }
  }
\cs_new_protected:Npn \__cmd_grab_l:w #1 \__cmd_run_code:
  { \__cmd_grab_l_aux:nN {#1} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \__cmd_grab_l_long:w #1 \__cmd_run_code:
  { \__cmd_grab_l_aux:nN {#1} \cs_set_protected:Npn }
\cs_new_protected:Npn \__cmd_grab_l_aux:nN #1#2
  {
    \tl_set:Nn \l__cmd_signature_tl {#1}
    \exp_after:wN #2 \l__cmd_fn_tl ##1##
      { \__cmd_add_arg:n {##1} }
    \l__cmd_fn_tl
  }
\cs_new_protected:Npn \__cmd_grab_u:w #1#2 \__cmd_run_code:
  { \__cmd_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \__cmd_grab_u_long:w #1#2 \__cmd_run_code:
  { \__cmd_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn }
\cs_new_protected:Npn \__cmd_grab_u_aux:nnN #1#2#3
  {
    \tl_set:Nn \l__cmd_signature_tl {#2}
    \exp_after:wN #3 \l__cmd_fn_tl ##1 #1
      { \__cmd_add_arg:n {##1} }
    \l__cmd_fn_tl
  }
\cs_new_eq:NN \__cmd_expandable_grab_u:w \prg_do_nothing:
%% 
%%
%% End of file `xparse.sty'.