Debian Codegraph @

texmf-dist/tex/latex/spectralsequences/sseqmacromakers.code.tex

raw
1 %%
2 %% Package: spectralsequences v1.3.3 2023-01-28
3 %% Author: Hood Chatham
4 %% Email: [email protected]
5 %% Date: 2023-01-28
6 %% License: Latex Project Public License
7 %%
8 %% File: sseqmacromakers.code.tex
9 %% Exposes: \DeclareSseqCommand, \NewSseqCommand, \DeclareSseqGroup, \NewSseqGroup
10 %%
11 %% Set up commands to define other commands, both the internal macros, and the external ones.
12 %% Also the internal macros \sseq@DeclareDocumentCommandAs and \sseq@DeclareDocumentCommand
13 %% For the user commands, sets up call stack, thiscall, etc
14 %%
15
16 \ExplSyntaxOn
17
18 %%% Install user commands
19 % copy commands into user namespace by removing sseq@ prefixes
20 % given a list of commands, \let\thiscommand\sseq@thiscommand on each one
21 \def\sseq@installmacros{\@xp\sseq@installmacros@\sseq@macrolist\sseq@nil}
22 \def\sseq@installmacros@#1{%
23 \ifx#1\sseq@nil\else % if so, that was the last command in the list
24 \@xp\let\@xp#1\csname sseq@\sseq@macroname#1\endcsname
25 \@xp\sseq@installmacros@
26 \fi %
27 }
28
29 % Capital U argument type is "Until" but puts back the token when it's done.
30
31 % So xparse changed a bunch between the copy pushed to CTAN on February 7th and the copy pushed on February 9th
32 \newtoks\sseq@patchxparseUnewcode
33 \sseq@patchxparseUnewcode{
34 \cs_new_protected:Npn \sseq__xparse_grab_U:w #1#2 \__xparse_run_code:
35 { \sseq__xparse_grab_U_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
36 \cs_new_protected:Npn \sseq__xparse_grab_U_aux:nnN #1#2#3
37 {
38 \tl_set:Nn \l__xparse_signature_tl {#2}
39 \exp_after:wN #3 \l__xparse_fn_tl ##1 #1
40 { \__xparse_add_arg:n {##1} #1 }
41 \l__xparse_fn_tl
42 }
43 \ifx\__xparse_add_grabber_mandatory:N\undefined
44 \let \__xparse_add_grabber_mandatory:N \__xparse_add_grabber:N
45 \fi
46 \cs_new_protected:Npn \sseq__xparse_add_type_U:w #1
47 {
48 \__xparse_flush_m_args:
49 \__xparse_add_default:
50 \__xparse_add_grabber_mandatory:N U
51 \tl_put_right:Nn \l__xparse_signature_tl { {#1} }
52 \__xparse_prepare_signature:N
53 }
54 %
55 %
56 \cs_new_protected:Npn \sseq__cmd_grab_U:w #1#2 \__cmd_run_code:
57 { \sseq__cmd_grab_U_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
58 \cs_new_protected:Npn \sseq__cmd_grab_U_aux:nnN #1#2#3
59 {
60 \tl_set:Nn \l__cmd_signature_tl {#2}
61 \exp_after:wN #3 \l__cmd_fn_tl ##1 #1
62 { \__cmd_add_arg:n {##1} #1 }
63 \l__cmd_fn_tl
64 }
65 \cs_new_protected:Npn \sseq__cmd_add_type_U:w #1
66 {
67 \__cmd_flush_m_args:
68 \__cmd_add_default:
69 \__cmd_add_grabber:N U
70 \tl_put_right:Nn \l__cmd_signature_tl { {#1} }
71 \__cmd_prepare_signature:N
72 }
73 }
74
75 \@ifpackagelater{xparse}{2017/02/08}{
76 \@ifpackagelater{xparse}{2018/10/17}{
77 \ifsseq@patchxparseU
78 \the\sseq@patchxparseUnewcode
79 \else
80 % Assumptions failed, so just make U give an error (this isn't such a big deal since we don't use it for \d anymore).
81 \cs_new_protected:Npn \sseq__cmd_add_type_U:w #1
82 {
83 \sseq@error{U-xparse-incompatible}
84 }
85 \cs_new_eq:NN \sseq__xparse_add_type_U:w \sseq__cmd_add_type_U
86 \fi
87 }{
88 \the\sseq@patchxparseUnewcode
89 }
90 }{
91 % OLD CODE
92 \cs_new_protected:Npn \sseq__xparse_grab_U:w #1#2 \l__xparse_args_tl
93 { \sseq__xparse_grab_U_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
94 \cs_new_protected:Npn \sseq__xparse_grab_U_aux:nnN #1#2#3
95 {
96 \exp_after:wN #3 \l__xparse_fn_tl ##1 #1
97 {
98 \__xparse_add_arg:n {##1}
99 #2\l__xparse_args_tl #1
100 }
101 \l__xparse_fn_tl
102 }
103 \cs_new_protected:Npn \sseq__xparse_add_type_U:w #1
104 {
105 \__xparse_flush_m_args:
106 \__xparse_add_grabber_mandatory:N U
107 \tl_put_right:Nn \l__xparse_signature_tl { {#1} }
108 \__xparse_prepare_signature:N
109 }
110 }% END \@ifpackagelater
111
112 % On 2018/10/01, the commit "Reimplement the ignore_spaces peek functions in terms of peek_spaces" did what it says.
113 % Inside of \sseq@DeclareDocumentCommandAs we \let \peek_meaning to \peek_meaning_ignore_spaces
114 % which is bad news if \peek_meaning_ignore_spaces is defined in terms of \peek_meaning. This fixes this bug by
115 % redefining \peek_meaning_ignore_spaces in terms of a copy of \peek_meaning.
116 \@ifpackagelater{expl3}{2018/10/01}{
117 \cs_set_eq:NN\sseq__copy_of_peek_meaning:NTF\peek_meaning:NTF
118 \cs_set:Npn\sseq__peek_meaning_ignore_spaces:NTF#1#2#3{\peek_remove_spaces:n{\sseq__copy_of_peek_meaning:NTF#1{#2}{#3}}}
119 \cs_set_eq:NN\sseq__copy_of_peek_meaning_remove:NTF\peek_meaning_remove:NTF
120 \cs_set:Npn\sseq__peek_meaning_remove_ignore_spaces:NTF#1#2#3{\peek_remove_spaces:n{\sseq__copy_of_peek_meaning_remove:NTF#1{#2}{#3}}}
121 }{
122 \cs_set_eq:NN\sseq__peek_meaning_ignore_spaces:NTF\peek_meaning_ignore_spaces:NTF
123 \cs_set_eq:NN\sseq__peek_meaning_remove_ignore_spaces:NTF\peek_meaning_remove_ignore_spaces:NTF
124 }
125
126 \@ifpackagelater{xparse}{2018/10/17}{
127 \cs_new_protected:Npn \sseq__xparse_normalize_type_U:w #1 {
128 \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
129 \__xparse_normalize_check_lu:N U
130 \__xparse_add_arg_spec_mandatory:n { U {#1} }
131 \__xparse_normalize_arg_spec_loop:n
132 }
133
134 \cs_new_protected:Npn \sseq__cmd_normalize_type_U:w #1 {
135 \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
136 \__cmd_normalize_check_lu:N U
137 \__cmd_add_arg_spec_mandatory:n { U {#1} }
138 \__cmd_normalize_arg_spec_loop:n
139 }
140 }{
141 \cs_new_protected:Npn \sseq__xparse_normalize_type_U:w #1 {
142 \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
143 \__xparse_normalize_check_lu:N U
144 \__xparse_add_arg_spec:n { U {#1} }
145 \int_incr:N \l__xparse_mandatory_args_int
146 \tl_clear:N \l__xparse_last_delimiters_tl
147 \__xparse_normalize_arg_spec_loop:n
148 }
149 }
150 % Expandable commands are a menace to us because they define a bunch of helper commands that we then have to keep track of.
151 % We are too lazy to do this, so force \l__cmd_grab_expandably_bool to be false.
152 % This is backwards compatible (I think) because \bool_set_false:N just performs a chardef (no existence check)
153 % so in old versions, \l__cmd_grab_expandably_bool will be created harmlessly.
154 \let\sseq__cmd_prepare_signature:n\__cmd_prepare_signature:n
155 \ifx\sseq__cmd_prepare_signature:n\undefined
156 \let\sseq__cmd_prepare_signature:n\__xparse_prepare_signature:n
157 \fi
158 \pretocmd\sseq__cmd_prepare_signature:n {
159 \bool_set_false:N \l__cmd_grab_expandably_bool
160 \bool_set_false:N \l__xparse_grab_expandably_bool
161 }{}{\error}
162
163 % I would like to patch the \__xparse_grab_U:w's in my commands into \sseq__xparse_grab_U:w's but I can't because of -NoValue-.
164 \def\sseq@install@xparse@Uarggrabber{%
165 \cs_set_eq:NN \__xparse_grab_U:w \sseq__xparse_grab_U:w
166 \cs_set_eq:NN \__cmd_grab_U:w \sseq__cmd_grab_U:w
167 }
168
169 %%% \sseq@DeclareDocumentCommand
170 %
171 % \sseq@DeclareDocumentCommand\somecommand is shorthand for \sseq@DeclareDocumentCommandAs\sseq@somecommand\somecommand
172 %
173 % so the result is that it defines \sseq@somecommand intended to be \let to \somecommand later.
174
175 \cs_new_protected:Npn\sseq@DeclareDocumentCommand#1{%
176 \exp_args:Nc \sseq@DeclareDocumentCommandAs@setinputline { sseq @ \cs_to_str:N #1 }#1
177 }
178
179 \cs_new_protected:Npn\sseq@DeclareDocumentCommandAs@setinputline#1{
180 \protected\edef #1 { \@nx\sseq@setinputline \@xp\@nx\csname \cs_to_str:N #1 @@unique@@ start \endcsname }
181 \exp_args:Nc \sseq@DeclareDocumentCommandAs { \cs_to_str:N #1 @@unique@@ start }
182 }
183
184 %%% \sseq@DeclareDocumentCommandAs
185 %
186 % #1 - the command to define
187 % #2 - the command to use in argument parsing errors
188 % #3 - parameters (\NewDocumentCommand style)
189 % #4 - code
190 %
191 % See my stack exchange question: https://tex.stackexchange.com/questions/350596/control-error-messages-made-by-commands-defined-with-newdocumentcommand
192
193 \cs_new_protected:Npn\sseq@DeclareDocumentCommandAs#1#2#3#4{
194 \group_begin:
195 \cs_set_eq:NN \__cmd_add_type_U:w \sseq__cmd_add_type_U:w
196 \cs_set_eq:NN \__xparse_add_type_U:w \sseq__xparse_add_type_U:w
197 \cs_set_eq:NN \__cmd_normalize_type_U:w \sseq__cmd_normalize_type_U:w
198 \cs_set_eq:NN \__xparse_normalize_type_U:w \sseq__xparse_normalize_type_U:w
199 \cs_set_eq:NN \__cmd_prepare_signature:n \sseq__cmd_prepare_signature:n
200 \cs_set_eq:NN \__xparse_prepare_signature:n \sseq__cmd_prepare_signature:n
201 %\cs_set:Npn \__cmd_declare_cmd_code:Nnn {\bool_set_false:N \l__cmd_grab_expandably_bool\__cmd_declare_cmd_code_aux:Nnn}
202 \sseq@installmsghooks
203 \def\sseq@error@setup{}
204 \def\sseq@error@cleanup{\sseq@errortrue}
205 \let\sseq@error@annotation\empty
206 \DeclareDocumentCommand #2 { #3 } { #4 }
207 \ifsseq@error
208 \group_end:
209 \sseq@errortrue % This only happens if it came from user code, so don't set error to be false so it can break out too.
210 \@xp\sseq@break
211 \fi
212 \cs_if_exist:cTF{ \cs_to_str:N #2 \c_space_tl code }{
213 \cs_gset:Npx #1{
214 \begingroup
215 \exp_not:N \cs_set_eq:NN % force xparse to always ignore spaces!
216 \exp_not:N \peek_meaning:NTF
217 \exp_not:N \sseq__peek_meaning_ignore_spaces:NTF
218 \exp_not:N \cs_set_eq:NN % force xparse to always ignore spaces!
219 \exp_not:N \peek_meaning_remove:NTF
220 \exp_not:N \sseq__peek_meaning_remove_ignore_spaces:NTF
221 % Not sure why we use set_eq:cc and exp_not:n here but I'm concerned that something will break if I change it...
222 \exp_not:N \cs_set_eq:cc
223 \exp_not:n {{ \cs_to_str:N #2 \c_space_tl code }}
224 \exp_not:n {{ \cs_to_str:N #1 \c_space_tl code }}
225 \exp_not:N \cs_set_eq:NN
226 \exp_not:c { \cs_to_str:N #2 \c_space_tl }
227 \exp_not:c { \cs_to_str:N #1 \c_space_tl }
228 \exp_not:c { \cs_to_str:N #1 \c_space_tl inner }
229 }
230 \pretocmd:cnnn { \cs_to_str:N #2 \c_space_tl code } { \endgroup{} } { } { \sseq@error@x { macro-patch-failed } { \string#1 } }
231 \cs_gset_eq:cN { \cs_to_str:N #1 \c_space_tl inner } #2
232 \cs_gset_eq:cc { \cs_to_str:N #1 \c_space_tl code } { \cs_to_str:N #2 \c_space_tl code }
233 \cs_gset_eq:cc { \cs_to_str:N #1 \c_space_tl }{ \cs_to_str:N #2 \c_space_tl } % sometimes the new version of xparse stores stuff in #2<space>
234 }{
235 \cs_gset_eq:NN #1 #2
236 }
237 \group_end: % In this case, I want to pass \sseq@errortrue out of the block, so I close the group before I break.
238 \sseq@breakpoint % So this breakpoint definitely should be after the \endgroup.
239 }
240
241 \cs_set_eq:NN \patchcmd:Nnnnn \patchcmd
242 \cs_set_eq:NN \pretocmd:Nnnn \pretocmd
243 \cs_generate_variant:Nn \patchcmd:Nnnnn {cnfnn}
244 \cs_generate_variant:Nn \pretocmd:Nnnn {cfnn}
245 \cs_generate_variant:Nn \pretocmd:Nnnn {cnnn}
246
247 \cs_new_protected:Npn\NewSseqCommand#1{%
248 \cs_if_free:cTF { sseq @ usermacro @ \cs_to_str:N #1 } { \DeclareSseqCommand#1 } { \sseq@error@x{usermacro-not-free}{\string#1} \use_none:nn }
249 }
250 \let\begingroupa\begingroup
251 \let\begingroupb\begingroup
252 \newtoks\sseq@macro@setthiscall@toks
253 \newtoks\sseq@macro@defaultarggetters@toks
254
255 \cs_new_protected:Npn\DeclareSseqCommand#1#2#3{%
256 \cs_if_exist:cTF { sseq @ \cs_to_str:N #1 @@unique@@ start} {\sseq@error@x{wont-override-builtin}{\string#1}\sseq@break} {}
257 \cs_if_free:cT { sseq @ usermacro @ \cs_to_str:N #1 } {
258 \sseq@x@addto@macro { \sseq@installmacros } { \let \exp_not:N #1 \exp_not:c { sseq @ usermacro @ \cs_to_str:N #1 } }
259 }
260 % Make sure \cs_if_exist doesn't pass because there was a previously defined user macro with same name
261 \cs_undefine:c { sseq @ usermacro @ \cs_to_str:N #1 \c_space_tl code }
262 \exp_args:Nc \sseq@DeclareDocumentCommandAs@setinputline { sseq @ usermacro @ \cs_to_str:N #1 } #1 { #2 } {%
263 \sseq@loadinputline
264 \sseq@atbeginusermacro@msgsetup
265 {}#3{} % prevent space patching space hazards with these {}'s
266 \endgroup
267 }%
268 \ifsseq@error
269 \global\sseq@errorfalse
270 \@xp\sseq@break
271 \fi
272 \sseq@parseargspec{#1}{#2}%
273 % You might think we could skip this patching, and it's probably possible.
274 % However, this is responsible for turning the #'s of catcode other into #'s of catcode arg. I don't have as good of a way to do that.
275 % Also, this allows me to use \sseq@parseargspec after defining the command, so I don't have to run any error checking inside of it
276 % because if the argspec is invalid, \DeclareDocumentCommand will let me know.
277 \cs_if_exist:cTF{ sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start \c_space_tl code }{
278 \patchcmd:cnfnn{ sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start \c_space_tl code }{\endgroup{}}{
279 \@xp\endgroup
280 \@xp\begingroupa
281 \the\sseq@macro@setthiscall@toks
282 }{}{\sseq@error@x{usermacro-failed-patch}{\string#1}}
283 \cs_gset_eq:cc { sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start \c_space_tl code } { sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start \c_space_tl code}
284 }{
285 \pretocmd:cfnn{ sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start }{
286 \@xp\begingroupb
287 \the\sseq@macro@setthiscall@toks
288 }{}{\sseq@error@x{usermacro-failed-patch}{\string#1}}
289 }
290 \cs_gset_eq:cc { sseq @ usermacro @ \cs_to_str:N #1 } { sseq @ usermacro @ \cs_to_str:N #1 }
291 \cs_gset_eq:cc { sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start } { sseq @ usermacro @ \cs_to_str:N #1 @@unique@@ start}
292 \ifsseq@inprogress
293 \cs_set_eq:Nc #1 { sseq @ usermacro @ \cs_to_str:N #1 }
294 \fi
295 \sseq@breakpoint
296 }
297
298 %%% Commands to help the user define "groups" of commands to be reused
299 % #1 -- command
300 % #2 -- argspec
301 % #3 -- body of function (long)
302 \NewDocumentCommand\NewSseqGroup{mm+m}{\DeclareSseqGroup@\NewSseqCommand{#1}{#2}{#3}}
303 \NewDocumentCommand\DeclareSseqGroup{mm+m}{\DeclareSseqGroup@\DeclareSseqCommand{#1}{#2}{#3}}
304
305 % #1 -- \NewSseqCommand or \DeclareSseqCommand
306 % #2 -- command
307 % #3 -- argspec
308 % #4 -- body of function (long)
309 \long\def\DeclareSseqGroup@#1#2#3#4{%
310 \group_begin:
311 \let\sseq@parseargspec\@gobbletwo % Get rid of argparse so we can change what gets added for setting up thiscall
312 % why are we doing these things here?
313 \sseq@installmsghooks
314 \def\sseq@error@setup{}
315 \def\sseq@error@cleanup{\sseq@errortrue}
316 \let\sseq@error@annotation\empty
317 %
318 % undefine so we can tell whether we need to patch \command<space>code or \command
319 \cs_undefine:c { sseq @ usermacro @ \cs_to_str:N #2 @ helper \c_space_tl code }
320 \exp_args:Nc \sseq@DeclareDocumentCommandAs { sseq @ usermacro @ \cs_to_str:N #2 @ helper } #2 { #3 } {
321 \sseq@loadinputline
322 \sseq@usermacro@esetthiscall{\the\sseq@groupthiscalltoks}
323 \sseq@atbeginusermacro@msgsetup % the stack push happens in here
324 \sseq@scopecall
325 {}#4{}
326 \end{scope}
327 \endgroup
328 \sseq@breakpoint
329 }%
330 \ifsseq@error
331 \@xp\sseq@break
332 \fi
333 \sseq@macro@setthiscall@toks\@xp{\sseq@SseqGroup@argspec} % This gets added to the command by DeclareSseqCommand
334 #1#2{od()}{%
335 %can't use \sseq@atbeginusermacro@msgsetup until next spot b/c don't know what the whole call looks like yet
336 \IfNoValueTF{##1}{\def\sseq@options{}}{\def\sseq@options{##1}}%
337 \IfNoValueTF{##2}{%
338 \edef\sseq@scopecall{\@nx\begin{scope}[\unexpanded\@xp{\sseq@options}]}
339 }{%
340 \sseqnewgroup@splitcoord##2\sseq@nil
341 }%
342 \csname sseq @ usermacro @ \sseq@macroname #2 @ helper \@xp\endcsname\@gobbletwo % This gobble eats the endgroup added by sseqDeclareDocumentCommand
343 }
344 \sseq@parseargspec@newgroup{#2}{#3}%
345 % You might think we could skip this patching, and it's probably possible.
346 % However, this is responsible for turning the #'s of catcode other into #'s of catcode arg. I don't have as good of a way to do that.
347 \cs_if_exist:cTF{ sseq @ usermacro @ \cs_to_str:N #2 @ helper \c_space_tl code }{
348 \pretocmd:cfnn { sseq @ usermacro @ \cs_to_str:N #2 @ helper \c_space_tl code }{
349 \the\sseq@macro@setthiscall@toks
350 }{}{\sseq@error@x{usermacro-failed-patch}{\string#1}}
351 % globalize definition:
352 \cs_gset_eq:cc { sseq @ usermacro @ \cs_to_str:N #2 @ helper \c_space_tl code } { sseq @ usermacro @ \cs_to_str:N #2 @ helper \c_space_tl code }
353 }{
354 \pretocmd:cfnn { sseq @ usermacro @ \cs_to_str:N #2 @ helper }{
355 \the\sseq@macro@setthiscall@toks
356 }{}{\sseq@error@x{usermacro-failed-patch}{\string#1}}
357 }
358 \cs_gset_eq:cc { sseq @ usermacro @ \cs_to_str:N #2 @ helper } { sseq @ usermacro @ \cs_to_str:N #2 @ helper } % globalize definition
359 \let\sseq@parseargspec\sseq@parseargspec@normal
360 \sseq@breakpoint
361 \group_end:
362 }
363
364 \def\sseqnewgroup@splitcoord#1,#2\sseq@nil{
365 \sseq@ifintexpr{#1}{}{
366 \def\sseq@scopecall{\sseq@error@n{invalid-coordinate}{x~}\sseq@break}
367 \sseq@break
368 }
369 \sseq@ifintexpr{#2}{}{
370 \def\sseq@scopecall{\sseq@error@n{invalid-coordinate}{y~}\sseq@break}
371 \sseq@break
372 }
373 \edef\sseq@scopecall{
374 \@nx\begin{scope}[xshift=\the\numexpr#1\relax,yshift=\the\numexpr#2\relax,\unexpanded\@xp{\sseq@options}]
375 }
376 \sseq@breakpoint
377 }
378
379
380 \newtoks\sseq@groupargspectoks
381 \newtoks\sseq@groupthiscalltoks
382 \bgroup\catcode`\#=12\relax
383 \gdef\sseq@SseqGroup@argspec{
384 \sseq@eval{\global\sseq@groupargspectoks{\IfNoValueF{#1}{\unexpanded{[#1]}}\IfNoValueF{#2}{\unexpanded{(#2)}}}}
385 \@gobbletwo % What does this \@gobbletwo do?
386 }
387 \gdef\sseq@thearg{#\the\sseq@tempcount}
388 \egroup
389
390
391 % When there are arguments with default values (O, D, R, G), we need to put them
392 % into temporary macros to compare them and see if they are the default value
393 % that's what \sseq@macro@defaultarggetters@toks is for.
394 \def\sseq@parseargspec#1#2{%
395 \sseq@tempcount=\z@
396 \sseq@temptoks{\@nx#1}% Holds the stuff that goes in \esetthiscall (so most stuff)
397 \sseq@macro@defaultarggetters@toks{}
398 \sseq@parseargspec@#2\sseq@nil
399 \sseq@eval{\sseq@macro@setthiscall@toks{\the\sseq@macro@defaultarggetters@toks\@nx\sseq@usermacro@esetthiscall{\the\sseq@temptoks}}}
400 }
401
402 % For NewGroup:
403 \let\sseq@parseargspec@normal\sseq@parseargspec
404 \def\sseq@parseargspec@newgroup#1#2{%
405 \sseq@tempcount=\z@
406 \sseq@temptoks{}
407 \sseq@macro@defaultarggetters@toks{}%
408 \sseq@parseargspec@#2\sseq@nil
409 \sseq@eval{
410 \sseq@macro@setthiscall@toks{
411 \the\sseq@macro@defaultarggetters@toks
412 \@nx\sseq@esetthiscall{
413 \@nx\@nx\@nx#1
414 \@nx\the\sseq@groupargspectoks
415 \the\sseq@temptoks
416 }
417 \global\sseq@groupthiscalltoks\@nx\@xp{\@nx\the\sseq@thiscalltoks}
418 }
419 }
420 }
421
422
423 \def\sseq@parseargspec@#1{
424 \advance\sseq@tempcount\@ne
425 \ifx#1\sseq@nil\else
426 \@xp\ifx\csname sseq@parseargspec@#1\@xp\endcsname\relax
427 \sseq@error@n{usermacro-unsupported-argument-type}{#1}
428 \else
429 \csname sseq@parseargspec@#1\@xptwo\endcsname
430 \fi
431 \fi
432 }
433
434
435 % Have to use \@alph to convert the number to a letter. Using a number here doesn't work because the control sequence gets retokenized
436 % so we can only use letters in control sequences (another option would be to not expand the \csnames till later, but that would be harder).
437 \def\sseq@parseargspec@ifargisnotdefault{%
438 \@nx\ifx
439 \@xp\@nx\csname sseq@parseargspec@temparg\@alph\sseq@tempcount\endcsname
440 \@xp\@nx\csname sseq@parseargspec@tempdefault\@alph\sseq@tempcount\endcsname
441 \unexpanded{%
442 \@xp\@gobble
443 \else
444 \@xp\@firstofone
445 \fi
446 }%
447 }
448
449 \def\sseq@parseargspec@setargdefault#1{%
450 \sseq@e@addto@toks\sseq@macro@defaultarggetters@toks{%
451 \def\@xp\@nx\csname sseq@parseargspec@temparg\@alph\sseq@tempcount\endcsname{\sseq@thearg}%
452 \def\@xp\@nx\csname sseq@parseargspec@tempdefault\@alph\sseq@tempcount\endcsname{\unexpanded{#1}}%
453 }
454 }
455
456 % v, E, and e are illegal
457
458 % Mandatory
459 \def\sseq@parseargspec@m{%
460 \sseq@e@addto@temptoks{{\@nx\unexpanded{\sseq@thearg}}}
461 \sseq@parseargspec@
462 }
463 \def\sseq@parseargspec@l{%
464 \sseq@e@addto@temptoks{\@nx\unexpanded{\sseq@thearg}}
465 \sseq@parseargspec@
466 }
467
468 \def\sseq@parseargspec@u#1{%
469 \sseq@e@addto@temptoks{\@nx\unexpanded{\sseq@thearg}\unexpanded{\unexpanded{#1}}}
470 \sseq@parseargspec@
471 }
472
473 \def\sseq@parseargspec@U#1{%
474 \sseq@e@addto@temptoks{\@nx\unexpanded{\sseq@thearg}}
475 \sseq@parseargspec@
476 }
477
478 % Optional no default
479 \def\sseq@parseargspec@o{%
480 \sseq@e@addto@temptoks{\@nx\IfNoValueF{\sseq@thearg}{[\@nx\unexpanded{\sseq@thearg}]}}
481 \sseq@parseargspec@
482 }
483
484 \def\sseq@parseargspec@d#1#2{%
485 \sseq@e@addto@temptoks{\@nx\IfNoValueF{\sseq@thearg}{\@nx\unexpanded{#1\sseq@thearg#2}}}
486 \sseq@parseargspec@
487 }
488
489 \def\sseq@parseargspec@r#1#2{ % technically required, but behaves like optional
490 \sseq@e@addto@temptoks{#1\@nx\unexpanded{\sseq@thearg}#2}
491 \sseq@parseargspec@
492 }
493
494
495 \def\sseq@parseargspec@g{%
496 \sseq@e@addto@temptoks{\@nx\IfNoValueF{\sseq@thearg}{\@nx\unexpanded{{\sseq@thearg}}}}
497 \sseq@parseargspec@
498 }
499
500 \def\sseq@parseargspec@s{%
501 \sseq@e@addto@temptoks{\@nx\IfBooleanT{\sseq@thearg}{*}}
502 \sseq@parseargspec@
503 }
504
505 \def\sseq@parseargspec@t#1{%
506 \sseq@e@addto@temptoks{\@nx\IfBooleanT{\sseq@thearg}{#1}}
507 \sseq@parseargspec@
508 }
509
510 % Optional with default
511
512 \def\sseq@parseargspec@O#1{
513 \sseq@parseargspec@setargdefault{#1}%
514 \sseq@e@addto@temptoks{\sseq@parseargspec@ifargisnotdefault{\@nx\unexpanded{[\sseq@thearg]}}}%
515 \sseq@parseargspec@
516 }
517 \def\sseq@parseargspec@D#1#2#3{%
518 \sseq@parseargspec@setargdefault{#3}%
519 \sseq@e@addto@temptoks{\sseq@parseargspec@ifargisnotdefault{\@nx\unexpanded{#1\sseq@thearg#2}}}%
520 \sseq@parseargspec@
521 }
522 \def\sseq@parseargspec@R#1#2#3{%
523 \sseq@parseargspec@setargdefault{#3}%
524 \sseq@e@addto@temptoks{\sseq@parseargspec@ifargisnotdefault{\@nx\unexpanded{#1\sseq@thearg#2}}}%
525 \sseq@parseargspec@
526 }
527 \def\sseq@parseargspec@G#1{%
528 \sseq@parseargspec@setargdefault{#1}%
529 \sseq@e@addto@temptoks{\sseq@parseargspec@ifargisnotdefault{\@nx\unexpanded{{\sseq@thearg}}}}%
530 \sseq@parseargspec@
531 }
532
533 \ExplSyntaxOff
534
535 %