summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-07-23 17:15:00 +0000
committerKarl Berry <karl@freefriends.org>2012-07-23 17:15:00 +0000
commit134349701bddf7cbbacf6030c6b9f9838aff96fa (patch)
treeec1140c46e1c0347a671a6fa3cf8af5a79e95f93 /Master/texmf-dist/tex/latex/l3kernel/l3clist.sty
parentf7855c12c18bb97b7b9e49ab685ee558d8c0b47b (diff)
l3kernel 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27108 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3clist.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3kernel/l3clist.sty415
1 files changed, 174 insertions, 241 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty
index 75ef38900cc..1f78b1b4851 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty
@@ -48,13 +48,14 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}
-\GetIdInfo$Id: l3clist.dtx 3490 2012-03-04 01:00:53Z bruno $
- {L3 Experimental comma separated lists}
+\GetIdInfo$Id: l3clist.dtx 3986 2012-07-15 19:23:51Z joseph $
+ {L3 Comma separated lists}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
-\tl_new:N \l_clist_internal_clist
-\cs_new_protected:Npn \clist_tmp:w { }
+\__expl_package_check:
+\cs_new_eq:NN \c_empty_clist \c_empty_tl
+\tl_new:N \l__clist_internal_clist
+\cs_new_protected:Npn \__clist_tmp:w { }
\cs_new_eq:NN \clist_new:N \tl_new:N
\cs_new_eq:NN \clist_new:c \tl_new:c
\cs_new_eq:NN \clist_clear:N \tl_clear:N
@@ -74,10 +75,10 @@
\cs_new_eq:NN \clist_gset_eq:cN \tl_gset_eq:cN
\cs_new_eq:NN \clist_gset_eq:cc \tl_gset_eq:cc
\cs_new_protected_nopar:Npn \clist_concat:NNN
- { \clist_concat_aux:NNNN \tl_set:Nx }
+ { \__clist_concat:NNNN \tl_set:Nx }
\cs_new_protected_nopar:Npn \clist_gconcat:NNN
- { \clist_concat_aux:NNNN \tl_gset:Nx }
-\cs_new_protected:Npn \clist_concat_aux:NNNN #1#2#3#4
+ { \__clist_concat:NNNN \tl_gset:Nx }
+\cs_new_protected:Npn \__clist_concat:NNNN #1#2#3#4
{
#1 #2
{
@@ -96,102 +97,133 @@
\cs_new_eq:NN \clist_if_exist:cT \cs_if_exist:cT
\cs_new_eq:NN \clist_if_exist:cF \cs_if_exist:cF
\cs_new_eq:NN \clist_if_exist_p:c \cs_if_exist_p:c
-\cs_set:Npn \clist_tmp:w #1
+\cs_new:Npn \__clist_trim_spaces_generic:nw #1#2 ,
{
- \cs_new:Npn \clist_trim_spaces_generic:nw ##1 ##2 ,
- {
- \tl_trim_spaces_aux_i:w
- ##2
- \q_nil
- \q_mark #1 { }
- \q_mark \tl_trim_spaces_aux_ii:w
- \tl_trim_spaces_aux_iii:w
- #1 \q_nil
- \clist_trim_spaces_generic_aux:w
- \q_stop
- {##1}
- }
+ \__tl_trim_spaces:nn {#2}
+ { \exp_args:No \__clist_trim_spaces_generic:nn } {#1}
}
-\clist_tmp:w {~}
-\cs_new:Npn \clist_trim_spaces_generic_aux:w #1 \q_nil #2 \q_stop
- { \exp_args:No \clist_trim_spaces_generic_aux_ii:nn { \use_none:n #1 } }
-\cs_new:Npn \clist_trim_spaces_generic_aux_ii:nn #1 #2 { #2 {#1} }
-\cs_new:Npn \clist_trim_spaces:n #1
+\cs_new:Npn \__clist_trim_spaces_generic:nn #1#2 { #2 {#1} }
+\cs_new:Npn \__clist_trim_spaces:n #1
{
- \clist_trim_spaces_generic:nw
- { \clist_trim_spaces_aux:nn { } }
+ \__clist_trim_spaces_generic:nw
+ { \__clist_trim_spaces_ii:nn { } }
\q_mark #1 ,
\q_recursion_tail, \q_recursion_stop
}
-\cs_new:Npn \clist_trim_spaces_aux:nn #1 #2
+\cs_new:Npn \__clist_trim_spaces_ii:nn #1 #2
{
\quark_if_recursion_tail_stop:n {#2}
\tl_if_empty:nTF {#2}
{
- \clist_trim_spaces_generic:nw
- { \clist_trim_spaces_aux:nn {#1} } \q_mark
+ \__clist_trim_spaces_generic:nw
+ { \__clist_trim_spaces_ii:nn {#1} } \q_mark
}
{
#1 \exp_not:n {#2}
- \clist_trim_spaces_generic:nw
- { \clist_trim_spaces_aux:nn { , } } \q_mark
+ \__clist_trim_spaces_generic:nw
+ { \__clist_trim_spaces_ii:nn { , } } \q_mark
}
}
\cs_new_protected:Npn \clist_set:Nn #1#2
- { \tl_set:Nx #1 { \clist_trim_spaces:n {#2} } }
+ { \tl_set:Nx #1 { \__clist_trim_spaces:n {#2} } }
\cs_new_protected:Npn \clist_gset:Nn #1#2
- { \tl_gset:Nx #1 { \clist_trim_spaces:n {#2} } }
+ { \tl_gset:Nx #1 { \__clist_trim_spaces:n {#2} } }
\cs_generate_variant:Nn \clist_set:Nn { NV , No , Nx , c , cV , co , cx }
\cs_generate_variant:Nn \clist_gset:Nn { NV , No , Nx , c , cV , co , cx }
\cs_new_protected_nopar:Npn \clist_put_left:Nn
- { \clist_put_left_aux:NNNn \clist_concat:NNN \clist_set:Nn }
+ { \__clist_put_left:NNNn \clist_concat:NNN \clist_set:Nn }
\cs_new_protected_nopar:Npn \clist_gput_left:Nn
- { \clist_put_left_aux:NNNn \clist_gconcat:NNN \clist_set:Nn }
-\cs_new_protected:Npn \clist_put_left_aux:NNNn #1#2#3#4
+ { \__clist_put_left:NNNn \clist_gconcat:NNN \clist_set:Nn }
+\cs_new_protected:Npn \__clist_put_left:NNNn #1#2#3#4
{
- #2 \l_clist_internal_clist {#4}
- #1 #3 \l_clist_internal_clist #3
+ #2 \l__clist_internal_clist {#4}
+ #1 #3 \l__clist_internal_clist #3
}
\cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx }
\cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx }
\cs_generate_variant:Nn \clist_gput_left:Nn { NV , No , Nx }
\cs_generate_variant:Nn \clist_gput_left:Nn { c , cV , co , cx }
\cs_new_protected_nopar:Npn \clist_put_right:Nn
- { \clist_put_right_aux:NNNn \clist_concat:NNN \clist_set:Nn }
+ { \__clist_put_right:NNNn \clist_concat:NNN \clist_set:Nn }
\cs_new_protected_nopar:Npn \clist_gput_right:Nn
- { \clist_put_right_aux:NNNn \clist_gconcat:NNN \clist_gset:Nn }
-\cs_new_protected:Npn \clist_put_right_aux:NNNn #1#2#3#4
+ { \__clist_put_right:NNNn \clist_gconcat:NNN \clist_gset:Nn }
+\cs_new_protected:Npn \__clist_put_right:NNNn #1#2#3#4
{
- #2 \l_clist_internal_clist {#4}
- #1 #3 #3 \l_clist_internal_clist
+ #2 \l__clist_internal_clist {#4}
+ #1 #3 #3 \l__clist_internal_clist
}
\cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx }
\cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx }
\cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx }
\cs_generate_variant:Nn \clist_gput_right:Nn { c , cV , co , cx }
\cs_new_protected:Npn \clist_get:NN #1#2
- { \exp_after:wN \clist_get_aux:wN #1 , \q_stop #2 }
-\cs_new_protected:Npn \clist_get_aux:wN #1 , #2 \q_stop #3
+ {
+ \if_meaning:w #1 \c_empty_clist
+ \tl_set:Nn #2 { \q_no_value }
+ \else:
+ \exp_after:wN \__clist_get:wN #1 , \q_stop #2
+ \fi:
+ }
+\cs_new_protected:Npn \__clist_get:wN #1 , #2 \q_stop #3
{ \tl_set:Nn #3 {#1} }
\cs_generate_variant:Nn \clist_get:NN { c }
\cs_new_protected_nopar:Npn \clist_pop:NN
- { \clist_pop_aux:NNN \tl_set:Nf }
+ { \__clist_pop:NNN \tl_set:Nx }
\cs_new_protected_nopar:Npn \clist_gpop:NN
- { \clist_pop_aux:NNN \tl_gset:Nf }
-\cs_new_protected:Npn \clist_pop_aux:NNN #1#2#3
+ { \__clist_pop:NNN \tl_gset:Nx }
+\cs_new_protected:Npn \__clist_pop:NNN #1#2#3
{
- \exp_after:wN \clist_pop_aux:wNNN #2 , \q_nil \q_stop #1#2#3
+ \if_meaning:w #2 \c_empty_clist
+ \tl_set:Nn #3 { \q_no_value }
+ \else:
+ \exp_after:wN \__clist_pop:wwNNN #2 , \q_mark \q_stop #1#2#3
+ \fi:
}
-\cs_new_protected:Npn \clist_pop_aux:wNNN #1 , #2 \q_stop #3#4#5
+\cs_new_protected:Npn \__clist_pop:wwNNN #1 , #2 \q_stop #3#4#5
{
\tl_set:Nn #5 {#1}
- \quark_if_nil:nTF {#2}
- { #3 #4 { } }
- { #3 #4 { \clist_pop_aux:w \exp_stop_f: #2 } }
+ #3 #4
+ {
+ \__clist_pop:wN \prg_do_nothing:
+ #2 \exp_not:o
+ , \q_mark \use_none:n
+ \q_stop
+ }
}
-\cs_new_protected:Npn \clist_pop_aux:w #1 , \q_nil {#1}
+\cs_new:Npn \__clist_pop:wN #1 , \q_mark #2 #3 \q_stop { #2 {#1} }
\cs_generate_variant:Nn \clist_pop:NN { c }
\cs_generate_variant:Nn \clist_gpop:NN { c }
+\prg_new_protected_conditional:Npnn \clist_get:NN #1#2 { T , F , TF }
+ {
+ \if_meaning:w #1 \c_empty_clist
+ \prg_return_false:
+ \else:
+ \exp_after:wN \__clist_get:wN #1 , \q_stop #2
+ \prg_return_true:
+ \fi:
+ }
+\cs_generate_variant:Nn \clist_get:NNT { c }
+\cs_generate_variant:Nn \clist_get:NNF { c }
+\cs_generate_variant:Nn \clist_get:NNTF { c }
+\prg_new_protected_conditional:Npnn \clist_pop:NN #1#2 { T , F , TF }
+ { \__clist_pop_TF:NNN \tl_set:Nx #1 #2 }
+\prg_new_protected_conditional:Npnn \clist_gpop:NN #1#2 { T , F , TF }
+ { \__clist_pop_TF:NNN \tl_gset:Nx #1 #2 }
+\cs_new_protected:Npn \__clist_pop_TF:NNN #1#2#3
+ {
+ \if_meaning:w #2 \c_empty_clist
+ \prg_return_false:
+ \else:
+ \exp_after:wN \__clist_pop:wwNNN #2 , \q_mark \q_stop #1#2#3
+ \prg_return_true:
+ \fi:
+ }
+\cs_generate_variant:Nn \clist_pop:NNT { c }
+\cs_generate_variant:Nn \clist_pop:NNF { c }
+\cs_generate_variant:Nn \clist_pop:NNTF { c }
+\cs_generate_variant:Nn \clist_gpop:NNT { c }
+\cs_generate_variant:Nn \clist_gpop:NNF { c }
+\cs_generate_variant:Nn \clist_gpop:NNTF { c }
\cs_new_eq:NN \clist_push:Nn \clist_put_left:Nn
\cs_new_eq:NN \clist_push:NV \clist_put_left:NV
\cs_new_eq:NN \clist_push:No \clist_put_left:No
@@ -208,40 +240,38 @@
\cs_new_eq:NN \clist_gpush:cV \clist_gput_left:cV
\cs_new_eq:NN \clist_gpush:co \clist_gput_left:co
\cs_new_eq:NN \clist_gpush:cx \clist_gput_left:cx
-\cs_new_eq:NN \clist_use:N \tl_use:N
-\cs_new_eq:NN \clist_use:c \tl_use:c
-\clist_new:N \l_clist_internal_remove_clist
+\clist_new:N \l__clist_internal_remove_clist
\cs_new_protected:Npn \clist_remove_duplicates:N
- { \clist_remove_duplicates_aux:NN \clist_set_eq:NN }
+ { \__clist_remove_duplicates:NN \clist_set_eq:NN }
\cs_new_protected:Npn \clist_gremove_duplicates:N
- { \clist_remove_duplicates_aux:NN \clist_gset_eq:NN }
-\cs_new_protected:Npn \clist_remove_duplicates_aux:NN #1#2
+ { \__clist_remove_duplicates:NN \clist_gset_eq:NN }
+\cs_new_protected:Npn \__clist_remove_duplicates:NN #1#2
{
- \clist_clear:N \l_clist_internal_remove_clist
+ \clist_clear:N \l__clist_internal_remove_clist
\clist_map_inline:Nn #2
{
- \clist_if_in:NnF \l_clist_internal_remove_clist {##1}
- { \clist_put_right:Nn \l_clist_internal_remove_clist {##1} }
+ \clist_if_in:NnF \l__clist_internal_remove_clist {##1}
+ { \clist_put_right:Nn \l__clist_internal_remove_clist {##1} }
}
- #1 #2 \l_clist_internal_remove_clist
+ #1 #2 \l__clist_internal_remove_clist
}
\cs_generate_variant:Nn \clist_remove_duplicates:N { c }
\cs_generate_variant:Nn \clist_gremove_duplicates:N { c }
\cs_new_protected:Npn \clist_remove_all:Nn
- { \clist_remove_all_aux:NNn \tl_set:Nx }
+ { \__clist_remove_all:NNn \tl_set:Nx }
\cs_new_protected:Npn \clist_gremove_all:Nn
- { \clist_remove_all_aux:NNn \tl_gset:Nx }
-\cs_new_protected:Npn \clist_remove_all_aux:NNn #1#2#3
+ { \__clist_remove_all:NNn \tl_gset:Nx }
+\cs_new_protected:Npn \__clist_remove_all:NNn #1#2#3
{
- \cs_set:Npn \clist_tmp:w ##1 , #3 ,
+ \cs_set:Npn \__clist_tmp:w ##1 , #3 ,
{
##1
, \q_mark , \use_none_delimit_by_q_stop:w ,
- \clist_remove_all_aux:
+ \__clist_remove_all:
}
#1 #2
{
- \exp_after:wN \clist_remove_all_aux:
+ \exp_after:wN \__clist_remove_all:
#2 , \q_mark , #3 , \q_stop
}
\clist_if_empty:NF #2
@@ -253,31 +283,27 @@
}
}
}
-\cs_new:Npn \clist_remove_all_aux:
- { \exp_after:wN \clist_remove_all_aux:w \clist_tmp:w , }
-\cs_new:Npn \clist_remove_all_aux:w #1 , \q_mark , #2 , { \exp_not:n {#1} }
+\cs_new:Npn \__clist_remove_all:
+ { \exp_after:wN \__clist_remove_all:w \__clist_tmp:w , }
+\cs_new:Npn \__clist_remove_all:w #1 , \q_mark , #2 , { \exp_not:n {#1} }
\cs_generate_variant:Nn \clist_remove_all:Nn { c }
\cs_generate_variant:Nn \clist_gremove_all:Nn { c }
\prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N { p , T , F , TF }
\prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c { p , T , F , TF }
-\prg_new_eq_conditional:NNn \clist_if_eq:NN \tl_if_eq:NN { p , T , F , TF }
-\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc { p , T , F , TF }
-\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN { p , T , F , TF }
-\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc { p , T , F , TF }
\prg_new_protected_conditional:Npnn \clist_if_in:Nn #1#2 { T , F , TF }
{
- \exp_args:No \clist_if_in_return:nn #1 {#2}
+ \exp_args:No \__clist_if_in_return:nn #1 {#2}
}
\prg_new_protected_conditional:Npnn \clist_if_in:nn #1#2 { T , F , TF }
{
- \clist_set:Nn \l_clist_internal_clist {#1}
- \exp_args:No \clist_if_in_return:nn \l_clist_internal_clist {#2}
+ \clist_set:Nn \l__clist_internal_clist {#1}
+ \exp_args:No \__clist_if_in_return:nn \l__clist_internal_clist {#2}
}
-\cs_new_protected:Npn \clist_if_in_return:nn #1#2
+\cs_new_protected:Npn \__clist_if_in_return:nn #1#2
{
- \cs_set:Npn \clist_tmp:w ##1 ,#2, { }
+ \cs_set:Npn \__clist_tmp:w ##1 ,#2, { }
\tl_if_empty:oTF
- { \clist_tmp:w ,#1, {} {} ,#2, }
+ { \__clist_tmp:w ,#1, {} {} ,#2, }
{ \prg_return_false: } { \prg_return_true: }
}
\cs_generate_variant:Nn \clist_if_in:NnT { NV , No }
@@ -293,48 +319,49 @@
{
\clist_if_empty:NF #1
{
- \exp_last_unbraced:NNo \clist_map_function_aux:Nw #2 #1
+ \exp_last_unbraced:NNo \__clist_map_function:Nw #2 #1
, \q_recursion_tail ,
- \prg_break_point:n { }
+ \__prg_break_point:Nn \clist_map_break: { }
}
}
-\cs_new:Npn \clist_map_function_aux:Nw #1#2 ,
+\cs_new:Npn \__clist_map_function:Nw #1#2 ,
{
- \quark_if_recursion_tail_break:n {#2}
+ \__quark_if_recursion_tail_break:nN {#2} \clist_map_break:
#1 {#2}
- \clist_map_function_aux:Nw #1
+ \__clist_map_function:Nw #1
}
\cs_generate_variant:Nn \clist_map_function:NN { c }
\cs_new:Npn \clist_map_function:nN #1#2
{
- \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 }
+ \__clist_trim_spaces_generic:nw { \__clist_map_function_n:Nn #2 }
\q_mark #1, \q_recursion_tail,
- \prg_break_point:n { }
+ \__prg_break_point:Nn \clist_map_break: { }
}
-\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2
+\cs_new:Npn \__clist_map_function_n:Nn #1 #2
{
- \quark_if_recursion_tail_break:n {#2}
- \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, }
- \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 }
+ \__quark_if_recursion_tail_break:nN {#2} \clist_map_break:
+ \tl_if_empty:nF {#2} { \__clist_map_unbrace:Nw #1 #2, }
+ \__clist_trim_spaces_generic:nw { \__clist_map_function_n:Nn #1 }
\q_mark
}
-\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} }
+\cs_new:Npn \__clist_map_unbrace:Nw #1 #2, { #1 {#2} }
\cs_new_protected:Npn \clist_map_inline:Nn #1#2
{
\clist_if_empty:NF #1
{
- \int_gincr:N \g_prg_map_int
- \cs_gset:cpn { clist_map_ \int_use:N \g_prg_map_int :n } ##1 {#2}
- \exp_last_unbraced:Nco \clist_map_function_aux:Nw
- { clist_map_ \int_use:N \g_prg_map_int :n }
+ \int_gincr:N \g__prg_map_int
+ \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2}
+ \exp_last_unbraced:Nco \__clist_map_function:Nw
+ { __prg_map_ \int_use:N \g__prg_map_int :w }
#1 , \q_recursion_tail ,
- \prg_break_point:n { \int_gdecr:N \g_prg_map_int }
+ \__prg_break_point:Nn \clist_map_break:
+ { \int_gdecr:N \g__prg_map_int }
}
}
\cs_new_protected:Npn \clist_map_inline:nn #1
{
- \clist_set:Nn \l_clist_internal_clist {#1}
- \clist_map_inline:Nn \l_clist_internal_clist
+ \clist_set:Nn \l__clist_internal_clist {#1}
+ \clist_map_inline:Nn \l__clist_internal_clist
}
\cs_generate_variant:Nn \clist_map_inline:Nn { c }
\cs_new_protected:Npn \clist_map_variable:NNn #1#2#3
@@ -342,177 +369,83 @@
\clist_if_empty:NF #1
{
\exp_args:Nno \use:nn
- { \clist_map_variable_aux:Nnw #2 {#3} }
+ { \__clist_map_variable:Nnw #2 {#3} }
#1
, \q_recursion_tail , \q_recursion_stop
- \prg_break_point:n { }
+ \__prg_break_point:Nn \clist_map_break: { }
}
}
\cs_new_protected:Npn \clist_map_variable:nNn #1
{
- \clist_set:Nn \l_clist_internal_clist {#1}
- \clist_map_variable:NNn \l_clist_internal_clist
+ \clist_set:Nn \l__clist_internal_clist {#1}
+ \clist_map_variable:NNn \l__clist_internal_clist
}
-\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3,
+\cs_new_protected:Npn \__clist_map_variable:Nnw #1#2#3,
{
\tl_set:Nn #1 {#3}
\quark_if_recursion_tail_stop:N #1
\use:n {#2}
- \clist_map_variable_aux:Nnw #1 {#2}
+ \__clist_map_variable:Nnw #1 {#2}
}
\cs_generate_variant:Nn \clist_map_variable:NNn { c }
-\cs_new_eq:NN \clist_map_break: \prg_map_break:
-\cs_new_eq:NN \clist_map_break:n \prg_map_break:n
-\cs_new_protected:Npn \clist_show:N #1
- {
- \msg_aux_show:Nnx
- #1
- { clist }
- { \clist_map_function:NN #1 \msg_aux_show:n }
- }
-\cs_new_protected:Npn \clist_show:n #1
- {
- \clist_set:Nn \l_clist_internal_clist {#1}
- \msg_aux_show:Nnx
- \l_clist_internal_clist
- { clist }
- { \clist_map_function:NN \l_clist_internal_clist \msg_aux_show:n }
- }
-\cs_generate_variant:Nn \clist_show:N { c }
-\clist_new:N \l_tmpa_clist
-\clist_new:N \l_tmpb_clist
-\clist_new:N \g_tmpa_clist
-\clist_new:N \g_tmpb_clist
-\cs_new:Npn \clist_length:N #1
+\cs_new_nopar:Npn \clist_map_break:
+ { \__prg_map_break:Nn \clist_map_break: { } }
+\cs_new_nopar:Npn \clist_map_break:n
+ { \__prg_map_break:Nn \clist_map_break: }
+\cs_new:Npn \clist_count:N #1
{
\int_eval:n
{
0
- \clist_map_function:NN #1 \clist_length_aux:n
+ \clist_map_function:NN #1 \__clist_count:n
}
}
-\cs_new:Npn \clist_length_aux:n #1 { +1 }
-\cs_new:Npx \clist_length:n #1
+\cs_generate_variant:Nn \clist_count:N { c }
+\cs_new:Npx \clist_count:n #1
{
\exp_not:N \int_eval:n
{
0
- \exp_not:N \clist_length_n_aux:w \c_space_tl
+ \exp_not:N \__clist_count:w \c_space_tl
#1 \exp_not:n { , \q_recursion_tail , \q_recursion_stop }
}
}
-\cs_new:Npx \clist_length_n_aux:w #1 ,
+\cs_new:Npn \__clist_count:n #1 { + \c_one }
+\cs_new:Npx \__clist_count:w #1 ,
{
\exp_not:n { \exp_args:Nf \quark_if_recursion_tail_stop:n } {#1}
\exp_not:N \tl_if_blank:nF {#1} { + \c_one }
- \exp_not:N \clist_length_n_aux:w \c_space_tl
+ \exp_not:N \__clist_count:w \c_space_tl
}
-\cs_generate_variant:Nn \clist_length:N { c }
-\cs_new:Npn \clist_item:Nn #1#2
+\cs_new_protected:Npn \clist_show:N #1
{
- \exp_args:Nfo \clist_item_aux:nnNn
- { \clist_length:N #1 }
+ \__msg_show_variable:Nnn
#1
- \clist_item_N_loop:nw
- {#2}
- }
-\cs_new:Npn \clist_item_aux:nnNn #1#2#3#4
- {
- \int_compare:nNnTF {#4} < \c_zero
- {
- \int_compare:nNnTF {#4} < { - #1 }
- { \use_none_delimit_by_q_stop:w }
- { \exp_args:Nf #3 { \int_eval:n { #4 + #1 } } }
- }
- {
- \int_compare:nNnTF {#4} < {#1}
- { #3 {#4} }
- { \use_none_delimit_by_q_stop:w }
- }
- #2, \q_stop
- }
-\cs_new:Npn \clist_item_N_loop:nw #1 #2,
- {
- \int_compare:nNnTF {#1} = \c_zero
- { \use_i_delimit_by_q_stop:nw { \exp_not:n {#2} } }
- { \exp_args:Nf \clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } }
- }
-\cs_generate_variant:Nn \clist_item:Nn { c }
-\cs_new:Npn \clist_item:nn #1#2
- {
- \exp_args:Nf \clist_item_aux:nnNn
- { \clist_length:n {#1} }
- {#1}
- \clist_item_n_aux:nw
- {#2}
- }
-\cs_new:Npn \clist_item_n_aux:nw #1
- { \clist_item_n_loop:nw {#1} \prg_do_nothing: }
-\cs_new:Npn \clist_item_n_loop:nw #1 #2,
- {
- \exp_args:No \tl_if_blank:nTF {#2}
- { \clist_item_n_loop:nw {#1} \prg_do_nothing: }
- {
- \int_compare:nNnTF {#1} = \c_zero
- { \exp_args:No \clist_item_n_end:n {#2} }
- {
- \exp_args:Nf \clist_item_n_loop:nw
- { \int_eval:n { #1 - 1 } }
- \prg_do_nothing:
- }
- }
- }
-\cs_new:Npn \clist_item_n_end:n #1 #2 \q_stop
- {
- \exp_after:wN \exp_after:wN \exp_after:wN \clist_item_n_strip:w
- \tl_trim_spaces:n {#1} ,
- }
-\cs_new:Npn \clist_item_n_strip:w #1 , { \exp_not:n {#1} }
-\cs_new_protected:Npn \clist_set_from_seq:NN
- { \clist_set_from_seq_aux:NNNN \clist_clear:N \tl_set:Nx }
-\cs_new_protected:Npn \clist_gset_from_seq:NN
- { \clist_set_from_seq_aux:NNNN \clist_gclear:N \tl_gset:Nx }
-\cs_new_protected:Npn \clist_set_from_seq_aux:NNNN #1#2#3#4
- {
- \seq_if_empty:NTF #4
- { #1 #3 }
- {
- #2 #3
- {
- \exp_last_unbraced:Nf \use_none:n
- { \seq_map_function:NN #4 \clist_wrap_item:n }
- }
- }
- }
-\cs_new:Npn \clist_wrap_item:n #1
- {
- ,
- \tl_if_empty:oTF { \clist_set_from_seq_aux:w #1 ~ , #1 ~ }
- { \exp_not:n {#1} }
- { \exp_not:n { {#1} } }
- }
-\cs_new:Npn \clist_set_from_seq_aux:w #1 , #2 ~ { }
-\cs_generate_variant:Nn \clist_set_from_seq:NN { Nc }
-\cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc }
-\cs_generate_variant:Nn \clist_gset_from_seq:NN { Nc }
-\cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc }
-\cs_new_protected:Npn \clist_const:Nn #1#2
- { \tl_const:Nx #1 { \clist_trim_spaces:n {#2} } }
-\cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx }
-\prg_new_conditional:Npnn \clist_if_empty:n #1 { p , T , F , TF }
- {
- \clist_if_empty_n_aux:w ? #1
- , \q_mark \prg_return_false:
- , \q_mark \prg_return_true:
- \q_stop
+ { clist }
+ { \clist_map_function:NN #1 \__msg_show_item:n }
}
-\cs_new:Npn \clist_if_empty_n_aux:w #1 ,
+\cs_new_protected:Npn \clist_show:n #1
{
- \tl_if_empty:oTF { \use_none:nn #1 ? }
- { \clist_if_empty_n_aux:w ? }
- { \clist_if_empty_n_aux:wNw }
+ \clist_set:Nn \l__clist_internal_clist {#1}
+ \__msg_show_variable:Nnn
+ \l__clist_internal_clist
+ { clist }
+ { \clist_map_function:NN \l__clist_internal_clist \__msg_show_item:n }
}
-\cs_new:Npn \clist_if_empty_n_aux:wNw #1 \q_mark #2#3 \q_stop {#2}
+\cs_generate_variant:Nn \clist_show:N { c }
+\clist_new:N \l_tmpa_clist
+\clist_new:N \l_tmpb_clist
+\clist_new:N \g_tmpa_clist
+\clist_new:N \g_tmpb_clist
+\prg_new_eq_conditional:NNn \clist__if_eq:NN \tl_if_eq:NN { p , T , F , TF }
+\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc { p , T , F , TF }
+\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN { p , T , F , TF }
+\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc { p , T , F , TF }
+\cs_new_eq:NN \clist_length:N \clist_count:N
+\cs_new_eq:NN \clist_length:n \clist_count:c
+\cs_new_eq:NN \clist_length:c \clist_count:n
+\cs_new_eq:NN \clist_use:N \tl_use:N
+\cs_new_eq:NN \clist_use:c \tl_use:c
%%
%%
%% End of file `l3clist.sty'.