diff options
author | Karl Berry <karl@freefriends.org> | 2011-08-13 22:19:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-08-13 22:19:08 +0000 |
commit | 5730d1c679f7a725b75ce80066cc6a6987aee888 (patch) | |
tree | def203d2e98df13d7d8b1f97444810f2c685a974 /Master/texmf-dist/tex/latex/l3kernel | |
parent | 8fdbc868b3cd64d89d3b4a172779aea071a118c5 (diff) |
l3kernel 2564 (13aug11)
git-svn-id: svn://tug.org/texlive/trunk@23540 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/expl3.sty | 5 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3doc.cls | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3expan.sty | 15 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3int.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty | 21 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3msg.sty | 21 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3names.sty | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3prg.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3quark.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3seq.sty | 23 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3tl.sty | 400 |
12 files changed, 342 insertions, 169 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 73956b2e93d..b802a008132 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -48,9 +48,8 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/08/10} -\def\ExplFileVersion{2535} - %\subsubsection{Variables: scope and type} +\def\ExplFileDate{2011/08/13} +\def\ExplFileVersion{2564} \RequirePackage{etex} \reserveinserts{32} \RequirePackage{calc} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty index 9b0e0c03fe4..4c575fdc144 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty @@ -94,7 +94,7 @@ {\def\ExplFileDate{#2}} \protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax {\def\ExplFileDate{#2/#3/#4}} -\GetIdInfo$Id: l3bootstrap.dtx 2519 2011-08-08 09:35:54Z mittelba $ +\GetIdInfo$Id: l3bootstrap.dtx 2558 2011-08-13 06:32:00Z joseph $ {L3 experimental bootstrap code} \ProvidesPackage{l3bootstrap} [% @@ -290,9 +290,9 @@ \protected\edef\ExplSyntaxNamesOff {% \expandafter\noexpand - \csname\detokenize{char_set_catcode_math_subscript:n}\endcsname{58}% + \csname\detokenize{char_set_catcode_other:n}\endcsname{58}% \expandafter\noexpand - \csname\detokenize{char_set_catcode_other:n}\endcsname{95}% + \csname\detokenize{char_set_catcode_math_subscript:n}\endcsname{95}% } %% %% diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index 258a8475eb9..00ef5ad8e58 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -52,7 +52,7 @@ \let \filedateOld \ExplFileDate \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription -\GetIdInfo$Id: l3doc.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3doc.dtx 2540 2011-08-10 23:39:33Z bruno $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty index 028e9cd3bc0..a818956cd5b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 2480 2011-06-20 17:25:23Z bruno $ +\GetIdInfo$Id: l3expan.dtx 2545 2011-08-11 13:47:19Z bruno $ {L3 Experimental argument expansion} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -98,12 +98,13 @@ } \cs_new_nopar:Npn \exp_eval_register:c #1 { \exp_after:wN \exp_eval_register:N \cs:w #1 \cs_end: } -\group_begin:% -\tex_catcode:D`\!=11\scan_stop:% -\tex_catcode:D`\ =11\scan_stop:% -\cs_new:Npn\exp_eval_error_msg:w#1\tex_the:D#2{% -\fi:\fi:\exp_after:wN\c_zero\erroneous variable used!}% -\group_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} } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index be7df6fe8c9..809ed14ab66 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2526 2011-08-09 08:58:42Z joseph $ +\GetIdInfo$Id: l3int.dtx 2551 2011-08-11 22:40:53Z bruno $ {L3 Experimental integers} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -531,7 +531,7 @@ } \cs_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4 { - \tl_if_head_eq_charcode:fNTF {#1} - + \exp_args:Nf \tl_if_head_eq_charcode:nNTF {#1} - { \bool_if:NTF #2 { @@ -544,7 +544,7 @@ } } { - \tl_if_head_eq_charcode:fNTF {#1} + + \exp_args:Nf \tl_if_head_eq_charcode:nNTF {#1} + { \int_get_sign_and_digits_aux:oNNN { \use_none:n #1 } #2#3#4 } { \bool_if:NT #3 { \bool_if:NF #2 - } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty index b7e63c89882..38e13e2b87b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3luatex.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3luatex.dtx 2545 2011-08-11 13:47:19Z bruno $ {L3 Experimental LuaTeX-specific functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -57,8 +57,16 @@ \cs_new_eq:NN \lua_shipout_x:n \luatex_latelua:D } { - \cs_new:Npn \lua_now:x #1 { \lua_wrong_engine: } - \cs_new_protected:Npn \lua_shipout_x:n #1 { \lua_wrong_engine: } + \cs_new:Npn \lua_now:x #1 + { + \msg_expandable_error:n + { LuaTeX~ engine~ not~ in~ use!~ Ignoring~ \lua_now:x. } + } + \cs_new_protected:Npn \lua_shipout_x:n #1 + { + \msg_expandable_error:n + { LuaTeX~ engine~ not~ in~ use!~ Ignoring~ \lua_shipout_x:n. } + } } \cs_new:Npn \lua_now:n #1 { \lua_now:x { \exp_not:n {#1} } } @@ -66,13 +74,6 @@ \cs_new_protected:Npn \lua_shipout:n #1 { \lua_shipout_x:n { \exp_not:n {#1} } } \cs_generate_variant:Nn \lua_shipout:n { x } -\group_begin: -\char_set_catcode_letter:N\! -\char_set_catcode_letter:N\ % -\cs_gset:Npn\lua_wrong_engine:{% -\LuaTeX engine not in use!% -}% -\group_end:% \int_new:N \g_cctab_allocate_int \int_set:Nn \g_cctab_allocate_int { -1 } \int_new:N \g_cctab_stack_int diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index bf1d732514f..43ccc081d3d 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3msg.dtx 2551 2011-08-11 22:40:53Z bruno $ {L3 Experimental messages} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -539,6 +539,13 @@ LaTeX~has~been~asked~to~recover~an~entry~from~a~sequence~that~ has~no~content:~that~cannot~happen! } +\msg_kernel_new:nnnn { tl } { empty-search-pattern } + { Empty~search~pattern. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~% + would~lead~to~an~infinite~loop! + } \cs_set_protected:Npn \msg_kernel_bug:x #1 { \msg_interrupt:xxx { \c_msg_kernel_bug_text_tl } @@ -556,6 +563,18 @@ This~probably~needs~examining~by~an~expert. \c_msg_return_text_tl } +\group_begin: +\cs_new:Npx \msg_expandable_error:n #1 + { + \exp_not:n + { + \exp_after:wN \exp_after:wN + \exp_after:wN \use_none_delimit_by_q_stop:w + } + \exp_not:N \use:n { \exp_not:c { LaTeX3 ~ error : } #1 } + \exp_not:N \q_stop + } +\group_end: \cs_new_eq:NN \msg_class_new:nn \msg_class_set:nn \cs_new_eq:NN \msg_trace:nnxxxx \msg_log:nnxxxx \cs_new_eq:NN \msg_trace:nnxxx \msg_log:nnxxx diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty index a504049d1ed..498af47ed47 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3names.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3names.dtx 2538 2011-08-10 19:37:10Z joseph $ {L3 Experimental namespace for primitives} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 349cb85655d..29ace90b700 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2509 2011-08-07 11:21:26Z bruno $ +\GetIdInfo$Id: l3prg.dtx 2553 2011-08-11 23:55:20Z bruno $ {L3 Experimental control structures} %% \ProvidesExplPackage @@ -307,7 +307,7 @@ { \str_if_eq:xxTF {#1} {#2} { \prg_case_end:nw {#3} } - { \prg_case_str_aux:nw {#1} } + { \prg_case_str_x_aux:nw {#1} } } \cs_new:Npn \prg_case_tl:Nnn #1#2#3 { \prg_case_tl_aux:Nw #1 #2 #1 {#3} \q_recursion_stop } @@ -435,7 +435,7 @@ \if_mode_math: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new_nopar:Npn \group_align_safe_begin: - { \if_false: { \fi: \if_int_compare:w `} = \c_zero \fi: } + { \if_int_compare:w \if_false: { \fi: `} = \c_zero \fi: } \cs_new_nopar:Npn \group_align_safe_end: { \if_int_compare:w `{ = \c_zero } \fi: } \cs_new_nopar:Npn \scan_align_safe_stop: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty index 35a8ca8f8e7..236b34b5a0a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3quark.dtx 2549 2011-08-11 21:06:39Z bruno $ {L3 Experimental quarks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -149,6 +149,8 @@ \cs_generate_variant:Nn \quark_if_nil:nTF { V , o } \cs_generate_variant:Nn \quark_if_nil:nT { V , o } \cs_generate_variant:Nn \quark_if_nil:nF { V , o } +\quark_new:N \q_tl_act_mark +\quark_new:N \q_tl_act_stop %% %% %% End of file `l3quark.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty index 13136da4828..ab1ec03f467 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -46,14 +46,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3seq.dtx 2556 2011-08-12 14:00:43Z bruno $ {L3 Experimental sequences and stacks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \cs_new:Npn \seq_item:n { - \seq_use_error: + \msg_expandable_error:n { A~sequence~was~used~incorrectly. } \use_none:n } \tl_new:N \l_seq_tmpa_tl @@ -522,6 +522,25 @@ \cs_generate_variant:Nn \seq_gset_from_clist:NN { Nc } \cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc } \cs_generate_variant:Nn \seq_gset_from_clist:Nn { c } +\cs_new_protected_nopar:Npn \seq_tmp:w + { \msg_expandable_error:n { There~is~a~bug~in~LaTeX3! } } +\cs_new_protected_nopar:Npn \seq_set_reverse:N + { \seq_reverse_aux:NN \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_reverse:N + { \seq_reverse_aux:NN \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_reverse_aux:NN #1 #2 + { + \cs_set_eq:NN \seq_tmp:w \seq_item:n + \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:w + #1 #2 { #2 \prg_do_nothing: } + \cs_set_eq:NN \seq_item:n \seq_tmp:w + } +\cs_new:Npn \seq_reverse_aux_item:w #1 #2 \prg_do_nothing: + { + #2 + \prg_do_nothing: + \exp_not:n { \seq_item:n {#1} } + } \cs_new_eq:NN \seq_top:NN \seq_get_left:NN \cs_new_eq:NN \seq_top:cN \seq_get_left:cN \cs_new_eq:NN \seq_display:N \seq_show:N diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty index e86c27e6c34..b37aa775085 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2534 2011-08-10 18:21:44Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2563 2011-08-13 12:23:59Z joseph $ {L3 Experimental token lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -175,6 +175,7 @@ \group_begin: \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl } \tex_endlinechar:D \c_minus_one + \tex_newlinechar:D \c_minus_one #3 \tl_clear:N \l_tl_rescan_tl \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#4} @@ -201,6 +202,7 @@ \group_begin: \etex_everyeof:D { \exp_not:N } \tex_endlinechar:D \c_minus_one + \tex_newlinechar:D \c_minus_one #3 \tl_set:Nx \l_tl_rescan_tl { \etex_scantokens:D {#4} } \exp_args:NNNo \group_end: @@ -213,6 +215,7 @@ \group_begin: \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl } \tex_endlinechar:D \c_minus_one + \tex_newlinechar:D \c_minus_one #1 \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#2} \exp_args:No \group_end: @@ -222,60 +225,53 @@ \cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D \tl_new:N \l_tl_replace_tl \cs_new_protected_nopar:Npn \tl_replace_once:Nnn - { \tl_replace_once_aux:NNnn \tl_set_eq:NN } + { \tl_replace_aux:NNNnn \tl_replace_once_aux: \tl_set:Nx } \cs_new_protected_nopar:Npn \tl_greplace_once:Nnn - { \tl_replace_once_aux:NNnn \tl_gset_eq:NN } -\cs_new_protected:Npn \tl_replace_once_aux:NNnn #1#2#3#4 + { \tl_replace_aux:NNNnn \tl_replace_once_aux: \tl_gset:Nx } +\cs_new_protected_nopar:Npn \tl_replace_all:Nnn + { \tl_replace_aux:NNNnn \tl_replace_all_aux: \tl_set:Nx } +\cs_new_protected_nopar:Npn \tl_greplace_all:Nnn + { \tl_replace_aux:NNNnn \tl_replace_all_aux: \tl_gset:Nx } +\cs_generate_variant:Nn \tl_replace_once:Nnn { c } +\cs_generate_variant:Nn \tl_greplace_once:Nnn { c } +\cs_generate_variant:Nn \tl_replace_all:Nnn { c } +\cs_generate_variant:Nn \tl_greplace_all:Nnn { c } +\cs_new_protected:Npn \tl_replace_aux:NNNnn #1#2#3#4#5 { - \cs_set_protected:Npx \tl_tmp:w ##1 #3 ##2 \q_stop + \tl_if_empty:nTF {#4} + { + \msg_kernel_error:nnx { tl } { empty-search-pattern } + { \tl_to_str:n {#5} } + } { - \exp_not:N \quark_if_no_value:nF {##2} + \cs_set:Npx \tl_tmp:w ##1##2 #4 { - \tl_set:No \exp_not:N \l_tl_replace_tl { ##1 \exp_not:n{#4} } - \exp_not:n - { - \cs_set_protected:Npn \tl_tmp:w ##1 \q_nil #3 \q_no_value - { \tl_put_right:No \l_tl_replace_tl {##1} } - } - \exp_not:n { \tl_tmp:w \prg_do_nothing: } ##2 - \exp_not:n { #1 #2 \l_tl_replace_tl } + ##2 + \exp_not:N \q_mark + \exp_not:N \use_none_delimit_by_q_stop:w + \exp_not:n { \exp_not:n {#5} } + ##1 + } + #2 #3 + { + \exp_after:wN #1 + #3 \q_mark #4 \q_stop } } - \exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing: - #2 \q_nil #3 \q_no_value \q_stop } -\cs_generate_variant:Nn \tl_replace_once:Nnn { c } -\cs_generate_variant:Nn \tl_greplace_once:Nnn { c } -\cs_new_protected_nopar:Npn \tl_replace_all:Nnn - { \tl_replace_all_aux:NNnn \tl_set_eq:NN } -\cs_new_protected_nopar:Npn \tl_greplace_all:Nnn - { \tl_replace_all_aux:NNnn \tl_gset_eq:NN } -\cs_new_protected:Npn \tl_replace_all_aux:NNnn #1#2#3#4 - { - \tl_clear:N \l_tl_replace_tl - \cs_set_protected:Npx \tl_tmp:w ##1 #3 ##2 \q_stop - { - \exp_not:N \quark_if_no_value:nTF {##2} - { - \exp_not:n - { - \cs_set_protected:Npn \tl_tmp:w ##1 \q_nil ##2 \q_stop - { \tl_put_right:No \l_tl_replace_tl {##1} } - } - \exp_not:N \tl_tmp:w ##1 \exp_not:N \q_stop - } - { - \exp_not:n { \tl_put_right:No \l_tl_replace_tl } - { ##1 \exp_not:n{#4} } - \exp_not:n { \tl_tmp:w \prg_do_nothing: } ##2 \exp_not:N \q_stop - } - } - \exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing: - #2 \q_nil #3 \q_no_value \q_stop - #1 #2 \l_tl_replace_tl - } -\cs_generate_variant:Nn \tl_replace_all:Nnn { c } -\cs_generate_variant:Nn \tl_greplace_all:Nnn { c } +\cs_new:Npn \tl_replace_aux_ii:w #1 \q_mark #2 { \exp_not:o {#1} } +\cs_new:Npn \tl_replace_all_aux: + { + \exp_after:wN \tl_replace_aux_ii:w + \tl_tmp:w \tl_replace_all_aux: \prg_do_nothing: + } +\cs_new_nopar:Npn \tl_replace_once_aux: + { + \exp_after:wN \tl_replace_aux_ii:w + \tl_tmp:w { \tl_replace_once_aux_end:w \prg_do_nothing: } \prg_do_nothing: + } +\cs_new:Npn \tl_replace_once_aux_end:w #1 \q_mark #2 \q_stop + { \exp_not:o {#1} } \cs_new_protected_nopar:Npn \tl_remove_once:Nn #1#2 { \tl_replace_once:Nnn #1 {#2} { } } \cs_new_protected_nopar:Npn \tl_gremove_once:Nn #1#2 @@ -310,26 +306,28 @@ \cs_generate_variant:Nn \tl_if_empty:NT { c } \cs_generate_variant:Nn \tl_if_empty:NF { c } \cs_generate_variant:Nn \tl_if_empty:NTF { c } -\prg_new_conditional:Npnn \tl_if_empty:n #1 { p,TF,T,F} { - \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n {#1} \q_nil - \prg_return_true: - \else: - \prg_return_false: - \fi: -} +\prg_new_conditional:Npnn \tl_if_empty:n #1 { p , TF , T , F } + { + \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n {#1} \q_nil + \prg_return_true: + \else: + \prg_return_false: + \fi: + } \cs_generate_variant:Nn \tl_if_empty_p:n { V } \cs_generate_variant:Nn \tl_if_empty:nTF { V } \cs_generate_variant:Nn \tl_if_empty:nT { V } \cs_generate_variant:Nn \tl_if_empty:nF { V } -\cs_new:Npn \tl_if_empty_return:o #1 { - \exp_after:wN \if_meaning:w \exp_after:wN \q_nil - \tl_to_str:n \exp_after:wN {#1} \q_nil - \prg_return_true: - \else: - \prg_return_false: - \fi: -} -\prg_new_conditional:Npnn \tl_if_empty:o #1 { p,TF,T,F} +\cs_new:Npn \tl_if_empty_return:o #1 + { + \exp_after:wN \if_meaning:w \exp_after:wN \q_nil + \tl_to_str:n \exp_after:wN {#1} \q_nil + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Npnn \tl_if_empty:o #1 { p , TF , T , F } { \tl_if_empty_return:o {#1} } \prg_new_conditional:Npnn \tl_if_eq:NN #1#2 { p , T , F , TF } { @@ -379,20 +377,6 @@ \cs_generate_variant:Nn \tl_if_in:nnT { no } \cs_generate_variant:Nn \tl_if_in:nnF { no } \cs_generate_variant:Nn \tl_if_in:nnTF { no } -\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } - { - \tl_if_blank:nTF {#1} - { \tl_if_empty:nTF {#1} { \prg_return_false: } { \prg_return_true: } } - { \tl_if_single_aux:n {#1} } - } -\prg_new_conditional:Npnn \tl_if_single:N #1 { p , T , F , TF } - { - \tl_if_blank:oTF #1 - { \tl_if_empty:NTF #1 { \prg_return_false: } { \prg_return_true: } } - { \exp_args:No \tl_if_single_aux:n {#1} } - } -\cs_new:Npn \tl_if_single_aux:n #1 - { \tl_if_empty_return:o { \use_none:n #1 } } \cs_new:Npn \tl_map_function:nN #1#2 { \tl_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop } \cs_new_nopar:Npn \tl_map_function:NN #1#2 @@ -448,14 +432,9 @@ \if_cs_exist:w #1 \cs_end: \cs:w #1 \exp_after:wN \cs_end: \else: - \exp_after:wN \tl_error_message: + \msg_expandable_error:n { Undefined~variable~name~'#1'! } \fi: } -\group_begin: -\tex_catcode:D `\! = 11 \scan_stop: -\tex_catcode:D `\ = 11\scan_stop:% -\cs_gset_nopar:Npn\tl_error_message:{\undefined variable name!}% -\group_end:% \cs_new:Npn \tl_length:n #1 { \int_eval:n @@ -469,17 +448,14 @@ \cs_new:Npn \tl_length_aux:n #1 { + 1 } \cs_generate_variant:Nn \tl_length:n { V , o } \cs_generate_variant:Nn \tl_length:N { c } -\cs_new:Npn \tl_reverse:n #1 - { \tl_reverse_aux:nN { } #1 \q_recursion_tail \q_recursion_stop } -\cs_new:Npn \tl_reverse_aux:nN #1#2 +\cs_new:Npn \tl_reverse_items:n #1 + { \tl_reverse_items_aux:nw #1 \q_recursion_tail \q_recursion_stop } +\cs_new:Npn \tl_reverse_items_aux:nw #1 #2 \q_recursion_stop { - \quark_if_recursion_tail_stop_do:nn {#2} {#1} - \tl_reverse_aux:nN { #2 #1 } + \quark_if_recursion_tail_stop_do:nn {#1} { \use_none:n } + \tl_reverse_items_aux:nw #2 \q_recursion_stop + {#1} } -\cs_generate_variant:Nn \tl_reverse:n {V,o} -\cs_new_protected_nopar:Npn \tl_reverse:N #1 - { \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } -\cs_generate_variant:Nn \tl_reverse:N { c } \cs_new:Npn \tl_trim_spaces:n #1 { \etex_unexpanded:D \exp_after:wN \exp_after:wN \exp_after:wN @@ -501,24 +477,32 @@ \cs_new:Npn \tl_head:w #1#2 \q_stop {#1} \cs_new:Npn \tl_tail:w #1#2 \q_stop {#2} \cs_new:Npn \tl_head:n #1 - { \tl_if_blank:nF {#1} { \tl_head:w #1 \q_stop } } + { \tl_head:w #1 { } \q_stop } \cs_new:Npn \tl_tail:n #1 - { \tl_if_blank:nF {#1} { \tl_tail:w #1 \q_stop } } + { \tl_tail_aux:w #1 \q_mark { } \q_mark \q_stop } +\cs_new:Npn \tl_tail_aux:w #1 #2 \q_mark #3 \q_stop { #2 } \cs_generate_variant:Nn \tl_head:n { V , v , f } \cs_generate_variant:Nn \tl_tail:n { V , v , f } \cs_new:Npn \str_head:n #1 { \exp_after:wN \str_head_aux:w \tl_to_str:n {#1} - { \scan_stop: } ~ \q_stop + { { } } ~ \q_stop } \cs_new_nopar:Npn \str_head_aux:w #1 ~ % { \tl_head:w #1 { ~ } } +\cs_new:Npn \str_tail:n #1 + { + \exp_after:wN \str_tail_aux:w + \reverse_if:N \if_charcode:w + \scan_stop: \tl_to_str:n {#1} X X \q_stop + } +\cs_new_nopar:Npn \str_tail_aux:w #1 X #2 \q_stop { \fi: #1 } \prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 { p , T , F , TF } { \if_charcode:w \exp_not:N #2 - \str_if_eq:onTF { \use:n #1 ? } { #1 ? } + \tl_if_head_N_type:nTF { #1 ? } { \exp_after:wN \exp_not:N \tl_head:w #1 \q_nil \q_stop } { \str_head:n {#1} } \prg_return_true: @@ -534,10 +518,10 @@ { \if_catcode:w \exp_not:N #2 - \str_if_eq:onTF { \use:n #1 ? } { #1 ? } + \tl_if_head_N_type:nTF { #1 ? } { \exp_after:wN \exp_not:N \tl_head:w #1 \q_nil \q_stop } { - \tl_if_head_begin_group:nTF {#1} + \tl_if_head_group:nTF {#1} { \c_group_begin_token } { \c_space_token } } @@ -548,7 +532,7 @@ } \prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 { p , T , F , TF } { - \str_if_eq:onTF { \use:n #1 ? } { #1 ? } + \tl_if_head_N_type:nTF { #1 ? } { \tl_if_head_eq_meaning_aux_normal:nN } { \tl_if_head_eq_meaning_aux_special:nN } {#1} #2 @@ -571,7 +555,7 @@ \fi: { \if_catcode:w \exp_not:N #2 - \tl_if_head_begin_group:nTF {#1} + \tl_if_head_group:nTF {#1} { \c_group_begin_token } { \c_space_token } \prg_return_true: @@ -580,6 +564,42 @@ \fi: } } +\prg_new_conditional:Npnn \tl_if_head_N_type:n #1 { p , T , F , TF } + { \str_if_eq_return:on { \use:n #1 { } } { #1 { } } } +\prg_new_conditional:Npnn \tl_if_head_group:n #1 { p , T , F , TF } + { + \if_predicate:w + \exp_after:wN \use_none:n + \exp_after:wN { + \exp_after:wN { + \token_to_str:N #1 ? + } + \c_false_bool + } + \c_true_bool + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +\prg_new_conditional:Npnn \tl_if_head_space:n #1 { p , T , F , TF } + { + \if_int_compare:w + \pdftex_strcmp:D + { } + { \tl_if_head_space_aux:w \prg_do_nothing: #1 ? ~ } + = \c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \tl_if_head_space_aux:w #1 ~ % + { + \exp_not:o {#1} + \if_false: { \fi: } + \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: + } \cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } \cs_generate_variant:Nn \tl_show:N { c } \cs_new_eq:NN \tl_show:n \etex_showtokens:D @@ -590,51 +610,163 @@ \tl_new:N \g_tmpb_tl \tl_new:N \l_tmpa_tl \tl_new:N \l_tmpb_tl -\cs_new:Npn \tl_if_single_item:nTF #1 - { \str_if_eq:onTF { \use_ii:nn #1 {?} ? } {??} } -\cs_new:Npn \tl_if_single_item:nT #1 - { \str_if_eq:onT { \use_ii:nn #1 {?} ? } {??} } -\cs_new:Npn \tl_if_single_item:nF #1 - { \str_if_eq:onF { \use_ii:nn #1 {?} ? } {??} } -\cs_new:Npn \tl_if_single_item_p:n #1 - { \str_if_eq_p:on { \use_ii:nn #1 {?} ? } {??} } -\prg_new_conditional:Npnn \tl_if_head_begin_group:n #1 { p , T , F , TF } - { - \exp_after:wN \use_none:n - \exp_after:wN { - \exp_after:wN { - \token_to_str:N #1 . - } - \prg_return_true: \exp_after:wN \use_none:nn \token_to_str:N - } +\cs_new:Npn \str_if_eq_return:on #1 #2 + { + \if_int_compare:w + \pdftex_strcmp:D { \exp_not:o {#1} } { \exp_not:n {#2} } + = \c_zero + \prg_return_true: + \else: \prg_return_false: + \fi: } -\prg_new_conditional:Npnn \tl_if_head_eq_space:n #1 { p , T , F , TF } +\cs_new:Npn \tl_if_single_p:N { \exp_args:No \tl_if_single_p:n } +\cs_new:Npn \tl_if_single:NT { \exp_args:No \tl_if_single:nT } +\cs_new:Npn \tl_if_single:NF { \exp_args:No \tl_if_single:nF } +\cs_new:Npn \tl_if_single:NTF { \exp_args:No \tl_if_single:nTF } +\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } + { \str_if_eq_return:on { \use_none:nn #1 ?? } {?} } +\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } { - \if_false: { \fi: - \tl_if_head_eq_space_aux:w \prg_do_nothing: #1 ? ~ } + \tl_if_head_N_type:nTF {#1} + { \str_if_eq_return:on { \use_none:n #1 } { } } + { \str_if_eq_return:on { ~ } { #1 } } } -\cs_new:Npn \tl_if_head_eq_space_aux:w #1 ~ % +\cs_new:Npn \tl_act:NNNnn { \tex_romannumeral:D \tl_act_aux:NNNnn } +\cs_new:Npn \tl_act_aux:NNNnn #1 #2 #3 #4 #5 { - \tl_if_empty_return:o { #1 } - \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: + \tl_act_loop:w #5 \q_tl_act_mark \q_tl_act_stop + {#4} #1 #2 #3 + \tl_act_result:n { } } -\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } +\cs_new:Npn \tl_act_loop:w #1 \q_tl_act_stop { - \tl_if_head_eq_space:nTF {#1} + \tl_if_head_N_type:nTF {#1} + { \tl_act_normal:NwnNNN } { - \str_if_eq:nnTF {#1} {~} - \prg_return_true: \prg_return_false: + \tl_if_head_group:nTF {#1} + { \tl_act_group:nwnNNN } + { \tl_act_space:wwnNNN } } + #1 \q_tl_act_stop + } +\cs_new:Npn \tl_act_normal:NwnNNN #1 #2 \q_tl_act_stop #3#4 + { + \if_meaning:w \q_tl_act_mark #1 + \exp_after:wN \tl_act_end:wn + \fi: + #4 {#3} #1 + \tl_act_loop:w #2 \q_tl_act_stop + {#3} #4 + } +\cs_new:Npn \tl_act_end:wn #1 \tl_act_result:n #2 { \c_zero #2 } +\cs_new:Npn \tl_act_group:nwnNNN #1 #2 \q_tl_act_stop #3#4#5 + { + #5 {#3} {#1} + \tl_act_loop:w #2 \q_tl_act_stop + {#3} #4 #5 + } +\exp_last_unbraced:NNo + \cs_new:Npn \tl_act_space:wwnNNN \c_space_tl #1 \q_tl_act_stop #2#3#4#5 + { + #5 {#2} + \tl_act_loop:w #1 \q_tl_act_stop + {#2} #3 #4 #5 + } +\cs_new:Npn \tl_act_output:n #1 #2 \tl_act_result:n #3 + { #2 \tl_act_result:n { #3 #1 } } +\cs_new:Npn \tl_act_reverse_output:n #1 #2 \tl_act_result:n #3 + { #2 \tl_act_result:n { #1 #3 } } +\cs_new:Npn \tl_act_group_recurse:Nnn #1#2#3 + { + \exp_args:Nf #1 + { \exp_after:wN \exp_after:wN \exp_after:wN { #2 {#3} } } + } +\cs_new:Npn \tl_reverse_tokens:n + { + \tex_romannumeral:D + \tl_act_aux:NNNnn + \tl_act_reverse_normal:nN + \tl_act_reverse_group:nn + \tl_act_reverse_space:n + { } + } +\cs_new:Npn \tl_act_reverse_space:n #1 + { \tl_act_reverse_output:n {~} } +\cs_new:Npn \tl_act_reverse_normal:nN #1 #2 + { \tl_act_reverse_output:n {#2} } +\cs_new:Npn \tl_act_reverse_group:nn #1 + { + \tl_act_group_recurse:Nnn + \tl_act_reverse_output:n + { \tl_reverse_tokens:n } + } +\cs_new:Npn \tl_reverse:n + { + \tex_romannumeral:D + \tl_act_aux:NNNnn + \tl_act_reverse_normal:nN + \tl_act_reverse_group_preserve:nn + \tl_act_reverse_space:n + { } + } +\cs_new:Npn \tl_act_reverse_group_preserve:nn #1 #2 + { \tl_act_reverse_output:n { {#2} } } +\cs_generate_variant:Nn \tl_reverse:n { o , V } +\cs_new_protected_nopar:Npn \tl_reverse:N #1 + { \tl_set:No #1 { \etex_unexpanded:D \tl_reverse:o { #1 { } } } } +\cs_generate_variant:Nn \tl_reverse:N { c } +\cs_new:Npn \tl_length_tokens:n #1 + { + \int_eval:n { - \str_if_eq:onTF { \use_none:n #1 ? } {?} - { - \tl_if_head_begin_group:nTF {#1} - \prg_return_false: \prg_return_true: - } - \prg_return_false: + \tl_act_aux:NNNnn + \tl_act_length_normal:nN + \tl_act_length_group:nn + \tl_act_length_space:n + { } + {#1} + } + } +\cs_new:Npn \tl_act_length_normal:nN #1 #2 { 1 + } +\cs_new:Npn \tl_act_length_space:n #1 { 1 + } +\cs_new:Npn \tl_act_length_group:nn #1 #2 + { 2 + \tl_length_tokens:n {#2} + } +\tl_const:Nn \c_tl_act_uppercase_tl + { + aA bB cC dD eE fF gG hH iI jJ kK lL mM + nN oO pP qQ rR sS tT uU vV wW xX yY zZ + } +\tl_const:Nn \c_tl_act_lowercase_tl + { + Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm + Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz + } +\cs_new:Npn \tl_expandable_uppercase:n + { \tex_romannumeral:D \tl_act_case_aux:nn { \c_tl_act_uppercase_tl } } +\cs_new:Npn \tl_expandable_lowercase:n + { \tex_romannumeral:D \tl_act_case_aux:nn { \c_tl_act_lowercase_tl } } +\cs_new:Npn \tl_act_case_aux:nn + { + \tl_act_aux:NNNnn + \tl_act_case_normal:nN + \tl_act_case_group:nn + \tl_act_case_space:n + } +\cs_new:Npn \tl_act_case_space:n #1 { \tl_act_output:n {~} } +\cs_new:Npn \tl_act_case_normal:nN #1 #2 + { + \exp_args:Nf \tl_act_output:n + { + \exp_args:NNo \prg_case_str:nnn #2 {#1} + { \exp_stop_f: #2 } } } +\cs_new:Npn \tl_act_case_group:nn #1 #2 + { + \exp_after:wN \tl_act_output:n \exp_after:wN + { \exp_after:wN { \tex_romannumeral:D \tl_act_case_aux:nn {#1} {#2} } } + } \cs_new_protected:Npn \tl_new:Nn #1#2 { \tl_new:N #1 |