diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3basics.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3basics.sty | 118 |
1 files changed, 68 insertions, 50 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty index 6b6c8e90276..c7c5bcb0eb8 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -45,8 +45,8 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 3987 2012-07-15 21:57:39Z joseph $ +\RequirePackage{l3bootstrap} +\GetIdInfo$Id: l3basics.dtx 4069 2012-08-08 23:12:57Z bruno $ {L3 Basic definitions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -94,6 +94,7 @@ { \exp_args:Nc \cs_meaning:N {#1} } { \tl_to_str:n {undefined} } } +\tex_let:D \token_to_meaning:c = \cs_meaning:c \etex_protected:D \tex_def:D \cs_show:c { \group_begin: \exp_args:NNc \group_end: \cs_show:N } \tex_let:D \c_minus_one \m@ne @@ -135,6 +136,7 @@ { \etex_protected:D \tex_long:D \cs_gset_nopar:Npn } \cs_set_protected_nopar:Npn \cs_gset_protected:Npx { \etex_protected:D \tex_long:D \cs_gset_nopar:Npx } +\cs_set_nopar:Npn \l__exp_internal_tl { } \cs_set:Npn \use:c #1 { \cs:w #1 \cs_end: } \cs_set_protected:Npn \use:x #1 { @@ -214,30 +216,31 @@ } \cs_set_protected:Npn \__prg_generate_conditional:nnNnnnnn #1#2#3#4#5#6#7#8 { - \if_meaning:w \c_true_bool #3 - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - { - \__prg_generate_conditional:nnnnnnw - {#4} {#5} {#1} {#2} {#6} {#8} - #7 , , \q_recursion_stop - } - { + \if_meaning:w \c_false_bool #3 \__msg_kernel_error:nnx { kernel } { missing-colon } { \token_to_str:c {#1} } - } + \exp_after:wN \use_none:nn + \fi: + \use:x + { + \exp_not:N \__prg_generate_conditional:nnnnnnw + \exp_not:n { {#4} {#5} {#1} {#2} {#6} {#8} } + \etex_detokenize:D {#7} + \exp_not:n { , \q_recursion_tail , \q_recursion_stop } + } } \cs_set_protected:Npn \__prg_generate_conditional:nnnnnnw #1#2#3#4#5#6#7 , { - \if_catcode:w \scan_stop: \etex_detokenize:D {#7} \scan_stop: + \if_meaning:w \q_recursion_tail #7 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: - \use:c { __prg_generate_ \etex_detokenize:D {#7} _form:wnnnnnn } - \__msg_kernel_error:nnxx - { kernel } { conditional-form-unknown } - { \tl_to_str:n {#7} } { \token_to_str:c { #3 : #4 } } + \use:c { __prg_generate_ #7 _form:wnnnnnn } + \tl_if_empty:nF {#7} + { + \__msg_kernel_error:nnxx + { kernel } { conditional-form-unknown } + {#7} { \token_to_str:c { #3 : #4 } } + } \use_none:nnnnnnn \q_stop {#1} {#2} {#3} {#4} {#5} {#6} @@ -274,21 +277,21 @@ \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 TF } #6 { #7 \c_zero } } -\cs_set_protected:Npn \prg_set_eq_conditional:NNn #1#2 - { - \__cs_split_function:NN #2 \__prg_set_eq_conditional:nnNNNn - \cs_set_eq:cc #1 - } -\cs_set_protected:Npn \prg_new_eq_conditional:NNn #1#2 +\cs_set_protected_nopar:Npn \prg_set_eq_conditional:NNn + { \__prg_set_eq_conditional:NNNn \cs_set_eq:cc } +\cs_set_protected_nopar:Npn \prg_new_eq_conditional:NNn + { \__prg_set_eq_conditional:NNNn \cs_new_eq:cc } +\cs_set_protected:Npn \__prg_set_eq_conditional:NNNn #1#2#3#4 { - \__cs_split_function:NN #2 \__prg_set_eq_conditional:nnNNNn - \cs_new_eq:cc #1 - } -\cs_set_protected:Npn \__prg_set_eq_conditional:nnNNNn #1#2#3#4#5#6 - { - \__cs_split_function:NN #5 \__prg_set_eq_conditional:nnNnnNNw - {#1} {#2} #3 #4 - #6 , \scan_stop: , \q_recursion_stop + \use:x + { + \exp_not:N \__prg_set_eq_conditional:nnNnnNNw + \__cs_split_function:NN #2 \prg_do_nothing: + \__cs_split_function:NN #3 \prg_do_nothing: + \exp_not:N #1 + \etex_detokenize:D {#4} + \exp_not:n { , \q_recursion_tail , \q_recursion_stop } + } } \cs_set_protected:Npn \__prg_set_eq_conditional:nnNnnNNw #1#2#3#4#5#6 { @@ -306,29 +309,41 @@ } \cs_set_protected:Npn \__prg_set_eq_conditional_loop:nnnnNw #1#2#3#4#5#6 , { - \if_meaning:w \scan_stop: #6 \scan_stop: + \if_meaning:w \q_recursion_tail #6 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: - \cs_if_exist:cTF - { \use:c { __prg_conditional_ #6 _form:nn } {#3} {#4} } - { - #5 - { \use:c { __prg_conditional_ #6 _form:nn } {#1} {#2} } - { \use:c { __prg_conditional_ #6 _form:nn } {#3} {#4} } - } - { - \__msg_kernel_error:nnx { kernel } { command-not-defined } + \use:c { __prg_set_eq_conditional_ #6 _form:wNnnnn } + \tl_if_empty:nF {#6} { - \token_to_str:c - { \use:c { __prg_conditional_ #6 _form:nn } {#3} {#4} } + \__msg_kernel_error:nnxx + { kernel } { conditional-form-unknown } + {#6} { \token_to_str:c { #1 : #2 } } } - } + \use_none:nnnnnn + \q_stop + #5 {#1} {#2} {#3} {#4} \__prg_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5 } -\cs_set:Npn \__prg_conditional_p_form:nn #1#2 { #1 _p : #2 } -\cs_set:Npn \__prg_conditional_TF_form:nn #1#2 { #1 : #2 TF } -\cs_set:Npn \__prg_conditional_T_form:nn #1#2 { #1 : #2 T } -\cs_set:Npn \__prg_conditional_F_form:nn #1#2 { #1 : #2 F } +\cs_set:Npn \__prg_set_eq_conditional_p_form:wNnnnn #1 \q_stop #2#3#4#5#6 + { + \__chk_if_exist_cs:c { #5 _p : #6 } + #2 { #3 _p : #4 } { #5 _p : #6 } + } +\cs_set:Npn \__prg_set_eq_conditional_TF_form:wNnnnn #1 \q_stop #2#3#4#5#6 + { + \__chk_if_exist_cs:c { #5 : #6 TF } + #2 { #3 : #4 TF } { #5 : #6 TF } + } +\cs_set:Npn \__prg_set_eq_conditional_T_form:wNnnnn #1 \q_stop #2#3#4#5#6 + { + \__chk_if_exist_cs:c { #5 : #6 T } + #2 { #3 : #4 T } { #5 : #6 T } + } +\cs_set:Npn \__prg_set_eq_conditional_F_form:wNnnnn #1 \q_stop #2#3#4#5#6 + { + \__chk_if_exist_cs:c { #5 : #6 F } + #2 { #3 : #4 F } { #5 : #6 F } + } \tex_chardef:D \c_true_bool = 1 ~ \tex_chardef:D \c_false_bool = 0 ~ \cs_set_nopar:Npn \cs_to_str:N @@ -808,6 +823,9 @@ \fi: \__prg_map_break:Nn #1 {#2} } +\cs_new_eq:NN \__prg_break_point: \prg_do_nothing: +\cs_new:Npn \__prg_break: #1 \__prg_break_point: { } +\cs_new:Npn \__prg_break:n #1#2 \__prg_break_point: {#1} \cs_new_eq:NN \str_if_eq_p:xx \str_if_eq_x_p:nn \cs_new_eq:NN \str_if_eq:xxT \str_if_eq_x:nnT \cs_new_eq:NN \str_if_eq:xxF \str_if_eq_x:nnF |