summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/expl3/l3tl.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3tl.sty')
-rw-r--r--Master/texmf-dist/tex/latex/expl3/l3tl.sty437
1 files changed, 261 insertions, 176 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3tl.sty b/Master/texmf-dist/tex/latex/expl3/l3tl.sty
index 7ca05792d8e..00dcc85798c 100644
--- a/Master/texmf-dist/tex/latex/expl3/l3tl.sty
+++ b/Master/texmf-dist/tex/latex/expl3/l3tl.sty
@@ -15,7 +15,7 @@
%% Do not distribute a modified version of this file.
%%
%%
-%% File: l3tl.dtx Copyright (C) 1990-2009 LaTeX3 project
+%% File: l3tl.dtx Copyright (C) 1990-2010 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
@@ -48,22 +48,26 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}
-\GetIdInfo$Id: l3tl.dtx 1621 2009-10-25 06:36:19Z will $
+\GetIdInfo$Id: l3tl.dtx 1873 2010-03-24 08:32:54Z joseph $
{L3 Experimental Token Lists}
\ProvidesExplPackage
{\filename}{\filedate}{\fileversion}{\filedescription}
\package_check_loaded_expl:
-\cs_new:Npn \tl_new:Nn #1#2{
+\cs_new_protected:Npn \tl_new:Nn #1#2{
\chk_if_free_cs:N #1
\cs_gset_nopar:Npn #1{#2}
}
\cs_generate_variant:Nn \tl_new:Nn {cn}
-\cs_new:Npn \tl_new:Nx #1#2{
+\cs_new_protected:Npn \tl_new:Nx #1#2{
\chk_if_free_cs:N #1
\cs_gset_nopar:Npx #1{#2}
}
-\cs_new_nopar:Npn \tl_new:N #1{\tl_new:Nn #1{}}
-\cs_new_nopar:Npn \tl_new:c #1{\tl_new:cn {#1}{}}
+\cs_new_protected_nopar:Npn \tl_new:N #1{\tl_new:Nn #1{}}
+\cs_new_protected_nopar:Npn \tl_new:c #1{\tl_new:cn {#1}{}}
+\cs_new_protected:Npn \tl_const:Nn #1#2 {
+ \tl_new:N #1
+ \tl_gset:Nn #1 {#2}
+}
\cs_new_nopar:Npn \tl_use:N #1 {
\if_meaning:w #1 \tex_relax:D
\msg_kernel_bug:x {Token~list~variable~ `\token_to_str:N #1'~
@@ -76,100 +80,141 @@
\cs_new_nopar:Npn \tl_show:N #1 { \cs_show:N #1 }
\cs_generate_variant:Nn \tl_show:N {c}
\cs_set_eq:NN \tl_show:n \etex_showtokens:D
-\cs_new:Npn\tl_set:Nn#1#2{\cs_set_nopar:Npn#1{#2}}
-\cs_new:Npn\tl_set:Nx#1#2{\cs_set_nopar:Npx#1{#2}}
-\cs_new:Npn\tl_gset:Nn#1#2{\cs_gset_nopar:Npn#1{#2}}
-\cs_new:Npn\tl_gset:Nx#1#2{\cs_gset_nopar:Npx#1{#2}}
-\cs_generate_variant:Nn \tl_set:Nn {NV,No,Nv,Nf,cn,cV,co,cx}
-\cs_generate_variant:Nn \tl_gset:Nn {NV,No,Nv,cn,cx}
+\cs_new_protected:Npn \tl_set:Nn #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:n {#2} }
+}
+\cs_new_protected:Npn \tl_set:Nx #1#2 {
+ \cs_set_nopar:Npx #1 {#2}
+}
+\cs_new_protected:Npn \tl_gset:Nn #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:n {#2} }
+}
+\cs_new_protected:Npn \tl_gset:Nx #1#2 {
+ \cs_gset_nopar:Npx #1 {#2}
+}
+\cs_generate_variant:Nn \tl_set:Nn { NV }
+\cs_generate_variant:Nn \tl_set:Nn { Nv }
+\cs_generate_variant:Nn \tl_set:Nn { No }
+\cs_generate_variant:Nn \tl_set:Nn { Nf }
+\cs_generate_variant:Nn \tl_set:Nn { cV }
+\cs_generate_variant:Nn \tl_set:Nn { c }
+\cs_generate_variant:Nn \tl_set:Nn { cv }
+\cs_generate_variant:Nn \tl_set:Nn { co }
+\cs_generate_variant:Nn \tl_set:Nx { c }
+\cs_generate_variant:Nn \tl_gset:Nn { NV }
+\cs_generate_variant:Nn \tl_gset:Nn { Nv }
+\cs_generate_variant:Nn \tl_gset:Nn { No }
+\cs_generate_variant:Nn \tl_gset:Nn { Nf }
+\cs_generate_variant:Nn \tl_gset:Nn { c }
+\cs_generate_variant:Nn \tl_gset:Nn { cV }
+\cs_generate_variant:Nn \tl_gset:Nn { cv }
+\cs_generate_variant:Nn \tl_gset:Nx { c }
+
\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN
\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN
\cs_generate_variant:Nn \tl_set_eq:NN {Nc,c,cc}
\cs_generate_variant:Nn \tl_gset_eq:NN {Nc,c,cc}
-\cs_new_nopar:Npn \tl_clear:N #1{\tl_set_eq:NN #1\c_empty_tl}
+\cs_new_protected_nopar:Npn \tl_clear:N #1{\tl_set_eq:NN #1\c_empty_tl}
\cs_generate_variant:Nn \tl_clear:N {c}
-\cs_new_nopar:Npn \tl_gclear:N #1{\tl_gset_eq:NN #1\c_empty_tl}
+\cs_new_protected_nopar:Npn \tl_gclear:N #1{\tl_gset_eq:NN #1\c_empty_tl}
\cs_generate_variant:Nn \tl_gclear:N {c}
\cs_new_eq:NN \tl_clear_new:N \tl_clear:N
\cs_generate_variant:Nn \tl_clear_new:N {c}
\cs_new_eq:NN \tl_gclear_new:N \tl_gclear:N
\cs_generate_variant:Nn \tl_gclear_new:N {c}
-\cs_new:Npn \tl_put_left:Nn #1#2 {
- \tl_set:Nn \l_exp_tl {#2}
- \tl_set:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 }
+\cs_new_protected:Npn \tl_put_right:Nn #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:V #1 \exp_not:n {#2} }
+}
+\cs_new_protected:Npn \tl_put_right:NV #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:V #1 \exp_not:V #2 }
+}
+\cs_new_protected:Npn \tl_put_right:Nv #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:V #1 \exp_not:v {#2} }
}
-\cs_new:Npn \tl_put_left:NV #1#2 {
- \tl_set:Nx #1 { \exp_not:V #2 \exp_not:V #1 }
+\cs_new_protected:Npn \tl_put_right:Nx #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:V #1 #2 }
}
-\cs_new:Npn \tl_put_left:No #1#2{
- \tl_set:No \l_exp_tl {#2}
- \tl_set:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 }
+\cs_new_protected:Npn \tl_put_right:No #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:V #1 \exp_not:o {#2} }
}
-\cs_new:Npn \tl_put_left:Nx #1#2{
- \tl_set:Nx #1 { #2 \exp_not:V #1 }
+\cs_new_protected:Npn \tl_gput_right:Nn #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:V #1 \exp_not:n {#2} }
}
-\cs_new:Npn \tl_gput_left:Nn #1#2{
- \tl_set:Nn \l_exp_tl{#2}
- \tl_gset:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 }
+\cs_new_protected:Npn \tl_gput_right:NV #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:V #1 \exp_not:V #2 }
}
-\cs_new:Npn \tl_gput_left:NV #1#2 {
- \tl_gset:Nx #1 { \exp_not:V #2 \exp_not:V #1 }
+\cs_new_protected:Npn \tl_gput_right:Nv #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:V #1 \exp_not:v {#2} }
}
-\cs_new:Npn \tl_gput_left:No #1#2{
- \tl_set:No \l_exp_tl {#2}
- \tl_gset:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 }
+\cs_new_protected:Npn \tl_gput_right:No #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:V #1 \exp_not:o {#2} }
}
-\cs_new:Npn \tl_gput_left:Nx #1#2{
- \tl_gset:Nx #1 { #2 \exp_not:V #1 }
+\cs_new_protected:Npn \tl_gput_right:Nx #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:V #1 #2 }
}
-\cs_generate_variant:Nn \tl_put_left:Nn {cn,co,cV}
-\cs_generate_variant:Nn \tl_gput_left:Nn {cn,co}
-\cs_generate_variant:Nn \tl_gput_left:NV {cV}
-\cs_new:Npn \tl_put_right:Nn #1#2 {
- \tl_set:Nn \l_exp_tl {#2}
- \tl_set:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl }
+\cs_generate_variant:Nn \tl_put_right:Nn { c }
+\cs_generate_variant:Nn \tl_put_right:NV { c }
+\cs_generate_variant:Nn \tl_put_right:Nv { c }
+\cs_generate_variant:Nn \tl_put_right:Nx { c }
+\cs_generate_variant:Nn \tl_gput_right:Nn { c }
+\cs_generate_variant:Nn \tl_gput_right:NV { c }
+\cs_generate_variant:Nn \tl_gput_right:Nv { c }
+\cs_generate_variant:Nn \tl_gput_right:No { c }
+\cs_generate_variant:Nn \tl_gput_right:Nx { c }
+\cs_new_protected:Npn \tl_put_left:Nn #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:V #1 }
}
-\cs_new:Npn \tl_gput_right:Nn #1#2{
- \tl_set:Nn \l_exp_tl {#2}
- \tl_gset:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl }
+\cs_new_protected:Npn \tl_put_left:NV #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:V #1 }
}
-\cs_new:Npn \tl_put_right:NV #1#2 {
- \tl_set:Nx #1 { \exp_not:V #1 \exp_not:V #2 }
+\cs_new_protected:Npn \tl_put_left:Nv #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:v {#2} \exp_not:V #1 }
}
-\cs_new:Npn \tl_put_right:No #1#2 {
- \tl_set:No \l_exp_tl {#2}
- \tl_set:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl }
+\cs_new_protected:Npn \tl_put_left:Nx #1#2 {
+ \cs_set_nopar:Npx #1 { #2 \exp_not:V #1 }
}
-\cs_new:Npn \tl_gput_right:NV #1#2 {
- \tl_gset:Nx #1 { \exp_not:V #1 \exp_not:V #2 }
+\cs_new_protected:Npn \tl_put_left:No #1#2 {
+ \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:V #1 }
}
-\cs_new:Npn \tl_gput_right:No #1#2 {
- \tl_set:No \l_exp_tl {#2}
- \tl_gset:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl }
+\cs_new_protected:Npn \tl_gput_left:Nn #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:V #1 }
}
-\cs_set:Npn \tl_put_right:Nx #1#2 {
- \tl_set:Nx #1 { \exp_not:V #1 #2 }
+\cs_new_protected:Npn \tl_gput_left:NV #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:V #1 }
}
-\cs_set:Npn \tl_gput_right:Nx #1#2 {
- \tl_gset:Nx #1 { \exp_not:V #1 #2 }
+\cs_new_protected:Npn \tl_gput_left:Nv #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:v {#2} \exp_not:V #1 }
}
-\cs_generate_variant:Nn \tl_put_right:Nn {cn,co}
-\cs_generate_variant:Nn \tl_put_right:NV {cV}
-\cs_generate_variant:Nn \tl_gput_right:Nn {cn,co,cV}
-\cs_new_nopar:Npn \tl_gset:Nc {
+\cs_new_protected:Npn \tl_gput_left:No #1#2 {
+ \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:V #1 }
+}
+\cs_new_protected:Npn \tl_gput_left:Nx #1#2 {
+ \cs_gset_nopar:Npx #1 { #2 \exp_not:V #1 }
+}
+\cs_generate_variant:Nn \tl_put_left:Nn { c }
+\cs_generate_variant:Nn \tl_put_left:NV { c }
+\cs_generate_variant:Nn \tl_put_left:Nv { c }
+\cs_generate_variant:Nn \tl_put_left:Nx { c }
+\cs_generate_variant:Nn \tl_gput_left:Nn { c }
+\cs_generate_variant:Nn \tl_gput_left:NV { c }
+\cs_generate_variant:Nn \tl_gput_left:Nv { c }
+\cs_generate_variant:Nn \tl_gput_left:Nx { c }
+\cs_new_protected_nopar:Npn \tl_gset:Nc {
\pref_global:D
\tl_set:Nc}
-\cs_new_nopar:Npn \tl_set:Nc #1#2{\tl_set:No #1{\cs:w#2\cs_end:}}
-\tl_new:Nn \c_job_name_tl {\tex_jobname:D}
-\tl_new:Nn \c_empty_tl {}
-\tl_new:Nn \g_tmpa_tl{}
-\tl_new:Nn \g_tmpb_tl{}
-\tl_new:Nn \l_testa_tl {}
-\tl_new:Nn \l_testb_tl {}
-\tl_new:Nn \g_testa_tl {}
-\tl_new:Nn \g_testb_tl {}
-\tl_new:Nn \l_tmpa_tl{}
-\tl_new:Nn \l_tmpb_tl{}
+\cs_new_protected_nopar:Npn \tl_set:Nc #1#2{\tl_set:No #1{\cs:w#2\cs_end:}}
+\tl_new:N \c_job_name_tl
+\tl_set:Nx \c_job_name_tl { \tex_jobname:D }
+\tl_const:Nn \c_empty_tl { }
+\tl_const:Nn \c_space_tl { ~ }
+\tl_new:N \g_tmpa_tl
+\tl_new:N \g_tmpb_tl
+\tl_new:N \l_kernel_testa_tl
+\tl_new:N \l_kernel_testb_tl
+\tl_new:N \l_tmpa_tl
+\tl_new:N \l_tmpb_tl
+\tl_new:N \l_kernel_tmpa_tl
+\tl_new:N \l_kernel_tmpb_tl
\prg_set_conditional:Npnn \tl_if_empty:N #1 {p,TF,T,F} {
\if_meaning:w #1 \c_empty_tl
\prg_return_true: \else: \prg_return_false: \fi:
@@ -211,6 +256,31 @@
\cs_generate_variant:Nn \tl_if_blank:nTF {o}
\cs_generate_variant:Nn \tl_if_blank:nT {o}
\cs_generate_variant:Nn \tl_if_blank:nF {o}
+\prg_new_conditional:Nnn \tl_if_single:n {p,TF,T,F} {
+ \tl_if_empty:nTF {#1}
+ {\prg_return_false:}
+ {
+ \tl_if_blank:nTF {#1}
+ {\prg_return_true:}
+ {
+ \_tl_if_single_aux:w #1 \q_nil
+ }
+ }
+}
+\prg_new_conditional:Nnn \tl_if_single:N {p,TF,T,F} {
+ \tl_if_empty:NTF #1
+ {\prg_return_false:}
+ {
+ \exp_after:wN \tl_if_blank:nTF #1
+ {\prg_return_true:}
+ {
+ \exp_after:wN \_tl_if_single_aux:w #1 \q_nil
+ }
+ }
+}
+\cs_new:Npn \_tl_if_single_aux:w #1#2 \q_nil {
+ \tl_if_empty:nTF {#2} \prg_return_true: \prg_return_false:
+}
\cs_new_eq:NN \tl_compare:xx \pdf_strcmp:D
\cs_new:Npn \tl_compare:nn #1#2{
\tl_compare:xx{\exp_not:n{#1}}{\exp_not:n{#2}}
@@ -252,7 +322,7 @@
\tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{#2}
}
\cs_set_nopar:Npn \tl_tmp:w #1 {
- \tl_set:Nx \l_tmpa_tl {
+ \tl_set:Nx \l_kernel_tmpa_tl {
\exp_not:N \prg_new_conditional:Npnn \exp_not:c {tl_if_eq:#1}
####1 ####2 {p,TF,T,F} {
\exp_not:N \tex_ifnum:D
@@ -260,7 +330,7 @@
\exp_not:n{ =\c_zero \prg_return_true: \else: \prg_return_false: \fi: }
}
}
- \l_tmpa_tl
+ \l_kernel_tmpa_tl
}
\tl_tmp:w{xx} \tl_tmp:w{nx} \tl_tmp:w{ox} \tl_tmp:w{Vx}
\tl_tmp:w{xn} \tl_tmp:w{nn} \tl_tmp:w{on} \tl_tmp:w{Vn}
@@ -268,100 +338,100 @@
\tl_tmp:w{xV} \tl_tmp:w{nV} \tl_tmp:w{VV}
\cs_if_exist:cF{pdf_strcmp:D}{
\prg_set_protected_conditional:Npnn \tl_if_eq:nn #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {\exp_not:n{#1}}
- \tl_set:Nx \l_testb_tl {\exp_not:n{#2}}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {\exp_not:n{#1}}
+ \tl_set:Nx \l_kernel_testb_tl {\exp_not:n{#2}}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:nV #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl { \exp_not:n {#1} }
- \tl_set:Nx \l_testb_tl { \exp_not:V #2 }
- \if_meaning:w \l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl { \exp_not:n {#1} }
+ \tl_set:Nx \l_kernel_testb_tl { \exp_not:V #2 }
+ \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:no #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {\exp_not:n{#1}}
- \tl_set:Nx \l_testb_tl {\exp_not:o{#2}}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {\exp_not:n{#1}}
+ \tl_set:Nx \l_kernel_testb_tl {\exp_not:o{#2}}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:nx #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {\exp_not:n{#1}}
- \tl_set:Nx \l_testb_tl {#2}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {\exp_not:n{#1}}
+ \tl_set:Nx \l_kernel_testb_tl {#2}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:Vn #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl { \exp_not:V #1 }
- \tl_set:Nx \l_testb_tl { \exp_not:n{#2} }
- \if_meaning:w \l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl { \exp_not:V #1 }
+ \tl_set:Nx \l_kernel_testb_tl { \exp_not:n{#2} }
+ \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:on #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {\exp_not:o{#1}}
- \tl_set:Nx \l_testb_tl {\exp_not:n{#2}}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {\exp_not:o{#1}}
+ \tl_set:Nx \l_kernel_testb_tl {\exp_not:n{#2}}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:VV #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl { \exp_not:V #1 }
- \tl_set:Nx \l_testb_tl { \exp_not:V #2 }
- \if_meaning:w \l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl { \exp_not:V #1 }
+ \tl_set:Nx \l_kernel_testb_tl { \exp_not:V #2 }
+ \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:oo #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {\exp_not:o{#1}}
- \tl_set:Nx \l_testb_tl {\exp_not:o{#2}}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {\exp_not:o{#1}}
+ \tl_set:Nx \l_kernel_testb_tl {\exp_not:o{#2}}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:Vx #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl { \exp_not:V #1 }
- \tl_set:Nx \l_testb_tl {#2}
- \if_meaning:w \l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl { \exp_not:V #1 }
+ \tl_set:Nx \l_kernel_testb_tl {#2}
+ \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:ox #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {\exp_not:o{#1}}
- \tl_set:Nx \l_testb_tl {#2}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {\exp_not:o{#1}}
+ \tl_set:Nx \l_kernel_testb_tl {#2}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:xn #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {#1}
- \tl_set:Nx \l_testb_tl {\exp_not:n{#2}}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {#1}
+ \tl_set:Nx \l_kernel_testb_tl {\exp_not:n{#2}}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:xV #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {#1}
- \tl_set:Nx \l_testb_tl { \exp_not:V #2 }
- \if_meaning:w \l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {#1}
+ \tl_set:Nx \l_kernel_testb_tl { \exp_not:V #2 }
+ \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:xo #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {#1}
- \tl_set:Nx \l_testb_tl {\exp_not:o{#2}}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {#1}
+ \tl_set:Nx \l_kernel_testb_tl {\exp_not:o{#2}}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
\prg_set_protected_conditional:Npnn \tl_if_eq:xx #1#2 {TF,T,F} {
- \tl_set:Nx \l_testa_tl {#1}
- \tl_set:Nx \l_testb_tl {#2}
- \if_meaning:w\l_testa_tl \l_testb_tl
+ \tl_set:Nx \l_kernel_testa_tl {#1}
+ \tl_set:Nx \l_kernel_testb_tl {#2}
+ \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl
\prg_return_true: \else: \prg_return_false:
\fi:
}
@@ -385,7 +455,7 @@
#1{#2} \tl_map_function_aux:Nn #1
}
\cs_generate_variant:Nn \tl_map_function:NN {cN}
-\cs_new:Npn \tl_map_inline:nn #1#2{
+\cs_new_protected:Npn \tl_map_inline:nn #1#2{
\int_gincr:N \g_tl_inline_level_int
\cs_gset:cpn {tl_map_inline_ \int_use:N \g_tl_inline_level_int :n}
##1{#2}
@@ -394,7 +464,7 @@
#1 \q_recursion_tail\q_recursion_stop
\int_gdecr:N \g_tl_inline_level_int
}
-\cs_new:Npn \tl_map_inline:Nn #1#2{
+\cs_new_protected:Npn \tl_map_inline:Nn #1#2{
\int_gincr:N \g_tl_inline_level_int
\cs_gset:cpn {tl_map_inline_ \int_use:N \g_tl_inline_level_int :n}
##1{#2}
@@ -404,12 +474,12 @@
\int_gdecr:N \g_tl_inline_level_int
}
\cs_generate_variant:Nn \tl_map_inline:Nn {c}
-\cs_new:Npn \tl_map_variable:nNn #1#2#3{
+\cs_new_protected:Npn \tl_map_variable:nNn #1#2#3{
\tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop
}
-\cs_new_nopar:Npn \tl_map_variable:NNn {\exp_args:No \tl_map_variable:nNn}
+\cs_new_protected_nopar:Npn \tl_map_variable:NNn {\exp_args:No \tl_map_variable:nNn}
\cs_generate_variant:Nn \tl_map_variable:NNn {c}
-\cs_new:Npn \tl_map_variable_aux:Nnn #1#2#3{
+\cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3{
\tl_set:Nn #1{#3}
\quark_if_recursion_tail_stop:N #1
#2 \tl_map_variable_aux:Nnn #1{#2}
@@ -423,22 +493,23 @@
\tl_reverse_aux:nN {#2#1}
}
\cs_generate_variant:Nn \tl_reverse:n {V,o}
-\cs_new_nopar:Npn \tl_reverse:N #1 {
+\cs_new_protected_nopar:Npn \tl_reverse:N #1 {
\tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } }
}
\cs_new:Npn \tl_elt_count:n #1{
\intexpr_eval:n {
- \tl_map_function:nN {#1}\num_elt_count:n
+ 0 \tl_map_function:nN {#1} \tl_elt_count_aux:n
}
}
\cs_generate_variant:Nn \tl_elt_count:n {V,o}
\cs_new_nopar:Npn \tl_elt_count:N #1{
\intexpr_eval:n {
- \tl_map_function:NN #1 \num_elt_count:n
+ 0 \tl_map_function:NN #1 \tl_elt_count_aux:n
}
}
-\cs_new:Npn \tl_set_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_set:Nn }
-\cs_new:Npn \tl_gset_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_gset:Nn }
+\cs_new:Npn \tl_elt_count_aux:n #1 { + 1 }
+\cs_new_protected:Npn \tl_set_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_set:Nn }
+\cs_new_protected:Npn \tl_gset_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_gset:Nn }
\group_begin:
\tex_lccode:D `\A = `\@ \scan_stop:
\tex_lccode:D `\B = `\@ \scan_stop:
@@ -446,9 +517,9 @@
\tex_catcode:D `\B = 3 \scan_stop:
\tl_to_lowercase:n {
\group_end:
- \tl_new:Nn \c_two_ats_with_two_catcodes_tl {AB}
+ \tl_const:Nn \c_two_ats_with_two_catcodes_tl { A B }
}
-\cs_new:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 {
+\cs_new_protected:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 {
\group_begin:
\toks_set:NV \etex_everyeof:D \c_two_ats_with_two_catcodes_tl
\tex_endlinechar:D = \c_minus_one
@@ -456,25 +527,25 @@
\exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#4}
\exp_args:NNNV
\group_end:
- #1 #2 \l_tmpa_toks
+ #1 #2 \l_tmpa_tl
}
\exp_after:wN \cs_set:Npn
\exp_after:wN \tl_rescan_aux:w
\exp_after:wN #
\exp_after:wN 1 \c_two_ats_with_two_catcodes_tl {
- \tl_set:Nn \l_tmpa_toks {#1}
+ \tl_set:Nn \l_tmpa_tl {#1}
}
-\cs_new:Npn \tl_set_rescan:Nnx #1#2#3 {
+\cs_new_protected:Npn \tl_set_rescan:Nnx #1#2#3 {
\group_begin:
\etex_everyeof:D { \exp_not:N }
\tex_endlinechar:D = \c_minus_one
#2
- \tl_set:Nx \l_tmpa_tl { \etex_scantokens:D {#3} }
+ \tl_set:Nx \l_kernel_tmpa_tl { \etex_scantokens:D {#3} }
\exp_args:NNNV
\group_end:
- \tl_set:Nn #1 \l_tmpa_tl
+ \tl_set:Nn #1 \l_kernel_tmpa_tl
}
-\cs_new:Npn \tl_gset_rescan:Nnx #1#2#3 {
+\cs_new_protected:Npn \tl_gset_rescan:Nnx #1#2#3 {
\group_begin:
\etex_everyeof:D { \exp_not:N }
\tex_endlinechar:D = \c_minus_one
@@ -482,14 +553,14 @@
\tl_gset:Nx #1 { \etex_scantokens:D {#3} }
\group_end:
}
-\cs_new:Npn \tl_rescan:nn #1#2 {
+\cs_new_protected:Npn \tl_rescan:nn #1#2 {
\group_begin:
\toks_set:NV \etex_everyeof:D \c_two_ats_with_two_catcodes_tl
\tex_endlinechar:D = \c_minus_one
#1
\exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#2}
\exp_args:NV \group_end:
- \l_tmpa_toks
+ \l_tmpa_tl
}
\prg_new_protected_conditional:Npnn \tl_if_in:Nn #1#2 {TF,T,F} {
\cs_set:Npn \tl_tmp:w ##1 #2 ##2 \q_stop {
@@ -512,56 +583,70 @@
\cs_generate_variant:Nn \tl_if_in:nnTF {o}
\cs_generate_variant:Nn \tl_if_in:nnT {o}
\cs_generate_variant:Nn \tl_if_in:nnF {o}
-%%\l_tl_replace_toks % moved to l3token as alloc not set up yet.
-\cs_new:Npn \tl_replace_in_aux:NNnn #1#2#3#4{
- \cs_set:Npn \tl_tmp:w ##1#3##2\q_stop{
- \quark_if_no_value:nF{##2}
+\tl_new:N \_l_tl_replace_tl
+\cs_new_protected_nopar:Npn \tl_replace_in:Nnn {
+ \_tl_replace_in_aux:NNnn \tl_set_eq:NN
+}
+\cs_new_protected:Npn \_tl_replace_in_aux:NNnn #1#2#3#4 {
+ \cs_set:Npn \_tl_tmp:w ##1 #3 ##2 \q_stop
{
- \toks_set:No\l_tl_replace_toks{##1#4}
- \cs_set:Npn \tl_tmp:w ####1#3\q_no_value{
- \toks_put_right:No \l_tl_replace_toks { ####1 }
- }
- \tl_tmp:w \prg_do_nothing: ##2
- #1#2{\toks_use:N\l_tl_replace_toks}
+ \quark_if_no_value:nF {##2}
+ {
+ \tl_set:No \_l_tl_replace_tl { ##1 #4 }
+ \cs_set:Npn \_tl_tmp:w ####1 #3 \q_no_value {
+ \tl_put_right:No \_l_tl_replace_tl {####1}
+ }
+ \_tl_tmp:w \prg_do_nothing: ##2
+ #1 #2 \_l_tl_replace_tl
+ }
}
- }
- \use:n{\exp_after:wN \tl_tmp:w\exp_after:wN\prg_do_nothing:}
- #2#3 \q_no_value\q_stop
-}
-\cs_new_nopar:Npn \tl_replace_in:Nnn {\tl_replace_in_aux:NNnn \tl_set:Nx}
-\cs_generate_variant:Nn\tl_replace_in:Nnn {cnn}
-\cs_new_nopar:Npn \tl_greplace_in:Nnn {\tl_replace_in_aux:NNnn \tl_gset:Nx}
-\cs_generate_variant:Nn\tl_greplace_in:Nnn {cnn}
-\cs_set:Npn \tl_replace_all_in_aux:NNnn #1#2#3#4{
- \toks_clear:N \l_tl_replace_toks
- \cs_set:Npn \tl_tmp:w ##1#3##2\q_stop{
- \quark_if_no_value:nTF{##2}
+ \use:n
+ {
+ \exp_after:wN \_tl_tmp:w \exp_after:wN
+ \prg_do_nothing:
+ }
+ #2 #3 \q_no_value \q_stop
+}
+\cs_new_protected_nopar:Npn \tl_greplace_in:Nnn {
+ \_tl_replace_in_aux:NNnn \tl_gset_eq:NN
+}
+\cs_generate_variant:Nn \tl_replace_in:Nnn { c }
+\cs_generate_variant:Nn \tl_greplace_in:Nnn { c }
+\cs_new_protected_nopar:Npn \tl_replace_all_in:Nnn {
+ \_tl_replace_all_in_aux:NNnn \tl_set_eq:NN
+}
+\cs_new_protected_nopar:Npn \tl_greplace_all_in:Nnn {
+ \_tl_replace_all_in_aux:NNnn \tl_gset_eq:NN
+}
+\cs_new_protected:Npn \_tl_replace_all_in_aux:NNnn #1#2#3#4 {
+ \tl_clear:N \_l_tl_replace_tl
+ \cs_set:Npn \_tl_tmp:w ##1 #3 ##2 \q_stop
{
- \toks_put_right:No \l_tl_replace_toks {##1}
+ \quark_if_no_value:nTF {##2}
+ { \tl_put_right:No \_l_tl_replace_tl {##1} }
+ {
+ \tl_put_right:No \_l_tl_replace_tl { ##1 #4 }
+ \_tl_tmp:w \prg_do_nothing: ##2 \q_stop
+ }
}
+ \use:n
{
- \toks_put_right:No \l_tl_replace_toks {##1 #4}
- \tl_tmp:w \prg_do_nothing: ##2 \q_stop
+ \exp_after:wN \_tl_tmp:w \exp_after:wN
+ \prg_do_nothing:
}
- }
- \use:n{\exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing:}
- #2#3 \q_no_value\q_stop
- #1#2{\toks_use:N\l_tl_replace_toks}
-}
-\cs_new_nopar:Npn \tl_replace_all_in:Nnn {
- \tl_replace_all_in_aux:NNnn \tl_set:Nx}
-\cs_generate_variant:Nn \tl_replace_all_in:Nnn {cnn}
-\cs_new_nopar:Npn \tl_greplace_all_in:Nnn {
- \tl_replace_all_in_aux:NNnn \tl_gset:Nx}
-\cs_generate_variant:Nn \tl_greplace_all_in:Nnn {cnn}
-\cs_new:Npn \tl_remove_in:Nn #1#2{\tl_replace_in:Nnn #1{#2}{}}
-\cs_new:Npn \tl_gremove_in:Nn #1#2{\tl_greplace_in:Nnn #1{#2}{}}
+ #2 #3 \q_no_value \q_stop
+ #1 #2 \_l_tl_replace_tl
+}
+\cs_generate_variant:Nn \tl_replace_all_in:Nnn { c }
+\cs_generate_variant:Nn \tl_greplace_all_in:Nnn { c }
+\cs_new_protected:Npn \tl_remove_in:Nn #1#2{\tl_replace_in:Nnn #1{#2}{}}
+\cs_new_protected:Npn \tl_gremove_in:Nn #1#2{\tl_greplace_in:Nnn #1{#2}{}}
\cs_generate_variant:Nn \tl_remove_in:Nn {cn}
\cs_generate_variant:Nn \tl_gremove_in:Nn {cn}
-\cs_new:Npn \tl_remove_all_in:Nn #1#2{
+\cs_new_protected:Npn \tl_remove_all_in:Nn #1#2{
\tl_replace_all_in:Nnn #1{#2}{}
}
-\cs_new:Npn \tl_gremove_all_in:Nn #1#2{
+\cs_new_protected:Npn \tl_gremove_all_in:Nn #1#2{
\tl_greplace_all_in:Nnn #1{#2}{}
}
\cs_generate_variant:Nn \tl_remove_all_in:Nn {cn}