%% %% This is file `l3expan.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3expan.dtx (with options: `package') %% %% EXPERIMENTAL CODE %% %% Do not distribute this file without also distributing the %% source files specified above. %% %% Do not distribute a modified version of this file. %% %% File: l3expan.dtx Copyright (C) 1990-2011 The LaTeX3 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 "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% The released version of this bundle is available from CTAN. %% %% ----------------------------------------------------------------------- %% %% The development version of the bundle can be found at %% %% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% %%%%%%%%%%% %% NOTE: %% %%%%%%%%%%% %% %% Snapshots taken from the repository represent work in progress and may %% not work or may contain conflicting material! We therefore ask %% people _not_ to put them into distributions, archives, etc. without %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} \GetIdInfo$Id: l3expan.dtx 2812 2011-09-12 09:19:26Z bruno $ {L3 Experimental argument expansion} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \cs_new_nopar:Npn \l_exp_tl { } \cs_new:Npn \exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } } \cs_new:Npn \exp_arg_next_nobrace:nnn #1#2#3 { #2 \::: { #3 #1 } } \cs_new:Npn \::: #1 {#1} \cs_new:Npn \::n #1 \::: #2#3 { #1 \::: { #2 {#3} } } \cs_new:Npn \::N #1 \::: #2#3 { #1 \::: {#2#3} } \cs_new:Npn \::c #1 \::: #2#3 { \exp_after:wN \exp_arg_next_nobrace:nnn \cs:w #3 \cs_end: {#1} {#2} } \cs_new:Npn \::o #1 \::: #2#3 { \exp_after:wN \exp_arg_next:nnn \exp_after:wN {#3} {#1} {#2} } \cs_new:Npn \::f #1 \::: #2#3 { \exp_after:wN \exp_arg_next:nnn \exp_after:wN { \tex_romannumeral:D -`0 #3 } {#1} {#2} } \use:nn { \cs_new_eq:NN \exp_stop_f: } { ~ } \cs_new_protected:Npn \::x #1 \::: #2#3 { \cs_set_nopar:Npx \l_exp_tl { {#3} } \exp_after:wN \exp_arg_next:nnn \l_exp_tl {#1} {#2} } \cs_new:Npn \::V #1 \::: #2#3 { \exp_after:wN \exp_arg_next:nnn \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } {#1} {#2} } \cs_new:Npn \::v # 1\::: #2#3 { \exp_after:wN \exp_arg_next:nnn \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#3} } {#1} {#2} } \cs_new_nopar:Npn \exp_eval_register:N #1 { \exp_after:wN \if_meaning:w \exp_not:N #1 #1 \if_meaning:w \scan_stop: #1 \exp_eval_error_msg:w \fi: \else: \exp_after:wN \use_i_ii:nnn \fi: \exp_after:wN \c_zero \tex_the:D #1 } \cs_new_nopar:Npn \exp_eval_register:c #1 { \exp_after:wN \exp_eval_register:N \cs:w #1 \cs_end: } \cs_new:Npn \exp_eval_error_msg:w #1 \tex_the:D #2 { \fi: \fi: \msg_expandable_error:n { Erroneous ~ variable ~ #2 used! } \c_zero } \cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} } \cs_new:Npn \exp_args:NNo #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN {#3} } \cs_new:Npn \exp_args:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN#2 \exp_after:wN #3 \exp_after:wN {#4} } \cs_new:Npn \exp_args:cc #1#2 { \cs:w #1 \exp_after:wN \cs_end: \cs:w #2 \cs_end: } \cs_new:Npn \exp_args:NNc #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \cs:w # 3\cs_end: } \cs_new:Npn \exp_args:Ncc #1#2#3 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \cs:w #3 \cs_end: } \cs_new:Npn \exp_args:Nccc #1#2#3#4 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \cs:w #3 \exp_after:wN \cs_end: \cs:w #4 \cs_end: } \cs_new:Npn \exp_args:Nf #1#2 { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D -`0 #2 } } \cs_new:Npn \exp_args:Nv #1#2 { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#2} } } \cs_new:Npn \exp_args:NV #1#2 { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #2 } } \cs_new:Npn \exp_args:NNf #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN { \tex_romannumeral:D -`0 #3 } } \cs_new:Npn \exp_args:NNv #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#3} } } \cs_new:Npn \exp_args:NNV #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } } \cs_new:Npn \exp_args:Nco #1#2#3 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \exp_after:wN {#3} } \cs_new:Npn \exp_args:Ncf #1#2#3 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \exp_after:wN { \tex_romannumeral:D -`0 #3 } } \cs_new_nopar:Npn \exp_args:NVV #1#2#3 { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D \exp_after:wN \exp_eval_register:N \exp_after:wN #2 \exp_after:wN } \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } } \cs_new:Npn \exp_args:NNNV #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #4 } } \cs_new:Npn \exp_args:NcNc #1#2#3#4 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \exp_after:wN #3 \cs:w #4 \cs_end: } \cs_new:Npn \exp_args:NcNo #1#2#3#4 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \exp_after:wN #3 \exp_after:wN {#4} } \cs_new:Npn \exp_args:Ncco #1#2#3#4 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \cs:w #3 \exp_after:wN \cs_end: \exp_after:wN {#4} } \cs_new_protected_nopar:Npn \exp_args:Nx { \::x \::: } \cs_new_nopar:Npn \exp_args:Nnc { \::n \::c \::: } \cs_new_nopar:Npn \exp_args:Nfo { \::f \::o \::: } \cs_new_nopar:Npn \exp_args:Nff { \::f \::f \::: } \cs_new_nopar:Npn \exp_args:Nnf { \::n \::f \::: } \cs_new_nopar:Npn \exp_args:Nno { \::n \::o \::: } \cs_new_nopar:Npn \exp_args:NnV { \::n \::V \::: } \cs_new_nopar:Npn \exp_args:Noc { \::o \::c \::: } \cs_new_nopar:Npn \exp_args:Noo { \::o \::o \::: } \cs_new_protected_nopar:Npn \exp_args:NNx { \::N \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Ncx { \::c \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nnx { \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nox { \::o \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nxo { \::x \::o \::: } \cs_new_protected_nopar:Npn \exp_args:Nxx { \::x \::x \::: } \cs_new_nopar:Npn \exp_args:NNno { \::N \::n \::o \::: } \cs_new_nopar:Npn \exp_args:NNoo { \::N \::o \::o \::: } \cs_new_nopar:Npn \exp_args:Nnnc { \::n \::n \::c \::: } \cs_new_nopar:Npn \exp_args:Nnno { \::n \::n \::o \::: } \cs_new_nopar:Npn \exp_args:Nooo { \::o \::o \::o \::: } \cs_new_protected_nopar:Npn \exp_args:NNnx { \::N \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:NNox { \::N \::o \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nnnx { \::n \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nnox { \::n \::o \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nccx { \::c \::c \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Ncnx { \::c \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Noox { \::o \::o \::x \::: } \cs_new:Npn \exp_arg_last_unbraced:nn #1#2 { #2#1 } \cs_new:Npn \::f_unbraced \::: #1#2 { \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN { \tex_romannumeral:D -`0 #2 } {#1} } \cs_new:Npn \::o_unbraced \::: #1#2 { \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN {#2} {#1} } \cs_new:Npn \::V_unbraced \::: #1#2 { \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #2 } {#1} } \cs_new:Npn \::v_unbraced \::: #1#2 { \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#2} } {#1} } \cs_new:Npn \exp_last_unbraced:NV #1#2 { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:N #2 } \cs_new:Npn \exp_last_unbraced:Nv #1#2 { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:c {#2} } \cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 } \cs_new:Npn \exp_last_unbraced:Nf #1#2 { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 } \cs_new:Npn \exp_last_unbraced:NcV #1#2#3 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \tex_romannumeral:D \exp_eval_register:N #3 } \cs_new:Npn \exp_last_unbraced:NNV #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \tex_romannumeral:D \exp_eval_register:N #3 } \cs_new:Npn \exp_last_unbraced:NNo #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 #3 } \cs_new_nopar:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: } \cs_new_nopar:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: } \cs_new_nopar:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: } \cs_new:Npn \exp_last_unbraced:NNNV #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 \tex_romannumeral:D \exp_eval_register:N #4 } \cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 } \cs_new:Npn \exp_last_two_unbraced:Noo #1#2#3 { \exp_after:wN \exp_last_two_unbraced_aux:nnN \exp_after:wN {#3} {#2} #1 } \cs_new:Npn \exp_last_two_unbraced_aux:nnN #1#2#3 { \exp_after:wN #3 #2 #1 } \cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} } \cs_new:Npn \exp_not:f #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D -`0 #1 } } \cs_new:Npn \exp_not:V #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #1 } } \cs_new:Npn \exp_not:v #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#1} } } \cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: } \cs_new_protected:Npn \cs_generate_variant:Nn #1 { \chk_if_exist_cs:N #1 \cs_split_function:NN #1 \cs_generate_variant_aux:nnNNn #1 } \cs_new:Npn \cs_generate_variant_aux:nnNNn #1#2#3#4#5 { \cs_generate_variant_aux:Nnnw #4 {#1}{#2} #5 , ? , \q_recursion_stop } \cs_new:Npn \cs_generate_variant_aux:Nnnw #1#2#3#4 , { \if:w ? #4 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: \exp_args:NNc \cs_generate_variant_aux:NNn #1 { #2 : #4 \use:c { use_none: \cs_generate_variant_aux:N #4 ? } #3 } {#4} \cs_generate_variant_aux:Nnnw #1 {#2} {#3} } \cs_new:Npn \cs_generate_variant_aux:NNn #1 #2 #3 { \cs_if_free:NTF #2 { \cs_generate_variant_aux:NNpx #1 #2 { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } \cs_generate_internal_variant:n {#3} } { \iow_log:x { Variant~\token_to_str:N #2~% already~defined;~ not~ changing~ it~on~line~% \tex_the:D \tex_inputlineno:D } } } \cs_new:Npn \cs_generate_variant_aux:N #1 { \if:w ? #1 \exp_after:wN \use_none:nn \fi: n \cs_generate_variant_aux:N } \group_begin: \tex_lccode:D `\Z = `\d \scan_stop: \tex_lccode:D `\? =`\\ \scan_stop: \tex_catcode:D `\P = 12 \scan_stop: \tex_catcode:D `\R = 12 \scan_stop: \tex_catcode:D `\O = 12 \scan_stop: \tex_catcode:D `\T = 12 \scan_stop: \tex_catcode:D `\E = 12 \scan_stop: \tex_catcode:D `\C = 12 \scan_stop: \tex_catcode:D `\Z = 12 \scan_stop: \tex_lowercase:D { \group_end: \cs_new_nopar:Npn \cs_generate_variant_aux:NNpx #1 { \exp_after:wN \cs_generate_variant_aux:w \token_to_meaning:N #1 ? PROTECTEZ \q_stop } \cs_new:Npn \cs_generate_variant_aux:w #1 ? PROTECTEZ #2 \q_stop { \if_catcode:w a \etex_detokenize:D \exp_after:wN {#1} a \exp_after:wN \cs_new_protected_nopar:Npx \else: \exp_after:wN \cs_new_nopar:Npx \fi: } } \cs_new_protected:Npn \cs_generate_internal_variant:n #1 { \cs_if_free:cT { exp_args:N #1 } { \cs_new:cpx { exp_args:N #1 } { \cs_generate_internal_variant_aux:N #1 : } } } \cs_new:Npn \cs_generate_internal_variant_aux:N #1 { \exp_not:c { :: #1 } \if_meaning:w #1 : \exp_after:wN \use_none:n \fi: \cs_generate_internal_variant_aux:N } \cs_generate_variant:Nn \str_if_eq_p:nn { V , o } \cs_generate_variant:Nn \str_if_eq_p:nn { nV , no , VV } \cs_generate_variant:Nn \str_if_eq:nnT { V , o } \cs_generate_variant:Nn \str_if_eq:nnT { nV , no , VV } \cs_generate_variant:Nn \str_if_eq:nnF { V , o } \cs_generate_variant:Nn \str_if_eq:nnF { nV , no , VV } \cs_generate_variant:Nn \str_if_eq:nnTF { V , o } \cs_generate_variant:Nn \str_if_eq:nnTF { nV , no , VV } %% %% %% End of file `l3expan.sty'.