diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex | 1168 |
1 files changed, 746 insertions, 422 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index 3a967c71daa..97a6ca14264 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -70,7 +70,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx -\def\ExplFileDate{2021-05-11}% +\def\ExplFileDate{2021-05-25}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -2112,11 +2112,12 @@ { \bool_if:NTF #3 { - \str_if_eq:eeF { } + \cs_set_nopar:Npx \__cs_tmp:w { \tl_map_function:nN {#2} \__cs_generate_from_signature:n } + \tl_if_empty:oF \__cs_tmp:w { - \__kernel_msg_error:nnx { kernel } { non-base-function } - { \token_to_str:N #5 } + \__kernel_msg_error:nnxxx { kernel } { non-base-function } + { \token_to_str:N #5 } {#2} { \__cs_tmp:w } } \cs_generate_from_arg_count:NNnn #5 #4 { \tl_count:n {#2} } {#6} @@ -2245,6 +2246,27 @@ \group_end: #1 { \token_to_str:N #2 = \cs_meaning:N #2 } } +\cs_new_protected:Npn \group_show_list: + { \__kernel_group_show:NN \use_none:n 1 } +\cs_new_protected:Npn \group_log_list: + { \__kernel_group_show:NN \int_zero:N 0 } +\cs_new_protected:Npn \__kernel_group_show:NN #1#2 + { + \use:x + { + #1 \tex_interactionmode:D + \int_set:Nn \tex_tracingonline:D {#2} + \int_set:Nn \tex_errorcontextlines:D { -1 } + \exp_not:N \exp_after:wN \scan_stop: + \tex_showgroups:D + \int_set:Nn \tex_interactionmode:D + { \int_use:N \tex_interactionmode:D } + \int_set:Nn \tex_tracingonline:D + { \int_use:N \tex_tracingonline:D } + \int_set:Nn \tex_errorcontextlines:D + { \int_use:N \tex_errorcontextlines:D } + } + } \use:x { \exp_not:n { \cs_new:Npn \__kernel_prefix_arg_replacement:wN #1 } @@ -3652,9 +3674,9 @@ \cs_generate_variant:Nn \tl_const:Nn { c } \cs_generate_variant:Nn \tl_const:Nx { c } \cs_new_protected:Npn \tl_clear:N #1 - { \tl_set_eq:NN #1 \c_empty_tl } + { \tex_let:D #1 = ~ \c_empty_tl } \cs_new_protected:Npn \tl_gclear:N #1 - { \tl_gset_eq:NN #1 \c_empty_tl } + { \tex_global:D \tex_let:D #1 ~ \c_empty_tl } \cs_generate_variant:Nn \tl_clear:N { c } \cs_generate_variant:Nn \tl_gclear:N { c } \cs_new_protected:Npn \tl_clear_new:N #1 @@ -3663,8 +3685,10 @@ { \tl_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } \cs_generate_variant:Nn \tl_clear_new:N { c } \cs_generate_variant:Nn \tl_gclear_new:N { c } -\cs_new_protected:Npn \tl_set_eq:NN #1#2 { \cs_set_eq:NN #1 #2 } -\cs_new_protected:Npn \tl_gset_eq:NN #1#2 { \cs_gset_eq:NN #1 #2 } +\cs_new_protected:Npn \tl_set_eq:NN #1#2 + { \tex_let:D #1 = ~ #2 } +\cs_new_protected:Npn \tl_gset_eq:NN #1#2 + { \tex_global:D \tex_let:D #1 = ~ #2 } \cs_generate_variant:Nn \tl_set_eq:NN { cN, Nc, cc } \cs_generate_variant:Nn \tl_gset_eq:NN { cN, Nc, cc } \cs_new_protected:Npn \tl_concat:NNN #1#2#3 @@ -3689,14 +3713,9 @@ \prg_new_eq_conditional:NNn \tl_if_exist:c \cs_if_exist:c { TF , T , F , p } \tl_const:Nn \c_empty_tl { } \group_begin: -\tex_lccode:D `A = `- -\tex_lccode:D `N = `N -\tex_lccode:D `V = `V -\tex_lowercase:D - { - \group_end: - \tl_const:Nn \c_novalue_tl { ANoValue- } - } +\tex_catcode:D `- = 11 ~ +\tl_const:Nx \c_novalue_tl { - NoValue \token_to_str:N - } +\group_end: \tl_const:Nn \c_space_tl { ~ } \cs_new_protected:Npn \tl_set:Nn #1#2 { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w {#2} } } @@ -4097,13 +4116,13 @@ \prg_new_conditional:Npnn \tl_if_novalue:n ##1 { p , T , F , TF } { - \str_if_eq:onTF - { \__tl_if_novalue:w ? ##1 { } #1 } - { ? { } #1 } - { \prg_return_true: } - { \prg_return_false: } + \__tl_if_empty_if:o { \__tl_if_novalue:w {} ##1 {} ? ! #1 ? ? ! } + \prg_return_true: + \else: + \prg_return_false: + \fi: } - \cs_new:Npn \__tl_if_novalue:w ##1 #1 {##1} + \cs_new:Npn \__tl_if_novalue:w ##1 #1 ##2 ? ##3 ? ! { ##1 ##2 } } \exp_args:No \__tl_tmp:w { \c_novalue_tl } \cs_new:Npn \tl_if_single_p:N { \exp_args:No \tl_if_single_p:n } @@ -4170,26 +4189,38 @@ { \exp_end: #1 #4 } \cs_new:Npn \tl_map_function:nN #1#2 { - \__tl_map_function:Nn #2 #1 - \q__tl_recursion_tail + \__tl_map_function:Nnnnnnnnn #2 #1 + \s__tl_stop \s__tl_stop \s__tl_stop \s__tl_stop + \s__tl_stop \s__tl_stop \s__tl_stop \s__tl_stop \prg_break_point:Nn \tl_map_break: { } } \cs_new:Npn \tl_map_function:NN { \exp_args:No \tl_map_function:nN } -\cs_new:Npn \__tl_map_function:Nn #1#2 +\cs_generate_variant:Nn \tl_map_function:NN { c } +\cs_new:Npn \__tl_map_function:Nnnnnnnnn #1#2#3#4#5#6#7#8#9 { - \__tl_if_recursion_tail_break:nN {#2} \tl_map_break: - #1 {#2} \__tl_map_function:Nn #1 + \__tl_use_none_delimit_by_s_stop:w + #9 \__tl_map_function_end:w \s__tl_stop + #1 {#2} #1 {#3} #1 {#4} #1 {#5} #1 {#6} #1 {#7} #1 {#8} #1 {#9} + \__tl_map_function:Nnnnnnnnn #1 } -\cs_generate_variant:Nn \tl_map_function:NN { c } +\cs_new:Npn \__tl_map_function_end:w \s__tl_stop #1#2 + { + \__tl_use_none_delimit_by_s_stop:w #2 \tl_map_break: \s__tl_stop + #1 {#2} + \__tl_map_function_end:w \s__tl_stop + } +\cs_new:Npn \__tl_use_none_delimit_by_s_stop:w #1 \s__tl_stop { } \cs_new_protected:Npn \tl_map_inline:nn #1#2 { \int_gincr:N \g__kernel_prg_map_int \cs_gset_protected:cpn { __tl_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2} - \exp_args:Nc \__tl_map_function:Nn + \exp_args:Nc \__tl_map_function:Nnnnnnnnn { __tl_map_ \int_use:N \g__kernel_prg_map_int :w } - #1 \q__tl_recursion_tail + #1 + \s__tl_stop \s__tl_stop \s__tl_stop \s__tl_stop + \s__tl_stop \s__tl_stop \s__tl_stop \s__tl_stop \prg_break_point:Nn \tl_map_break: { \int_gdecr:N \g__kernel_prg_map_int } } @@ -4198,34 +4229,34 @@ \cs_generate_variant:Nn \tl_map_inline:Nn { c } \cs_new:Npn \tl_map_tokens:nn #1#2 { - \__tl_map_tokens:nn {#2} #1 - \q__tl_recursion_tail + \__tl_map_tokens:nnnnnnnnn {#2} #1 + \s__tl_stop \s__tl_stop \s__tl_stop \s__tl_stop + \s__tl_stop \s__tl_stop \s__tl_stop \s__tl_stop \prg_break_point:Nn \tl_map_break: { } } \cs_new:Npn \tl_map_tokens:Nn { \exp_args:No \tl_map_tokens:nn } \cs_generate_variant:Nn \tl_map_tokens:Nn { c } -\cs_new:Npn \__tl_map_tokens:nn #1#2 +\cs_new:Npn \__tl_map_tokens:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { - \__tl_if_recursion_tail_break:nN {#2} \tl_map_break: - \use:n {#1} {#2} - \__tl_map_tokens:nn {#1} + \__tl_use_none_delimit_by_s_stop:w + #9 \__tl_map_tokens_end:w \s__tl_stop + \use:n {#1} {#2} \use:n {#1} {#3} \use:n {#1} {#4} \use:n {#1} {#5} + \use:n {#1} {#6} \use:n {#1} {#7} \use:n {#1} {#8} \use:n {#1} {#9} + \__tl_map_tokens:nnnnnnnnn {#1} } -\cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 +\cs_new:Npn \__tl_map_tokens_end:w \s__tl_stop \use:n #1#2 { - \__tl_map_variable:Nnn #2 {#3} #1 - \q__tl_recursion_tail - \prg_break_point:Nn \tl_map_break: { } + \__tl_use_none_delimit_by_s_stop:w #2 \tl_map_break: \s__tl_stop + #1 {#2} + \__tl_map_tokens_end:w \s__tl_stop } +\cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 + { \tl_map_tokens:nn {#1} { \__tl_map_variable:Nnn #2 {#3} } } +\cs_new_protected:Npn \__tl_map_variable:Nnn #1#2#3 + { \tl_set:Nn #1 {#3} #2 } \cs_new_protected:Npn \tl_map_variable:NNn { \exp_args:No \tl_map_variable:nNn } -\cs_new_protected:Npn \__tl_map_variable:Nnn #1#2#3 - { - \__tl_if_recursion_tail_break:nN {#3} \tl_map_break: - \tl_set:Nn #1 {#3} - \use:n {#2} - \__tl_map_variable:Nnn #1 {#2} - } \cs_generate_variant:Nn \tl_map_variable:NNn { c } \cs_new:Npn \tl_map_break: { \prg_map_break:Nn \tl_map_break: { } } @@ -4663,7 +4694,7 @@ } \cs_new:Npn \__tl_range_skip:w #1 ; #2 { - \if_int_compare:w #1 > 0 \exp_stop_f: + \if_int_compare:w #1 > \c_zero_int \exp_after:wN \__tl_range_skip:w \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; \else: @@ -4712,7 +4743,7 @@ { \int_eval:n { - \if_int_compare:w #1 < 0 \exp_stop_f: + \if_int_compare:w #1 < \c_zero_int \if_int_compare:w #1 < -#2 \exp_stop_f: 0 \else: @@ -4915,25 +4946,37 @@ \prg_new_eq_conditional:NNn \str_if_empty:c \tl_if_empty:c { p , T , F , TF } \cs_new_eq:NN \__str_if_eq:nn \tex_strcmp:D +\prg_new_conditional:Npnn \str_compare:nNn #1#2#3 { p , T , F , TF } + { + \if_int_compare:w + \__str_if_eq:nn { \exp_not:n {#1} } { \exp_not:n {#3} } + #2 \c_zero_int + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \str_compare:eNe #1#2#3 { p , T , F , TF } + { + \if_int_compare:w \__str_if_eq:nn {#1} {#3} #2 \c_zero_int + \prg_return_true: \else: \prg_return_false: \fi: + } \prg_new_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF } { \if_int_compare:w \__str_if_eq:nn { \exp_not:n {#1} } { \exp_not:n {#2} } - = 0 \exp_stop_f: + = \c_zero_int \prg_return_true: \else: \prg_return_false: \fi: } \prg_generate_conditional_variant:Nnn \str_if_eq:nn { V , v , o , nV , no , VV , nv } { p , T , F , TF } \prg_new_conditional:Npnn \str_if_eq:ee #1#2 { p , T , F , TF } { - \if_int_compare:w \__str_if_eq:nn {#1} {#2} = 0 \exp_stop_f: + \if_int_compare:w \__str_if_eq:nn {#1} {#2} = \c_zero_int \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F } { \if_int_compare:w \__str_if_eq:nn { \tl_to_str:N #1 } { \tl_to_str:N #2 } - = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: + = \c_zero_int \prg_return_true: \else: \prg_return_false: \fi: } \prg_generate_conditional_variant:Nnn \str_if_eq:NN { c , Nc , cc } { T , F , TF , p } @@ -5232,7 +5275,7 @@ { \int_eval:n { - \if_int_compare:w #1 < 0 \exp_stop_f: + \if_int_compare:w #1 < \c_zero_int \if_int_compare:w #1 < -#2 \exp_stop_f: 0 \else: @@ -5267,7 +5310,7 @@ \cs_new:Npn \__str_collect_end:wn #1 ; { \exp_after:wN \__str_collect_end:nnnnnnnnw - \if_case:w \if_int_compare:w #1 > 0 \exp_stop_f: + \if_case:w \if_int_compare:w #1 > \c_zero_int #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \fi: } @@ -5883,13 +5926,21 @@ \exp_after:wN \__seq_map_function:Nw \exp_after:wN #2 #1 - \prg_break: \__seq_item:n { } \prg_break_point: + \prg_break: + \__seq_item:n { } \__seq_item:n { } \__seq_item:n { } \__seq_item:n { } + \prg_break_point: \prg_break_point:Nn \seq_map_break: { } } -\cs_new:Npn \__seq_map_function:Nw #1#2 \__seq_item:n #3 +\cs_new:Npn \__seq_map_function:Nw #1 + #2 \__seq_item:n #3 + #4 \__seq_item:n #5 + #6 \__seq_item:n #7 + #8 \__seq_item:n #9 { - #2 - #1 {#3} + #2 #1 {#3} + #4 #1 {#5} + #6 #1 {#7} + #8 #1 {#9} \__seq_map_function:Nw #1 } \cs_generate_variant:Nn \seq_map_function:NN { c } @@ -5926,14 +5977,22 @@ { \exp_last_unbraced:Nno \use_i:nn { \__seq_map_tokens:nw {#2} } #1 - \prg_break: \__seq_item:n { } \prg_break_point: + \prg_break: + \__seq_item:n { } \__seq_item:n { } \__seq_item:n { } \__seq_item:n { } + \prg_break_point: \prg_break_point:Nn \seq_map_break: { } } \cs_generate_variant:Nn \seq_map_tokens:Nn { c } -\cs_new:Npn \__seq_map_tokens:nw #1#2 \__seq_item:n #3 - { - #2 - \use:n {#1} {#3} +\cs_new:Npn \__seq_map_tokens:nw #1 + #2 \__seq_item:n #3 + #4 \__seq_item:n #5 + #6 \__seq_item:n #7 + #8 \__seq_item:n #9 + { + #2 \use:n {#1} {#3} + #4 \use:n {#1} {#5} + #6 \use:n {#1} {#7} + #8 \use:n {#1} {#9} \__seq_map_tokens:nw {#1} } \cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 @@ -6137,8 +6196,8 @@ \__kernel_quark_new_test:N \__int_if_recursion_tail_stop_do:Nn \__kernel_quark_new_test:N \__int_if_recursion_tail_stop:N \cs_new:Npn \int_eval:n #1 - { \int_value:w \__int_eval:w #1 \__int_eval_end: } -\cs_new:Npn \int_eval:w { \int_value:w \__int_eval:w } + { \tex_the:D \__int_eval:w #1 \__int_eval_end: } +\cs_new:Npn \int_eval:w { \tex_the:D \__int_eval:w } \cs_new:Npn \int_sign:n #1 { \int_value:w \exp_after:wN \__int_sign:Nw @@ -6284,13 +6343,13 @@ \prg_new_eq_conditional:NNn \int_if_exist:c \cs_if_exist:c { TF , T , F , p } \cs_new_protected:Npn \int_add:Nn #1#2 - { \tex_advance:D #1 by \__int_eval:w #2 \__int_eval_end: } + { \tex_advance:D #1 \__int_eval:w #2 \__int_eval_end: } \cs_new_protected:Npn \int_sub:Nn #1#2 - { \tex_advance:D #1 by - \__int_eval:w #2 \__int_eval_end: } + { \tex_advance:D #1 - \__int_eval:w #2 \__int_eval_end: } \cs_new_protected:Npn \int_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \__int_eval:w #2 \__int_eval_end: } + { \tex_global:D \tex_advance:D #1 \__int_eval:w #2 \__int_eval_end: } \cs_new_protected:Npn \int_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \__int_eval:w #2 \__int_eval_end: } + { \tex_global:D \tex_advance:D #1 - \__int_eval:w #2 \__int_eval_end: } \cs_generate_variant:Nn \int_add:Nn { c } \cs_generate_variant:Nn \int_gadd:Nn { c } \cs_generate_variant:Nn \int_sub:Nn { c } @@ -6308,9 +6367,9 @@ \cs_generate_variant:Nn \int_gincr:N { c } \cs_generate_variant:Nn \int_gdecr:N { c } \cs_new_protected:Npn \int_set:Nn #1#2 - { #1 ~ \__int_eval:w #2 \__int_eval_end: } + { #1 = \__int_eval:w #2 \__int_eval_end: } \cs_new_protected:Npn \int_gset:Nn #1#2 - { \tex_global:D #1 ~ \__int_eval:w #2 \__int_eval_end: } + { \tex_global:D #1 = \__int_eval:w #2 \__int_eval_end: } \cs_generate_variant:Nn \int_set:Nn { c } \cs_generate_variant:Nn \int_gset:Nn { c } \cs_new_eq:NN \int_use:N \tex_the:D @@ -7618,6 +7677,32 @@ } } } +\sys_if_engine_luatex:TF + { + \cs_new:Npn \sys_timer: + { \__sys_elapsedtime: } + } + { + \cs_if_exist:NTF \tex_elapsedtime:D + { + \cs_new:Npn \sys_timer: + { \int_value:w \tex_elapsedtime:D } + } + { + \__kernel_msg_new:nnnn { kernel } { no-elapsed-time } + { No~clock~detected~for~#1. } + { The~current~engine~provides~no~way~to~access~the~system~time. } + \cs_new:Npn \sys_timer: + { + \int_value:w + \__kernel_msg_expandable_error:nnn { kernel } { no-elapsed-time } + { \sys_timer: } + \c_zero_int + } + } + } +\__sys_const:nn { sys_if_timer_exist } + { \cs_if_exist_p:N \tex_elapsedtime:D || \cs_if_exist_p:N \__sys_elapsedtime: } \__sys_everyjob:n { \int_const:Nn \c_sys_shell_escape_int @@ -7716,10 +7801,6 @@ \cs_new:Npn \__clist_use_none_delimit_by_s_mark:w #1 \s__clist_mark { } \cs_new:Npn \__clist_use_none_delimit_by_s_stop:w #1 \s__clist_stop { } \cs_new:Npn \__clist_use_i_delimit_by_s_stop:nw #1 #2 \s__clist_stop {#1} -\quark_new:N \q__clist_recursion_tail -\quark_new:N \q__clist_recursion_stop -\__kernel_quark_new_test:N \__clist_if_recursion_tail_break:nN -\__kernel_quark_new_test:N \__clist_if_recursion_tail_stop:n \cs_new_protected:Npn \__clist_tmp:w { } \cs_new:Npn \__clist_trim_next:w #1 , { @@ -7731,11 +7812,11 @@ { \exp_after:wN \__clist_sanitize:Nn \exp_after:wN \c_empty_tl \exp:w \__clist_trim_next:w \prg_do_nothing: - #1 , \q__clist_recursion_tail , \q__clist_recursion_stop + #1 , \s__clist_stop \prg_break: , \prg_break_point: } \cs_new:Npn \__clist_sanitize:Nn #1#2 { - \__clist_if_recursion_tail_stop:n {#2} + \__clist_use_none_delimit_by_s_stop:w #2 \s__clist_stop #1 \__clist_wrap_item:w #2 , \exp_after:wN \__clist_sanitize:Nn \exp_after:wN , \exp:w \__clist_trim_next:w \prg_do_nothing: @@ -7955,7 +8036,13 @@ \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} } + { + \tl_put_right:Nx \l__clist_internal_remove_clist + { + \clist_if_empty:NF \l__clist_internal_remove_clist { , } + \__clist_if_wrap:nTF {##1} { \exp_not:n { {##1} } } { \exp_not:n {##1} } + } + } } #1 #2 \l__clist_internal_remove_clist } @@ -8077,27 +8164,36 @@ { \clist_if_empty:NF #1 { - \exp_last_unbraced:NNo \__clist_map_function:nw #2 #1 - , \q__clist_recursion_tail , + \exp_after:wN \__clist_map_function:Nw \exp_after:wN #2 #1 , + \s__clist_stop , \s__clist_stop , \s__clist_stop , \s__clist_stop , + \s__clist_stop , \s__clist_stop , \s__clist_stop , \s__clist_stop , \prg_break_point:Nn \clist_map_break: { } } } -\cs_new:Npn \__clist_map_function:nw #1#2 , +\cs_new:Npn \__clist_map_function:Nw #1 #2, #3, #4, #5, #6, #7, #8, #9, { - \__clist_if_recursion_tail_break:nN {#2} \clist_map_break: + \__clist_use_none_delimit_by_s_stop:w + #9 \__clist_map_function_end:w \s__clist_stop + #1 {#2} #1 {#3} #1 {#4} #1 {#5} #1 {#6} #1 {#7} #1 {#8} #1 {#9} + \__clist_map_function:Nw #1 + } +\cs_new:Npn \__clist_map_function_end:w \s__clist_stop #1#2 + { + \__clist_use_none_delimit_by_s_stop:w #2 \clist_map_break: \s__clist_stop #1 {#2} - \__clist_map_function:nw {#1} + \__clist_map_function_end:w \s__clist_stop } \cs_generate_variant:Nn \clist_map_function:NN { c } \cs_new:Npn \clist_map_function:nN #1#2 { \exp_after:wN \__clist_map_function_n:Nn \exp_after:wN #2 - \exp:w \__clist_trim_next:w \prg_do_nothing: #1 , \q__clist_recursion_tail , + \exp:w \__clist_trim_next:w \prg_do_nothing: #1 , + \s__clist_stop \clist_map_break: , \prg_break_point:Nn \clist_map_break: { } } \cs_new:Npn \__clist_map_function_n:Nn #1 #2 { - \__clist_if_recursion_tail_break:nN {#2} \clist_map_break: + \__clist_use_none_delimit_by_s_stop:w #2 \s__clist_stop \__clist_map_unbrace:wn #2 , #1 \exp_after:wN \__clist_map_function_n:Nn \exp_after:wN #1 \exp:w \__clist_trim_next:w \prg_do_nothing: @@ -8110,9 +8206,11 @@ \int_gincr:N \g__kernel_prg_map_int \cs_gset_protected:cpn { __clist_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2} - \exp_last_unbraced:Nco \__clist_map_function:nw + \exp_last_unbraced:Nco \__clist_map_function:Nw { __clist_map_ \int_use:N \g__kernel_prg_map_int :w } - #1 , \q__clist_recursion_tail , + #1 , + \s__clist_stop , \s__clist_stop , \s__clist_stop , \s__clist_stop , + \s__clist_stop , \s__clist_stop , \s__clist_stop , \s__clist_stop , \prg_break_point:Nn \clist_map_break: { \int_gdecr:N \g__kernel_prg_map_int } } @@ -8124,56 +8222,56 @@ } \cs_generate_variant:Nn \clist_map_inline:Nn { c } \cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 - { - \clist_if_empty:NF #1 - { - \exp_args:Nno \use:nn - { \__clist_map_variable:Nnw #2 {#3} } - #1 - , \q__clist_recursion_tail , \q__clist_recursion_stop - \prg_break_point:Nn \clist_map_break: { } - } - } + { \clist_map_tokens:Nn #1 { \__clist_map_variable:Nnn #2 {#3} } } +\cs_generate_variant:Nn \clist_map_variable:NNn { c } +\cs_new_protected:Npn \__clist_map_variable:Nnn #1#2#3 + { \tl_set:Nn #1 {#3} #2 } \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 } -\cs_new_protected:Npn \__clist_map_variable:Nnw #1#2#3, - { - \__clist_if_recursion_tail_stop:n {#3} - \tl_set:Nn #1 {#3} - \use:n {#2} - \__clist_map_variable:Nnw #1 {#2} - } -\cs_generate_variant:Nn \clist_map_variable:NNn { c } \cs_new:Npn \clist_map_tokens:Nn #1#2 { \clist_if_empty:NF #1 { - \exp_last_unbraced:Nno \__clist_map_function:nw {#2} #1 - , \q__clist_recursion_tail , + \exp_last_unbraced:Nno \__clist_map_tokens:nw {#2} #1 , + \s__clist_stop , \s__clist_stop , \s__clist_stop , \s__clist_stop , + \s__clist_stop , \s__clist_stop , \s__clist_stop , \s__clist_stop , \prg_break_point:Nn \clist_map_break: { } } } +\cs_new:Npn \__clist_map_tokens:nw #1 #2, #3, #4, #5, #6, #7, #8, #9, + { + \__clist_use_none_delimit_by_s_stop:w + #9 \__clist_map_tokens_end:w \s__clist_stop + \use:n {#1} {#2} \use:n {#1} {#3} \use:n {#1} {#4} \use:n {#1} {#5} + \use:n {#1} {#6} \use:n {#1} {#7} \use:n {#1} {#8} \use:n {#1} {#9} + \__clist_map_tokens:nw {#1} + } +\cs_new:Npn \__clist_map_tokens_end:w \s__clist_stop \use:n #1#2 + { + \__clist_use_none_delimit_by_s_stop:w #2 \clist_map_break: \s__clist_stop + #1 {#2} + \__clist_map_tokens_end:w \s__clist_stop + } \cs_generate_variant:Nn \clist_map_tokens:Nn { c } \cs_new:Npn \clist_map_tokens:nn #1#2 { \__clist_map_tokens_n:nw {#2} - \prg_do_nothing: #1 , \q__clist_recursion_tail , + \prg_do_nothing: #1 , \s__clist_stop \clist_map_break: , \prg_break_point:Nn \clist_map_break: { } } \cs_new:Npn \__clist_map_tokens_n:nw #1#2 , { \tl_if_empty:oF { \use_none:nn #2 ? } { - \exp_args:No \__clist_if_recursion_tail_break:nN {#2} \clist_map_break: - \tl_trim_spaces_apply:oN {#2} \__clist_use_ii_i:nn + \__clist_use_none_delimit_by_s_stop:w #2 \s__clist_stop + \tl_trim_spaces_apply:oN {#2} \use_ii_i:nn \__clist_map_unbrace:wn , {#1} } \__clist_map_tokens_n:nw {#1} \prg_do_nothing: } -\cs_new:Npn \__clist_use_ii_i:nn #1#2 { #2 #1 } \cs_new:Npn \clist_map_break: { \prg_map_break:Nn \clist_map_break: { } } \cs_new:Npn \clist_map_break:n @@ -8187,22 +8285,26 @@ } } \cs_generate_variant:Nn \clist_count:N { c } -\cs_new:Npx \clist_count:n #1 +\cs_new:Npn \__clist_count:n #1 { + 1 } +\cs_set_protected:Npn \__clist_tmp:w #1 { - \exp_not:N \int_eval:n + \cs_new:Npn \clist_count:n ##1 { - 0 - \exp_not:N \__clist_count:w \c_space_tl - #1 \exp_not:n { , \q__clist_recursion_tail , \q__clist_recursion_stop } + \int_eval:n + { + 0 + \__clist_count:w #1 + ##1 , \s__clist_stop \prg_break: , \prg_break_point: + } + } + \cs_new:Npn \__clist_count:w ##1 , + { + \__clist_use_none_delimit_by_s_stop:w ##1 \s__clist_stop + \tl_if_blank:nF {##1} { + 1 } + \__clist_count:w #1 } } -\cs_new:Npn \__clist_count:n #1 { + 1 } -\cs_new:Npx \__clist_count:w #1 , - { - \exp_not:n { \exp_args:Nf \__clist_if_recursion_tail_stop:n } {#1} - \exp_not:N \tl_if_blank:nF {#1} { + 1 } - \exp_not:N \__clist_count:w \c_space_tl - } +\exp_args:No \__clist_tmp:w \c_space_tl \cs_new:Npn \clist_use:Nnnn #1#2#3#4 { \clist_if_exist:NTF #1 @@ -8252,7 +8354,7 @@ { \__clist_use:Nw #1#2 ; } { \__clist_use_none_delimit_by_s_mark:w #4 #1 \s__clist_mark - \tl_trim_spaces_apply:oN {#4} \__clist_use_ii_i:nn + \tl_trim_spaces_apply:oN {#4} \use_ii_i:nn \__clist_map_unbrace:wn , { #2 ; } } #3 ; \prg_do_nothing: @@ -8508,7 +8610,7 @@ \cs_new:Npn \__char_generate_aux:w #1 ; #2 ; { \if_int_compare:w #2 = 10 \exp_stop_f: - \if_int_compare:w #1 = 0 \exp_stop_f: + \if_int_compare:w #1 = \c_zero_int \__kernel_msg_expandable_error:nn { char } { null-space } \else: \__kernel_msg_expandable_error:nn { char } { space } @@ -8523,7 +8625,7 @@ { invalid-catcode } \else: \if_int_odd:w 0 - \if_int_compare:w #1 < 0 \exp_stop_f: 1 \fi: + \if_int_compare:w #1 < \c_zero_int 1 \fi: \if_int_compare:w #1 > \c_max_char_int 1 \fi: \exp_stop_f: \__kernel_msg_expandable_error:nn { char } { out-of-range } @@ -9302,10 +9404,10 @@ \cs_new_protected:Npn \__peek_execute_branches_N_type: { \if_int_odd:w - \if_catcode:w \exp_not:N \l_peek_token { 0 \exp_stop_f: \fi: - \if_catcode:w \exp_not:N \l_peek_token } 0 \exp_stop_f: \fi: - \if_meaning:w \l_peek_token \c_space_token 0 \exp_stop_f: \fi: - 1 \exp_stop_f: + \if_catcode:w \exp_not:N \l_peek_token { \c_zero_int \fi: + \if_catcode:w \exp_not:N \l_peek_token } \c_zero_int \fi: + \if_meaning:w \l_peek_token \c_space_token \c_zero_int \fi: + \c_one_int \exp_after:wN \__peek_N_type:w \token_to_meaning:N \l_peek_token \s__peek_mark \__peek_N_type_aux:nnw @@ -9380,6 +9482,18 @@ \prop_new:N \g_tmpa_prop \prop_new:N \g_tmpb_prop \prop_new:N \l__prop_internal_prop +\cs_new_protected:Npn \prop_concat:NNN + { \__prop_concat:NNNN \prop_set_eq:NN } +\cs_generate_variant:Nn \prop_concat:NNN { ccc } +\cs_new_protected:Npn \prop_gconcat:NNN + { \__prop_concat:NNNN \prop_gset_eq:NN } +\cs_generate_variant:Nn \prop_gconcat:NNN { ccc } +\cs_new_protected:Npn \__prop_concat:NNNN #1#2#3#4 + { + \prop_set_eq:NN \l__prop_internal_prop #3 + \prop_map_tokens:Nn #4 { \prop_put:Nnn \l__prop_internal_prop } + #1 #2 \l__prop_internal_prop + } \cs_new_protected:Npn \prop_set_from_keyval:Nn #1#2 { \prop_clear:N \l__prop_internal_prop @@ -9404,6 +9518,22 @@ \prop_clear:N \l__prop_internal_prop } \cs_generate_variant:Nn \prop_const_from_keyval:Nn { c } +\cs_new_protected:Npn \prop_put_from_keyval:Nn #1#2 + { + \prop_set_eq:NN \l__prop_internal_prop #1 + \__prop_from_keyval:n {#2} + \prop_set_eq:NN #1 \l__prop_internal_prop + \prop_clear:N \l__prop_internal_prop + } +\cs_generate_variant:Nn \prop_put_from_keyval:Nn { c } +\cs_new_protected:Npn \prop_gput_from_keyval:Nn #1#2 + { + \prop_set_eq:NN \l__prop_internal_prop #1 + \__prop_from_keyval:n {#2} + \prop_gset_eq:NN #1 \l__prop_internal_prop + \prop_clear:N \l__prop_internal_prop + } +\cs_generate_variant:Nn \prop_gput_from_keyval:Nn { c } \cs_new_protected:Npn \__prop_from_keyval:n #1 { \__prop_from_keyval_loop:w \prg_do_nothing: #1 , @@ -9429,10 +9559,10 @@ { \__prop_from_keyval_value:w #1 \s__prop_mark } \cs_new_protected:Npn \__prop_from_keyval_value:w #1 \s__prop_mark #2 \s__prop_stop #3#4 { - \tl_if_empty:nF { #3 #1 #2 } + \tl_if_single:nTF {#2} + { \prop_put:Nnn \l__prop_internal_prop {#3} {#1} } { - \str_if_eq:nnTF {#2} { = } - { \prop_put:Nnn \l__prop_internal_prop {#3} {#1} } + \tl_if_empty:nF { #3 #1 #2 } { \__kernel_msg_error:nnx { prop } { prop-keyval } { \exp_not:o {#4} } @@ -9498,15 +9628,13 @@ \cs_generate_variant:Nn \prop_gpop:NnN { c , co } \cs_new:Npn \prop_item:Nn #1#2 { - \exp_last_unbraced:Noo \__prop_item_Nn:nwwn { \tl_to_str:n {#2} } #1 - \__prop_pair:wn \tl_to_str:n {#2} \s__prop { } - \prg_break_point: + \exp_args:NNo \prop_map_tokens:Nn #1 + { \exp_after:wN \__prop_item:nnn \exp_after:wN { \tl_to_str:n {#2} } } } -\cs_new:Npn \__prop_item_Nn:nwwn #1#2 \__prop_pair:wn #3 \s__prop #4 +\cs_new:Npn \__prop_item:nnn #1#2#3 { - \str_if_eq:eeTF {#1} {#3} - { \prg_break:n { \exp_not:n {#4} } } - { \__prop_item_Nn:nwwn {#1} } + \str_if_eq:eeT {#1} {#2} + { \prop_map_break:n { \exp_not:n {#3} } } } \cs_generate_variant:Nn \prop_item:Nn { c } \cs_new:Npn \prop_count:N #1 @@ -9592,25 +9720,14 @@ { c } { p , T , F , TF } \prg_new_conditional:Npnn \prop_if_in:Nn #1#2 { p , T , F , TF } { - \exp_last_unbraced:Noo \__prop_if_in:nwwn { \tl_to_str:n {#2} } #1 - \__prop_pair:wn \tl_to_str:n {#2} \s__prop { } - \q__prop_recursion_tail - \prg_break_point: + \exp_args:NNo \prop_map_tokens:Nn #1 + { \exp_after:wN \__prop_if_in:nnn \exp_after:wN { \tl_to_str:n {#2} } } + \prg_return_false: } -\cs_new:Npn \__prop_if_in:nwwn #1#2 \__prop_pair:wn #3 \s__prop #4 +\cs_new:Npn \__prop_if_in:nnn #1#2#3 { - \str_if_eq:eeTF {#1} {#3} - { \__prop_if_in:N } - { \__prop_if_in:nwwn {#1} } - } -\cs_new:Npn \__prop_if_in:N #1 - { - \if_meaning:w \q__prop_recursion_tail #1 - \prg_return_false: - \else: - \prg_return_true: - \fi: - \prg_break: + \str_if_eq:eeT {#1} {#2} + { \prop_map_break:n { \use_i:nn \prg_return_true: } } } \prg_generate_conditional_variant:Nnn \prop_if_in:Nn { NV , No , c , cV , co } { p , T , F , TF } @@ -9628,17 +9745,26 @@ \cs_new:Npn \prop_map_function:NN #1#2 { \exp_after:wN \use_i_ii:nnn - \exp_after:wN \__prop_map_function:Nwwn + \exp_after:wN \__prop_map_function:Nw \exp_after:wN #2 #1 - \prg_break: \__prop_pair:wn \s__prop { } \prg_break_point: + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } \prg_break_point:Nn \prop_map_break: { } } -\cs_new:Npn \__prop_map_function:Nwwn #1#2 \__prop_pair:wn #3 \s__prop #4 +\cs_new:Npn \__prop_map_function:Nw #1 + \__prop_pair:wn #2 \s__prop #3 + \__prop_pair:wn #4 \s__prop #5 + \__prop_pair:wn #6 \s__prop #7 + \__prop_pair:wn #8 \s__prop #9 { - #2 - #1 {#3} {#4} - \__prop_map_function:Nwwn #1 + \if_false: #2 \fi: #1 {#2} {#3} + \if_false: #4 \fi: #1 {#4} {#5} + \if_false: #6 \fi: #1 {#6} {#7} + \if_false: #8 \fi: #1 {#8} {#9} + \__prop_map_function:Nw #1 } \cs_generate_variant:Nn \prop_map_function:NN { Nc , c , cc } \cs_new_protected:Npn \prop_map_inline:Nn #1#2 @@ -9659,15 +9785,24 @@ \cs_new:Npn \prop_map_tokens:Nn #1#2 { \exp_last_unbraced:Nno - \use_i:nn { \__prop_map_tokens:nwwn {#2} } #1 - \prg_break: \__prop_pair:wn \s__prop { } \prg_break_point: + \use_i:nn { \__prop_map_tokens:nw {#2} } #1 + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } + \__prop_pair:wn \fi: \prop_map_break: \s__prop { } \prg_break_point:Nn \prop_map_break: { } } -\cs_new:Npn \__prop_map_tokens:nwwn #1#2 \__prop_pair:wn #3 \s__prop #4 +\cs_new:Npn \__prop_map_tokens:nw #1 + \__prop_pair:wn #2 \s__prop #3 + \__prop_pair:wn #4 \s__prop #5 + \__prop_pair:wn #6 \s__prop #7 + \__prop_pair:wn #8 \s__prop #9 { - #2 - \use:n {#1} {#3} {#4} - \__prop_map_tokens:nwwn {#1} + \if_false: #2 \fi: \use:n {#1} {#2} {#3} + \if_false: #4 \fi: \use:n {#1} {#4} {#5} + \if_false: #6 \fi: \use:n {#1} {#6} {#7} + \if_false: #8 \fi: \use:n {#1} {#8} {#9} + \__prop_map_tokens:nw {#1} } \cs_generate_variant:Nn \prop_map_tokens:Nn { c } \cs_new:Npn \prop_map_break: @@ -9894,7 +10029,7 @@ \cs_new:Npn \__msg_text:nn #1#2 { \exp_args:Nf \__msg_text:n { \msg_module_type:n {#1} } - \msg_module_name:n {#1} ~ + \exp_args:Nf \__msg_text:n { \msg_module_name:n {#1} } #2 } \cs_new:Npn \__msg_text:n #1 @@ -10012,16 +10147,22 @@ { } \iow_term:n \iow_term:n { } } + \__msg_class_new:nn { note } + { + \__msg_info_aux:Nnn \iow_term:n {#1} + { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + } \__msg_class_new:nn { info } { - \str_set:Nx \l__msg_text_str { \msg_info_text:n {#1} } - \str_set:Nx \l__msg_name_str { \msg_module_name:n {#1} } - \iow_log:n { } - \iow_wrap:nxnN - { - \l__msg_text_str : ~ - \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - } + \__msg_info_aux:Nnn \iow_log:n {#1} + { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + } + \cs_new_protected:Npn \__msg_info_aux:Nnn #1#2#3 + { + \str_set:Nx \l__msg_text_str { \msg_info_text:n {#2} } + \str_set:Nx \l__msg_name_str { \msg_module_name:n {#2} } + #1 { } + \iow_wrap:nxnN { \l__msg_text_str : ~ #3 } { ( \l__msg_name_str ) \prg_replicate:nn @@ -10031,8 +10172,8 @@ } { ~ } } - { } \iow_log:n - \iow_log:n { } + { } #1 + #1 { } } \__msg_class_new:nn { log } { @@ -10273,6 +10414,9 @@ \cs_new_protected:Npn \__kernel_msg_log:nnnnnn #1 { \msg_log:nnnnnn { LaTeX / #1 } } \cs_generate_variant:Nn \__kernel_msg_log:nnnnnn { nnxxxx } +\cs_new_protected:Npn \__kernel_msg_term:nnnnnn #1 + { \msg_term:nnnnnn { LaTeX / #1 } } +\cs_generate_variant:Nn \__kernel_msg_term:nnnnnn { nnxxxx } \cs_new_protected:Npn \__kernel_msg_show:nnnnnn #1 { \msg_show:nnnnnn { LaTeX / #1 } } \cs_generate_variant:Nn \__kernel_msg_show:nnnnnn { nnxxxx } @@ -10355,6 +10499,7 @@ \c__msg_coding_error_text_tl Functions~defined~through~\iow_char:N\\cs_new:Nn~must~have~ a~signature~consisting~of~only~normal~arguments~'N'~and~'n'.~ + The~signature~'#2'~of~'#1'~contains~other~arguments~'#3'.~ To~define~variants~use~\iow_char:N\\cs_generate_variant:Nn~ and~to~define~other~functions~use~\iow_char:N\\cs_new:Npn. } @@ -10774,6 +10919,22 @@ } } \cs_generate_variant:Nn \ior_close:N { c } +\cs_new_protected:Npn \ior_show:N { \__ior_show:NN \tl_show:n } +\cs_generate_variant:Nn \ior_show:N { c } +\cs_new_protected:Npn \ior_log:N { \__ior_show:NN \tl_log:n } +\cs_generate_variant:Nn \ior_log:N { c } +\cs_new_protected:Npn \__ior_show:NN #1#2 + { + \__kernel_chk_defined:NT #2 + { + \prop_get:NVNTF \g__ior_streams_prop #2 \l__ior_internal_tl + { + \exp_args:Nx #1 + { \token_to_str:N #2 ~ open: ~ \l__ior_internal_tl } + } + { \exp_args:Nx #1 { \token_to_str:N #2 ~ closed } } + } + } \cs_new_protected:Npn \ior_show_list: { \__ior_list:N \__kernel_msg_show:nnxxxx } \cs_new_protected:Npn \ior_log_list: { \__ior_list:N \__kernel_msg_log:nnxxxx } \cs_new_protected:Npn \__ior_list:N #1 @@ -10900,6 +11061,7 @@ #4 \__ior_map_variable_loop:NNNn #1#2#3 {#4} } +\tl_new:N \l__iow_internal_tl \int_const:Nn \c_log_iow { -1 } \int_const:Nn \c_term_iow { @@ -10970,6 +11132,22 @@ } } \cs_generate_variant:Nn \iow_close:N { c } +\cs_new_protected:Npn \iow_show:N { \__iow_show:NN \tl_show:n } +\cs_generate_variant:Nn \iow_show:N { c } +\cs_new_protected:Npn \iow_log:N { \__iow_show:NN \tl_log:n } +\cs_generate_variant:Nn \iow_log:N { c } +\cs_new_protected:Npn \__iow_show:NN #1#2 + { + \__kernel_chk_defined:NT #2 + { + \prop_get:NVNTF \g__iow_streams_prop #2 \l__iow_internal_tl + { + \exp_args:Nx #1 + { \token_to_str:N #2 ~ open: ~ \l__iow_internal_tl } + } + { \exp_args:Nx #1 { \token_to_str:N #2 ~ closed } } + } + } \cs_new_protected:Npn \iow_show_list: { \__iow_list:N \__kernel_msg_show:nnxxxx } \cs_new_protected:Npn \iow_log_list: { \__iow_list:N \__kernel_msg_log:nnxxxx } \cs_new_protected:Npn \__iow_list:N #1 @@ -11831,7 +12009,7 @@ \__file_str_cmp:nn { \__file_timestamp:n {#1} } { \__file_timestamp:n {#2} } - #3 0 \exp_stop_f: + #3 \c_zero_int \prg_return_true: \else: \prg_return_false: @@ -12191,12 +12369,12 @@ \cs_new_protected:Npn \dim_const:Nn #1#2 { \dim_new:N #1 - \tex_global:D #1 ~ \dim_eval:n {#2} \scan_stop: + \tex_global:D #1 = \dim_eval:n {#2} \scan_stop: } \cs_generate_variant:Nn \dim_const:Nn { c } -\cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_skip } +\cs_new_protected:Npn \dim_zero:N #1 { #1 = \c_zero_skip } \cs_new_protected:Npn \dim_gzero:N #1 - { \tex_global:D #1 \c_zero_skip } + { \tex_global:D #1 = \c_zero_skip } \cs_generate_variant:Nn \dim_zero:N { c } \cs_generate_variant:Nn \dim_gzero:N { c } \cs_new_protected:Npn \dim_zero_new:N #1 @@ -12210,9 +12388,9 @@ \prg_new_eq_conditional:NNn \dim_if_exist:c \cs_if_exist:c { TF , T , F , p } \cs_new_protected:Npn \dim_set:Nn #1#2 - { #1 ~ \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } + { #1 = \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } \cs_new_protected:Npn \dim_gset:Nn #1#2 - { \tex_global:D #1 ~ \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } + { \tex_global:D #1 = \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_set:Nn { c } \cs_generate_variant:Nn \dim_gset:Nn { c } \cs_new_protected:Npn \dim_set_eq:NN #1#2 @@ -12222,19 +12400,19 @@ { \tex_global:D #1 = #2 \scan_stop: } \cs_generate_variant:Nn \dim_gset_eq:NN { c , Nc , cc } \cs_new_protected:Npn \dim_add:Nn #1#2 - { \tex_advance:D #1 by \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } + { \tex_advance:D #1 \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } \cs_new_protected:Npn \dim_gadd:Nn #1#2 { - \tex_global:D \tex_advance:D #1 by + \tex_global:D \tex_advance:D #1 \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } \cs_new_protected:Npn \dim_sub:Nn #1#2 - { \tex_advance:D #1 by - \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } + { \tex_advance:D #1 - \__dim_eval:w #2 \__dim_eval_end: \scan_stop: } \cs_new_protected:Npn \dim_gsub:Nn #1#2 { - \tex_global:D \tex_advance:D #1 by + \tex_global:D \tex_advance:D #1 -\__dim_eval:w #2 \__dim_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_sub:Nn { c } @@ -12493,7 +12671,7 @@ ##1 . ##2 \tl_to_str:n { pt } } { - \int_compare:nNnTF {#2} > { 0 } + \int_compare:nNnTF {#2} > \c_zero_int { #1 . #2 } { #1 } } @@ -12533,11 +12711,11 @@ \cs_new_protected:Npn \skip_const:Nn #1#2 { \skip_new:N #1 - \tex_global:D #1 ~ \skip_eval:n {#2} \scan_stop: + \tex_global:D #1 = \skip_eval:n {#2} \scan_stop: } \cs_generate_variant:Nn \skip_const:Nn { c } -\cs_new_protected:Npn \skip_zero:N #1 { #1 \c_zero_skip } -\cs_new_protected:Npn \skip_gzero:N #1 { \tex_global:D #1 \c_zero_skip } +\cs_new_eq:NN \skip_zero:N \dim_zero:N +\cs_new_eq:NN \skip_gzero:N \dim_gzero:N \cs_generate_variant:Nn \skip_zero:N { c } \cs_generate_variant:Nn \skip_gzero:N { c } \cs_new_protected:Npn \skip_zero_new:N #1 @@ -12551,9 +12729,9 @@ \prg_new_eq_conditional:NNn \skip_if_exist:c \cs_if_exist:c { TF , T , F , p } \cs_new_protected:Npn \skip_set:Nn #1#2 - { #1 ~ \tex_glueexpr:D #2 \scan_stop: } + { #1 = \tex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gset:Nn #1#2 - { \tex_global:D #1 ~ \tex_glueexpr:D #2 \scan_stop: } + { \tex_global:D #1 = \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_set:Nn { c } \cs_generate_variant:Nn \skip_gset:Nn { c } \cs_new_protected:Npn \skip_set_eq:NN #1#2 { #1 = #2 } @@ -12561,20 +12739,20 @@ \cs_new_protected:Npn \skip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \skip_gset_eq:NN { c , Nc , cc } \cs_new_protected:Npn \skip_add:Nn #1#2 - { \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: } + { \tex_advance:D #1 \tex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_add:Nn { c } \cs_generate_variant:Nn \skip_gadd:Nn { c } \cs_new_protected:Npn \skip_sub:Nn #1#2 - { \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: } + { \tex_advance:D #1 - \tex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 - \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_sub:Nn { c } \cs_generate_variant:Nn \skip_gsub:Nn { c } \prg_new_conditional:Npnn \skip_if_eq:nn #1#2 { p , T , F , TF } { - \str_if_eq:eeTF { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } + \str_if_eq:eeTF { \skip_eval:n {#1} } { \skip_eval:n {#2} } { \prg_return_true: } { \prg_return_false: } } @@ -12591,8 +12769,8 @@ \exp_args:No \__skip_tmp:w { \tl_to_str:n { fil } } \cs_new:Npn \skip_eval:n #1 { \skip_use:N \tex_glueexpr:D #1 \scan_stop: } -\cs_new_eq:NN \skip_use:N \tex_the:D -\cs_new:Npn \skip_use:c #1 { \tex_the:D \cs:w #1 \cs_end: } +\cs_new_eq:NN \skip_use:N \dim_use:N +\cs_new_eq:NN \skip_use:c \dim_use:c \cs_new_eq:NN \skip_horizontal:N \tex_hskip:D \cs_new:Npn \skip_horizontal:n #1 { \skip_horizontal:N \tex_glueexpr:D #1 \scan_stop: } @@ -12624,13 +12802,13 @@ \cs_new_protected:Npn \muskip_const:Nn #1#2 { \muskip_new:N #1 - \tex_global:D #1 ~ \muskip_eval:n {#2} \scan_stop: + \tex_global:D #1 = \muskip_eval:n {#2} \scan_stop: } \cs_generate_variant:Nn \muskip_const:Nn { c } \cs_new_protected:Npn \muskip_zero:N #1 - { #1 \c_zero_muskip } + { #1 = \c_zero_muskip } \cs_new_protected:Npn \muskip_gzero:N #1 - { \tex_global:D #1 \c_zero_muskip } + { \tex_global:D #1 = \c_zero_muskip } \cs_generate_variant:Nn \muskip_zero:N { c } \cs_generate_variant:Nn \muskip_gzero:N { c } \cs_new_protected:Npn \muskip_zero_new:N #1 @@ -12644,9 +12822,9 @@ \prg_new_eq_conditional:NNn \muskip_if_exist:c \cs_if_exist:c { TF , T , F , p } \cs_new_protected:Npn \muskip_set:Nn #1#2 - { #1 ~ \tex_muexpr:D #2 \scan_stop: } + { #1 = \tex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gset:Nn #1#2 - { \tex_global:D #1 ~ \tex_muexpr:D #2 \scan_stop: } + { \tex_global:D #1 = \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_set:Nn { c } \cs_generate_variant:Nn \muskip_gset:Nn { c } \cs_new_protected:Npn \muskip_set_eq:NN #1#2 { #1 = #2 } @@ -12654,21 +12832,21 @@ \cs_new_protected:Npn \muskip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \muskip_gset_eq:NN { c , Nc , cc } \cs_new_protected:Npn \muskip_add:Nn #1#2 - { \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: } + { \tex_advance:D #1 \tex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_add:Nn { c } \cs_generate_variant:Nn \muskip_gadd:Nn { c } \cs_new_protected:Npn \muskip_sub:Nn #1#2 - { \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: } + { \tex_advance:D #1 - \tex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 - \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_sub:Nn { c } \cs_generate_variant:Nn \muskip_gsub:Nn { c } \cs_new:Npn \muskip_eval:n #1 { \muskip_use:N \tex_muexpr:D #1 \scan_stop: } -\cs_new_eq:NN \muskip_use:N \tex_the:D -\cs_generate_variant:Nn \muskip_use:N { c } +\cs_new_eq:NN \muskip_use:N \dim_use:N +\cs_new_eq:NN \muskip_use:c \dim_use:c \cs_new_eq:NN \muskip_show:N \__kernel_register_show:N \cs_generate_variant:Nn \muskip_show:N { c } \cs_new_protected:Npn \muskip_show:n @@ -12689,12 +12867,29 @@ \scan_new:N \s__keyval_stop \scan_new:N \s__keyval_tail \group_begin: - \cs_set_protected:Npn \__keyval_tmp:NN #1#2 + \cs_set_protected:Npn \__keyval_tmp:w #1#2 { - \cs_new:Npn \keyval_parse:nnn ##1 ##2 ##3 + \cs_if_exist:NTF \tex_expanded:D + { + \cs_new:Npn \keyval_parse:nnn ##1 ##2 ##3 + { + \__kernel_exp_not:w \tex_expanded:D + { + { + \__keyval_loop_active:nnw {##1} {##2} + \s__keyval_mark ##3 #1 \s__keyval_tail #1 + } + } + } + } { - \group_align_safe_begin: - \__keyval_loop_active:nnw {##1} {##2} \s__keyval_mark ##3 #1 \s__keyval_tail #1 + \cs_new:Npn \keyval_parse:nnn ##1 ##2 ##3 + { + \group_align_safe_begin: + \__keyval_loop_active:nnw {##1} {##2} + \s__keyval_mark ##3 #1 \s__keyval_tail #1 + \group_align_safe_end: + } } \cs_new_eq:NN \keyval_parse:NNn \keyval_parse:nnn \cs_new:Npn \__keyval_loop_active:nnw ##1 ##2 ##3 #1 @@ -12804,47 +12999,54 @@ \cs_new:Npn \__keyval_end_loop_active:w \s__keyval_tail \__keyval_loop_other:nnw ##1 \s__keyval_mark \s__keyval_tail , \s__keyval_tail , - { \group_align_safe_end: } + { } } \char_set_catcode_active:n { `\, } \char_set_catcode_active:n { `\= } - \__keyval_tmp:NN , = + \__keyval_tmp:w , = +\group_end: +\group_begin: + \cs_set_protected:Npn \__keyval_tmp:w #1#2 + { + \cs_new:Npn \__keyval_pair:nnnn ##1 ##2 ##3 ##4 + { + \__keyval_if_blank:w \s__keyval_mark ##2 \s__keyval_nil \s__keyval_stop \__keyval_blank_key_error:w + \s__keyval_mark \s__keyval_stop + #1 + \exp_not:n { ##4 {##2} {##1} } + #2 + \__keyval_loop_other:nnw {##3} {##4} + } + \cs_new:Npn \__keyval_key:nn ##1 ##2 + { + \__keyval_if_blank:w \s__keyval_mark ##1 \s__keyval_nil \s__keyval_stop \__keyval_blank_key_error:w + \s__keyval_mark \s__keyval_stop + #1 + \exp_not:n { ##2 {##1} } + #2 + \__keyval_loop_other:nnw {##2} + } + } + \cs_if_exist:NTF \tex_expanded:D + { \__keyval_tmp:w { } { } } + { \__keyval_tmp:w \group_align_safe_end: \group_align_safe_begin: } \group_end: -\cs_new:Npn \__keyval_pair:nnnn #1 #2 #3 #4 - { - \__keyval_if_blank:w \s__keyval_mark #2 \s__keyval_nil \s__keyval_stop \__keyval_blank_key_error:w - \s__keyval_mark \s__keyval_stop - \group_align_safe_end: - \exp_not:n { #4 { #2 } { #1 } } - \group_align_safe_begin: - \__keyval_loop_other:nnw {#3} {#4} - } -\cs_new:Npn \__keyval_key:nn #1 #2 - { - \__keyval_if_blank:w \s__keyval_mark #1 \s__keyval_nil \s__keyval_stop \__keyval_blank_key_error:w - \s__keyval_mark \s__keyval_stop - \group_align_safe_end: - \exp_not:n { #2 { #1 } } - \group_align_safe_begin: - \__keyval_loop_other:nnw {#2} - } \cs_new:Npn \__keyval_if_empty:w #1 \s__keyval_mark \s__keyval_stop { } \cs_new:Npn \__keyval_if_blank:w \s__keyval_mark #1 { \__keyval_if_empty:w \s__keyval_mark } \cs_new:Npn \__keyval_if_recursion_tail:w \s__keyval_mark #1 \s__keyval_tail { } \cs_new:Npn \__keyval_blank_true:w \s__keyval_mark \s__keyval_stop \__keyval_trim:nN #1 \__keyval_key:nn { \__keyval_loop_other:nnw } -\cs_new:Npn \__keyval_blank_key_error:w - \s__keyval_mark \s__keyval_stop \group_align_safe_end: \exp_not:n #1 +\cs_new:Npn \__keyval_blank_key_error:w #1 \__keyval_loop_other:nnw { - \__kernel_msg_expandable_error:nn - { keyval } { blank-key-name } + \__kernel_msg_expandable_error:nn { keyval } { blank-key-name } + \__keyval_loop_other:nnw } \__kernel_msg_new:nnn { keyval } { misplaced-equals-sign } { Misplaced~equals~sign~in~key-value~input~\msg_line_context: } \__kernel_msg_new:nnn { keyval } { blank-key-name } { Blank~key~name~in~key-value~input~\msg_line_context: } \group_begin: - \cs_set_protected:Npn \__keyval_tmp:n #1 + \cs_set_protected:Npn \__keyval_tmp:w #1 { \cs_new:Npn \__keyval_trim:nN ##1 { @@ -12882,7 +13084,7 @@ ##2 { ##2 { ##1 } } } - \__keyval_tmp:n { ~ } + \__keyval_tmp:w { ~ } \group_end: \str_const:Nn \c__keys_code_root_str { key~code~>~ } \str_const:Nn \c__keys_default_root_str { key~default~>~ } @@ -13817,7 +14019,7 @@ { } \group_begin: - \cs_set:Npn \__keys_tmp:n #1 + \cs_set:Npn \__keys_tmp:w #1 { \cs_new:Npn \__keys_trim_spaces:n ##1 { @@ -13829,7 +14031,7 @@ \s__keys_mark \__keys_trim_spaces_auxiii:w } } - \__keys_tmp:n { ~ } + \__keys_tmp:w { ~ } \group_end: \cs_new:Npn \__keys_trim_spaces_auxi:w #1 ~ / #2 \s__keys_nil #3 { @@ -14566,7 +14768,7 @@ \if_meaning:w 0 #1 \exp_after:wN \__fp_small_int_true:wTF \int_value:w \if_meaning:w 2 #5 - \fi: - \if_int_compare:w #2 > 0 \exp_stop_f: + \if_int_compare:w #2 > \c_zero_int 1 0000 0000 \else: #3 @@ -14786,21 +14988,21 @@ \cs_new:Npn \__fp_round_to_ninf:NNN #1 #2 #3 { \if_meaning:w 2 #1 - \if_int_compare:w #3 > 0 \exp_stop_f: + \if_int_compare:w #3 > \c_zero_int \__fp_round_return_one: \fi: \fi: - 0 \exp_stop_f: + \c_zero_int } -\cs_new:Npn \__fp_round_to_zero:NNN #1 #2 #3 { 0 \exp_stop_f: } +\cs_new:Npn \__fp_round_to_zero:NNN #1 #2 #3 { \c_zero_int } \cs_new:Npn \__fp_round_to_pinf:NNN #1 #2 #3 { \if_meaning:w 0 #1 - \if_int_compare:w #3 > 0 \exp_stop_f: + \if_int_compare:w #3 > \c_zero_int \__fp_round_return_one: \fi: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new:Npn \__fp_round_to_nearest:NNN #1 #2 #3 { @@ -14813,7 +15015,7 @@ \fi: \fi: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new:Npn \__fp_round_to_nearest_ninf:NNN #1 #2 #3 { @@ -14826,14 +15028,14 @@ \fi: \fi: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new:Npn \__fp_round_to_nearest_zero:NNN #1 #2 #3 { \if_int_compare:w #3 > \c__fp_five_int \__fp_round_return_one: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new:Npn \__fp_round_to_nearest_pinf:NNN #1 #2 #3 { @@ -14846,7 +15048,7 @@ \fi: \fi: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new_eq:NN \__fp_round:NNN \__fp_round_to_nearest:NNN \cs_new:Npn \__fp_round_s:NNNw #1 #2 #3 #4; @@ -14858,7 +15060,7 @@ \if_int_odd:w 0 \if_meaning:w 0 #3 1 \fi: \if_meaning:w 5 #3 1 \fi: \exp_stop_f: - \if_int_compare:w \__fp_int_eval:w #4 > 0 \exp_stop_f: + \if_int_compare:w \__fp_int_eval:w #4 > \c_zero_int 1 + \fi: \fi: @@ -14870,7 +15072,7 @@ \if_int_odd:w \if_meaning:w 0 #1 1 \else: \if_meaning:w 5 #1 1 \else: 0 \fi: \fi: \exp_stop_f: - \if_int_compare:w \__fp_int_eval:w #2 > 0 \exp_stop_f: + \if_int_compare:w \__fp_int_eval:w #2 > \c_zero_int \__fp_int_eval:w 1 + \fi: \fi: @@ -14879,10 +15081,10 @@ \cs_new_eq:NN \__fp_round_to_ninf_neg:NNN \__fp_round_to_pinf:NNN \cs_new:Npn \__fp_round_to_zero_neg:NNN #1 #2 #3 { - \if_int_compare:w #3 > 0 \exp_stop_f: + \if_int_compare:w #3 > \c_zero_int \__fp_round_return_one: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new_eq:NN \__fp_round_to_pinf_neg:NNN \__fp_round_to_ninf:NNN \cs_new_eq:NN \__fp_round_to_nearest_neg:NNN \__fp_round_to_nearest:NNN @@ -14893,7 +15095,7 @@ \if_int_compare:w #3 < \c__fp_five_int \else: \__fp_round_return_one: \fi: - 0 \exp_stop_f: + \c_zero_int } \cs_new_eq:NN \__fp_round_to_nearest_pinf_neg:NNN \__fp_round_to_nearest_ninf:NNN @@ -14999,12 +15201,12 @@ { \exp_after:wN \__fp_round_normal:NNwNnn \int_value:w \__fp_int_eval:w - \if_int_compare:w #2 > 0 \exp_stop_f: + \if_int_compare:w #2 > \c_zero_int 1 \int_value:w #2 \exp_after:wN \__fp_round_pack:Nw \int_value:w \__fp_int_eval:w 1#3 + \else: - \if_int_compare:w #3 > 0 \exp_stop_f: + \if_int_compare:w #3 > \c_zero_int 1 \int_value:w #3 + \fi: \fi: @@ -15666,7 +15868,7 @@ \if_meaning:w \scan_stop: #1 \if_int_compare:w \__fp_str_if_eq:nn { \s__fp } { \exp_not:N #1 } - = 0 \exp_stop_f: + = \c_zero_int 0 \__kernel_msg_expandable_error:nnn { fp } { after-e } { floating~point~ } @@ -15680,7 +15882,7 @@ \else: \if_int_compare:w \__fp_str_if_eq:nn { \int_value:w #1 } { \tex_the:D #1 } - = 0 \exp_stop_f: + = \c_zero_int \int_value:w #1 \else: 0 @@ -15968,7 +16170,7 @@ \if_catcode:w \scan_stop: \exp_not:N #2 \if_int_compare:w \__fp_str_if_eq:nn { \s__fp_expr_mark } { \exp_not:N #2 } - = 0 \exp_stop_f: + = \c_zero_int \exp_after:wN \exp_after:wN \exp_after:wN \__fp_parse_infix_mark:NNN \else: @@ -16012,7 +16214,7 @@ \if_catcode:w \scan_stop: \exp_not:N #2 \if_int_compare:w \__fp_str_if_eq:nn { \s__fp_expr_mark } { \exp_not:N #2 } - = 0 \exp_stop_f: + = \c_zero_int \exp_after:wN \exp_after:wN \exp_after:wN \__fp_parse_infix_mark:NNN \else: @@ -16569,7 +16771,7 @@ \if_int_compare:w #4 < #1 - \fi: 1 \fi: \else: - \if_int_compare:w #1#4 = 0 \exp_stop_f: + \if_int_compare:w #1#4 = \c_zero_int 0 \else: 1 @@ -16601,7 +16803,7 @@ \use_none:n #1 \use_none:n #4 \if_int_compare:w - \__fp_compare_back_any:ww #1 #2 ; #4 #5 ; = 0 \exp_stop_f: + \__fp_compare_back_any:ww #1 #2 ; #4 #5 ; = \c_zero_int \else: 2 \exp_after:wN \prg_break: \fi: @@ -17547,15 +17749,15 @@ \cs_new:Npn \__fp_sqrt_auxiii_o:wnnnnnnnn #1; #2#3#4#5#6#7#8#9 { - \if_int_compare:w #1 > 1 \exp_stop_f: + \if_int_compare:w #1 > \c_one_int \exp_after:wN \__fp_sqrt_auxiv_o:NNNNNw \int_value:w \__fp_int_eval:w (#1#2 %) \else: - \if_int_compare:w #1#2 > 1 \exp_stop_f: + \if_int_compare:w #1#2 > \c_one_int \exp_after:wN \__fp_sqrt_auxv_o:NNNNNw \int_value:w \__fp_int_eval:w (#1#2#3 %) \else: - \if_int_compare:w #1#2#3 > 1 \exp_stop_f: + \if_int_compare:w #1#2#3 > \c_one_int \exp_after:wN \__fp_sqrt_auxvi_o:NNNNNw \int_value:w \__fp_int_eval:w (#1#2#3#4 %) \else: @@ -17573,7 +17775,7 @@ { \__fp_sqrt_auxviii_o:nnnnnnn {0000000#1} {#2#3#4#5#6} } \cs_new:Npn \__fp_sqrt_auxvii_o:NNNNNw 1#1#2#3#4#5#6; { - \if_int_compare:w #1#2 = 0 \exp_stop_f: + \if_int_compare:w #1#2 = \c_zero_int \exp_after:wN \__fp_sqrt_auxx_o:Nnnnnnnn \fi: \__fp_sqrt_auxviii_o:nnnnnnn {00000000} {000#1#2#3#4#5} @@ -17608,11 +17810,11 @@ } \cs_new:Npn \__fp_sqrt_auxxii_o:nnnnnnnnw 0; #1#2#3#4#5#6#7#8 #9; { - \if_int_compare:w #1#2 > 0 \exp_stop_f: - \if_int_compare:w #1#2 = 1 \exp_stop_f: - \if_int_compare:w #3#4 = 0 \exp_stop_f: - \if_int_compare:w #5#6 = 0 \exp_stop_f: - \if_int_compare:w #7#8 = 0 \exp_stop_f: + \if_int_compare:w #1#2 > \c_zero_int + \if_int_compare:w #1#2 = \c_one_int + \if_int_compare:w #3#4 = \c_zero_int + \if_int_compare:w #5#6 = \c_zero_int + \if_int_compare:w #7#8 = \c_zero_int \__fp_sqrt_auxxiii_o:w \fi: \fi: @@ -18196,7 +18398,7 @@ { %^^A todo: ln(1) should be "exact zero", not "underflow" \exp_after:wN \__fp_sanitize:Nw \int_value:w % for the overall sign - \if_int_compare:w #1 < 1 \exp_stop_f: + \if_int_compare:w #1 < \c_one_int 2 \else: 0 @@ -18339,7 +18541,7 @@ { \__fp_ln_Taylor_loop:www 21 ; {0000}{0000}{0000}{0000}{0000}{0000} ; } \cs_new:Npn \__fp_ln_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = 1 \exp_stop_f: + \if_int_compare:w #1 = \c_one_int \__fp_ln_Taylor_break:w \fi: \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl #1; @@ -18373,7 +18575,7 @@ \or: \exp_after:wN \__fp_ln_exponent_one:ww \int_value:w \else: - \if_int_compare:w #2 > 0 \exp_stop_f: + \if_int_compare:w #2 > \c_zero_int \exp_after:wN \__fp_ln_exponent_small:NNww \exp_after:wN 0 \exp_after:wN \__fp_fixed_sub:wwn \int_value:w @@ -18440,7 +18642,7 @@ \exp_after:wN \__fp_sanitize:Nw \exp_after:wN 0 \int_value:w #1 \__fp_int_eval:w - \if_int_compare:w #4 < 0 \exp_stop_f: + \if_int_compare:w #4 < \c_zero_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -18480,7 +18682,7 @@ { \__fp_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s__fp_stop } \cs_new:Npn \__fp_exp_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = 1 \exp_stop_f: + \if_int_compare:w #1 = \c_one_int \exp_after:wN \__fp_exp_Taylor_break:Nww \fi: \__fp_fixed_div_int:wwN #3 ; #1 ; @@ -18652,7 +18854,7 @@ \s__fp \__fp_chk:w 1 #1#2#3; \s__fp \__fp_chk:w #4#5 { \if_int_compare:w \__fp_str_if_eq:nn { #2 #3 } - { 1 {1000} {0000} {0000} {0000} } = 0 \exp_stop_f: + { 1 {1000} {0000} {0000} {0000} } = \c_zero_int \if_int_compare:w #4 #1 = 32 \exp_stop_f: \exp_after:wN \__fp_case_return_ii_o:ww \fi: @@ -18664,7 +18866,7 @@ \exp_after:wN #5 \or: \if_meaning:w 2 #5 \exp_after:wN \reverse_if:N \fi: - \if_int_compare:w #2 > 0 \exp_stop_f: + \if_int_compare:w #2 > \c_zero_int \exp_after:wN \__fp_case_return_o:Nww \exp_after:wN \c_inf_fp \else: @@ -18682,7 +18884,7 @@ \exp_after:wN \__fp_sanitize:Nw \exp_after:wN 0 \int_value:w - \if:w #1 \if_int_compare:w #3 > 0 \exp_stop_f: 0 \else: 2 \fi: + \if:w #1 \if_int_compare:w #3 > \c_zero_int 0 \else: 2 \fi: \exp_after:wN \__fp_pow_npos_aux:NNnww \exp_after:wN + \exp_after:wN \__fp_fixed_to_float_o:wN @@ -18705,7 +18907,7 @@ } \cs_new:Npn \__fp_pow_exponent:wnN #1; #2 { - \if_int_compare:w #2 > 0 \exp_stop_f: + \if_int_compare:w #2 > \c_zero_int \exp_after:wN \__fp_pow_exponent:Nwnnnnnw % n\ln(10) - (-\ln(x)) \exp_after:wN + \else: @@ -18737,7 +18939,7 @@ } \cs_new:Npn \__fp_pow_B:wwN #1#2#3#4#5#6; #7; { - \if_int_compare:w #7 < 0 \exp_stop_f: + \if_int_compare:w #7 < \c_zero_int \exp_after:wN \__fp_pow_C_neg:w \int_value:w - \else: \if_int_compare:w #7 < 22 \exp_stop_f: @@ -18787,7 +18989,7 @@ \if_case:w \__fp_pow_neg_case:w #4 ; \exp_after:wN \__fp_pow_neg_aux:wNN \or: - \if_int_compare:w \__fp_int_eval:w #1 / 2 = 1 \exp_stop_f: + \if_int_compare:w \__fp_int_eval:w #1 / 2 = \c_one_int \__fp_invalid_operation_o:Nww ^ #3; #4; \exp:w \exp_end_continue_f:w \exp_after:wN \exp_after:wN @@ -19581,7 +19783,7 @@ 7 - \__fp_int_eval:w \fi: \if_int_compare:w - \__fp_ep_compare:wwww #2,#3; #5,#6; > 0 \exp_stop_f: + \__fp_ep_compare:wwww #2,#3; #5,#6; > \c_zero_int 3 - \exp_after:wN \__fp_reverse_args:Nww \fi: @@ -19625,7 +19827,7 @@ } \cs_new:Npn \__fp_atan_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = -1 \exp_stop_f: + \if_int_compare:w #1 = - \c_one_int \__fp_atan_Taylor_break:w \fi: \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl #1; @@ -19709,7 +19911,7 @@ \cs_new:Npn \__fp_asin_normal_o:NfwNnnnnw #1#2#3 \s__fp \__fp_chk:w 1#4#5#6#7#8#9; { - \if_int_compare:w #5 < 1 \exp_stop_f: + \if_int_compare:w #5 < \c_one_int \exp_after:wN \__fp_use_none_until_s:w \fi: \if_int_compare:w \__fp_int_eval:w #5 + #6#7 + #8#9 = 1000 0001 ~ @@ -19939,7 +20141,7 @@ \cs_new:Npn \__fp_to_decimal_large:Nnnw #1#2#3#4; { \exp_after:wN \__fp_trim_zeros:w \int_value:w - \if_int_compare:w #2 > 0 \exp_stop_f: + \if_int_compare:w #2 > \c_zero_int #2 \fi: \exp_stop_f: @@ -20172,19 +20374,19 @@ \if_meaning:w 1 #1 \if_int_compare:w \__fp_use_i_until_s:nw #3 ; > \c__fp_prec_int - 1 \exp_stop_f: + \c_one_int \fi: \fi: } - { 1 \exp_stop_f: } + { \c_one_int } } \cs_new:Npn \__fp_randint_o:w #1; #2; @ { \if_case:w \__fp_randint_badarg:w #1; \__fp_randint_badarg:w #2; - \if:w 1 \__fp_compare_back:ww #2; #1; 1 \exp_stop_f: \fi: - 0 \exp_stop_f: + \if:w 1 \__fp_compare_back:ww #2; #1; \c_one_int \fi: + \c_zero_int \__fp_randint_auxi_o:ww #1; #2; \or: \__fp_invalid_operation_tl_o:ff @@ -20368,7 +20570,7 @@ } \cs_new:Npn \__fp_randint:n #1 { - \if_int_compare:w #1 < 1 \exp_stop_f: + \if_int_compare:w #1 < \c_one_int \__kernel_msg_expandable_error:nnnn { kernel } { randint-backward-range } { 1 } {#1} \__fp_randint:ww #1; 1; @@ -21610,7 +21812,7 @@ \file_if_exist:nTF { l3str-#2- \l__str_internal_tl .def } { \group_begin: - \__str_load_catcodes: + \cctab_select:N \c_code_cctab \file_input:n { l3str-#2- \l__str_internal_tl .def } \group_end: } @@ -21653,24 +21855,6 @@ \fi: \__str_convert_lowercase_alphanum_loop:N } -\cs_new_protected:Npn \__str_load_catcodes: - { - \char_set_catcode_escape:N \\ - \char_set_catcode_group_begin:N \{ - \char_set_catcode_group_end:N \} - \char_set_catcode_math_toggle:N \$ - \char_set_catcode_alignment:N \& - \char_set_catcode_parameter:N \# - \char_set_catcode_math_superscript:N \^ - \char_set_catcode_ignore:N \ % - \char_set_catcode_space:N \~ - \tl_map_function:nN { abcdefghijklmnopqrstuvwxyz_:ABCDEFILNPSTUX } - \char_set_catcode_letter:N - \tl_map_function:nN { 0123456789"'?*+-.(),`!/<>[];= } - \char_set_catcode_other:N - \char_set_catcode_comment:N \% - \int_set:Nn \tex_endlinechar:D {32} - } \bool_lazy_any:nTF { \sys_if_engine_luatex_p: @@ -22635,7 +22819,7 @@ \exp_after:wN \__str_decode_utf_xxxii_end:w \fi: #1#2#3#4 \s__str - \if_int_compare:w \__str_tmp:w #1#4 > 0 \exp_stop_f: + \if_int_compare:w \__str_tmp:w #1#4 > \c_zero_int \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c__str_replacement_char_int @@ -22884,7 +23068,7 @@ plus \l__tl_analysis_type_int sp \scan_stop: \int_incr:N \l__tl_analysis_index_int \int_zero:N \l__tl_analysis_normal_int - \if_int_compare:w \l__tl_analysis_nesting_int = -1 \exp_stop_f: + \if_int_compare:w \l__tl_analysis_nesting_int = - \c_one_int \cs_set_eq:NN \__tl_analysis_a_loop:w \scan_stop: \fi: } @@ -22907,7 +23091,7 @@ } \cs_new_protected:Npn \__tl_analysis_a_cs:ww #1; #2; { - \if_int_compare:w #1 > 0 \exp_stop_f: + \if_int_compare:w #1 > \c_zero_int \tex_skip:D \l__tl_analysis_index_int = \int_eval:n { \l__tl_analysis_normal_int + 1 } sp \exp_stop_f: \tex_advance:D \l__tl_analysis_index_int #1 \exp_stop_f: @@ -22931,7 +23115,7 @@ } \cs_new:Npn \__tl_analysis_b_normals:ww #1; { - \if_int_compare:w #1 = 0 \exp_stop_f: + \if_int_compare:w #1 = \c_zero_int \__tl_analysis_b_special:w \fi: \__tl_analysis_b_normal:wwN #1; @@ -22982,7 +23166,7 @@ { \exp_after:wN \__tl_analysis_b_normals:ww \int_value:w \int_eval:w - \if_int_compare:w #1 = 0 \exp_stop_f: + \if_int_compare:w #1 = \c_zero_int #3 \else: \tex_skip:D \int_eval:n { #4 + #1 } \exp_stop_f: @@ -23053,21 +23237,28 @@ \prg_break_point:Nn \tl_map_break: { \int_gdecr:N \g__kernel_prg_map_int } } -\cs_new_protected:Npn \tl_analysis_show:N #1 +\cs_new_protected:Npn \tl_analysis_show:N + { \__tl_analysis_show:NNN \__kernel_msg_show:nnxxxx \tl_show:N } +\cs_new_protected:Npn \tl_analysis_log:N + { \__tl_analysis_show:NNN \__kernel_msg_log:nnxxxx \tl_log:N } +\cs_new_protected:Npn \__tl_analysis_show:NNN #1#2#3 { - \tl_if_exist:NTF #1 + \tl_if_exist:NTF #3 { - \exp_args:No \__tl_analysis:n {#1} - \__kernel_msg_show:nnxxxx { tl } { show-analysis } - { \token_to_str:N #1 } { \__tl_analysis_show: } { } { } + \exp_args:No \__tl_analysis:n {#3} + #1 { tl } { show-analysis } + { \token_to_str:N #3 } { \__tl_analysis_show: } { } { } } - { \tl_show:N #1 } + { #2 #3 } } -\cs_new_protected:Npn \tl_analysis_show:n #1 +\cs_new_protected:Npn \tl_analysis_show:n + { \__tl_analysis_show:Nn \__kernel_msg_show:nnxxxx } +\cs_new_protected:Npn \tl_analysis_log:n + { \__tl_analysis_show:Nn \__kernel_msg_log:nnxxxx } +\cs_new_protected:Npn \__tl_analysis_show:Nn #1#2 { - \__tl_analysis:n {#1} - \__kernel_msg_show:nnxxxx { tl } { show-analysis } - { } { \__tl_analysis_show: } { } { } + \__tl_analysis:n {#2} + #1 { tl } { show-analysis } { } { \__tl_analysis_show: } { } { } } \cs_new:Npn \__tl_analysis_show: { @@ -23079,7 +23270,7 @@ { \use_none:n #2 \iow_newline: > \use:nn { ~ } { ~ } - \if_int_compare:w "#2 = 0 \exp_stop_f: + \if_int_compare:w "#2 = \c_zero_int \exp_after:wN \__tl_analysis_show_cs:n \else: \if_int_compare:w "#2 = 13 \exp_stop_f: @@ -23180,10 +23371,10 @@ \cs_new_protected:Npn \__tl_peek_analysis_test: { \if_int_odd:w - \if_catcode:w \exp_not:N \l_peek_token { 0 \exp_stop_f: \fi: - \if_catcode:w \exp_not:N \l_peek_token } 0 \exp_stop_f: \fi: - \if_meaning:w \l_peek_token \c_space_token 0 \exp_stop_f: \fi: - 1 \exp_stop_f: + \if_catcode:w \exp_not:N \l_peek_token { \c_zero_int \fi: + \if_catcode:w \exp_not:N \l_peek_token } \c_zero_int \fi: + \if_meaning:w \l_peek_token \c_space_token \c_zero_int \fi: + \c_one_int \exp_after:wN \exp_after:wN \exp_after:wN \__tl_peek_analysis_normal:N \exp_after:wN \exp_not:N @@ -23651,7 +23842,7 @@ \tl_put_right:Nx \l__regex_internal_a_tl { \exp_after:wN \__regex_escape_loop:N \g__regex_internal_tl - { break } \prg_break_point: + \scan_stop: \prg_break_point: } \exp_after:wN \group_end: @@ -23673,8 +23864,8 @@ \cs_new_eq:NN \__regex_escape_unescaped:N ? \cs_new_eq:NN \__regex_escape_escaped:N ? \cs_new_eq:NN \__regex_escape_raw:N ? -\cs_new_eq:NN \__regex_escape_break:w \prg_break: -\cs_new:cpn { __regex_escape_/break:w } +\cs_new_eq:cN { __regex_escape_ \iow_char:N\\scan_stop: :w } \prg_break: +\cs_new:cpn { __regex_escape_/ \iow_char:N\\scan_stop: :w } { \__kernel_msg_expandable_error:nn { regex } { trailing-backslash } \prg_break: @@ -23711,7 +23902,10 @@ } \cs_new:Npn \__regex_escape_x_test:N #1 { - \str_if_eq:nnTF {#1} { break } { ; } + \if_meaning:w \scan_stop: #1 + \exp_after:wN \use_i:nnn \exp_after:wN ; + \fi: + \use:n { \if_charcode:w \c_space_token #1 \exp_after:wN \__regex_escape_x_test:N @@ -23733,7 +23927,10 @@ } \cs_new:Npn \__regex_escape_x:N #1 { - \str_if_eq:nnTF {#1} { break } { ; } + \if_meaning:w \scan_stop: #1 + \exp_after:wN \use_i:nnn \exp_after:wN ; + \fi: + \use:n { \__regex_hexadecimal_use:NTF #1 { ; \__regex_escape_loop:N } @@ -23742,7 +23939,10 @@ } \cs_new:Npn \__regex_escape_x_loop:N #1 { - \str_if_eq:nnTF {#1} { break } + \if_meaning:w \scan_stop: #1 + \exp_after:wN \use_ii:nnn + \fi: + \use_ii:nn { ; \__regex_escape_x_loop_error:n { } {#1} } { \__regex_hexadecimal_use:NTF #1 @@ -23975,7 +24175,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: + \if_int_compare:w \l__regex_group_level_int > \c_zero_int \__kernel_msg_error:nnx { regex } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn @@ -24461,7 +24661,7 @@ } \cs_new_protected:Npn \__regex_compile_group_end: { - \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: + \if_int_compare:w \l__regex_group_level_int > \c_zero_int \tl_build_put_right:Nn \l__regex_build_tl { \if_false: { \fi: } } \tl_build_end:N \l__regex_build_tl \exp_args:NNNx @@ -24857,7 +25057,7 @@ { \__regex_class:NnnnN \c_true_bool { - \if_int_compare:w "##3 = 0 \exp_stop_f: + \if_int_compare:w "##3 = \c_zero_int \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: @@ -25276,7 +25476,7 @@ } \cs_new_protected:Npn \__regex_class_repeat:nN #1#2 { - \if_int_compare:w #1 = 0 \exp_stop_f: + \if_int_compare:w #1 = \c_zero_int \__regex_build_transitions_lazyness:NNNNN #2 \__regex_action_free:n \l__regex_right_state_int \__regex_tests_action_cost:n \l__regex_left_state_int @@ -25302,7 +25502,7 @@ } \cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 { - \if_int_compare:w #3 = 0 \exp_stop_f: + \if_int_compare:w #3 = \c_zero_int \__regex_build_new_state: \__regex_build_transition_right:nNn \__regex_action_free_group:n \l__regex_left_state_int \l__regex_right_state_int @@ -25363,7 +25563,7 @@ } \cs_new_protected:Npn \__regex_group_repeat:nn #1#2 { - \if_int_compare:w #2 = 0 \exp_stop_f: + \if_int_compare:w #2 = \c_zero_int \int_set:Nn \l__regex_max_state_int { \l__regex_left_state_int - 1 } \__regex_build_new_state: @@ -25376,7 +25576,7 @@ } \cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - 1 \exp_stop_f: + \if_int_compare:w #1 > - \c_one_int \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:nN {#1} < } \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:nN {#1} > } \fi: @@ -25387,7 +25587,7 @@ \l__regex_right_state_int \l__regex_max_state_int \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int - \if_int_compare:w \int_eval:n {#1} > 1 \exp_stop_f: + \if_int_compare:w \int_eval:n {#1} > \c_one_int \int_set:Nn \l__regex_internal_c_int { ( #1 - 1 ) @@ -25403,7 +25603,7 @@ } \cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = 0 \exp_stop_f: + \if_int_compare:w #2 = \c_zero_int \__regex_group_submatches:nNN {#1} \l__regex_left_state_int \l__regex_right_state_int \int_set:Nn \l__regex_internal_a_int @@ -25454,7 +25654,7 @@ \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_max_state_int } - \if_int_compare:w #2 = 0 \exp_stop_f: + \if_int_compare:w #2 = \c_zero_int \int_set:Nn \l__regex_right_state_int { \l__regex_left_state_int - 1 } \else: @@ -25882,7 +26082,7 @@ { \__regex_replacement_normal:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: + \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero_int \__kernel_msg_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \tl_build_put_right:Nx \l__regex_build_tl @@ -25993,7 +26193,7 @@ { \tl_build_put_right:Nn \l__regex_build_tl { \__regex_query_submatch:n { \int_eval:n { #1 + ##1 } } } - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: + \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero_int \tl_put_right:Nn \l__regex_balance_tl { + \__regex_submatch_balance:n @@ -26067,7 +26267,7 @@ } \cs_new_protected:Npn \__regex_replacement_rbrace:N #1 { - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: + \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero_int \tl_build_put_right:Nn \l__regex_build_tl { \cs_end: } \int_decr:N \l__regex_replacement_csnames_int \else: @@ -26076,7 +26276,7 @@ } \cs_new_protected:Npn \__regex_replacement_lbrace:N #1 { - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: + \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero_int \__kernel_msg_error:nnn { regex } { cu-lbrace } { u } \else: \__regex_replacement_normal:n {#1} @@ -26128,7 +26328,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_B:w { - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: + \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero_int \int_incr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -26145,7 +26345,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_E:w { - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: + \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero_int \int_decr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -26168,7 +26368,7 @@ } \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2 { - \if_int_compare:w `#2 = 0 \exp_stop_f: + \if_int_compare:w `#2 = \c_zero_int \__kernel_msg_error:nn { regex } { replacement-null-space } \fi: \tex_lccode:D `\ = `#2 \scan_stop: @@ -26272,6 +26472,8 @@ \intarray_new:Nn \g__regex_submatch_begin_intarray { 65536 } \intarray_new:Nn \g__regex_submatch_end_intarray { 65536 } \intarray_new:Nn \g__regex_balance_intarray { 65536 } +\int_new:N \l__regex_added_begin_int +\int_new:N \l__regex_added_end_int \cs_new_protected:Npn \__regex_return: { \if_meaning:w \c_true_bool \g__regex_success_bool @@ -26385,46 +26587,106 @@ { \flag_clear:n { __regex_begin } \flag_clear:n { __regex_end } - \seq_set_from_function:NnN \l__regex_internal_seq + \cs_set_eq:NN \__regex_tmp:w \scan_stop: + \__kernel_tl_gset:Nx \g__regex_internal_tl { \int_step_function:nnN { \l__regex_min_submatch_int } - { \l__regex_submatch_int - 1 } + { \l__regex_submatch_int - 1 } \__regex_extract_seq_aux:n + \__regex_tmp:w } - \__regex_extract_seq_aux:n - \int_compare:nNnF - { - \flag_height:n { __regex_begin } + - \flag_height:n { __regex_end } - } - = 0 + \int_set:Nn \l__regex_added_begin_int + { \flag_height:n { __regex_begin } } + \int_set:Nn \l__regex_added_end_int + { \flag_height:n { __regex_end } } + \tex_afterassignment:D \__regex_extract_check:w + \__kernel_tl_gset:Nx \g__regex_internal_tl + { \g__regex_internal_tl \if_false: { \fi: } } + \int_compare:nNnT + { \l__regex_added_begin_int + \l__regex_added_end_int } > 0 { \__kernel_msg_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } - { \flag_height:n { __regex_end } } - { \flag_height:n { __regex_begin } } + { \int_use:N \l__regex_added_begin_int } + { \int_use:N \l__regex_added_end_int } } - \seq_set_map_x:NNn \l__regex_internal_seq \l__regex_internal_seq {##1} - \exp_args:NNNo - \group_end: - \tl_set:Nn #1 { \l__regex_internal_seq } + \group_end: + \cs_set_eq:NN \__regex_tmp:w \__regex_extract_map_loop:w + \seq_set_from_function:NnN #1 + { \__regex_extract_map:N } \exp_not:n } \cs_new:Npn \__regex_extract_seq_aux:n #1 { + \__regex_tmp:w { } \exp_after:wN \__regex_extract_seq_aux:ww \int_value:w \__regex_submatch_balance:n {#1} ; #1; } \cs_new:Npn \__regex_extract_seq_aux:ww #1; #2; { - \if_int_compare:w #1 < 0 \exp_stop_f: - \flag_raise:n { __regex_end } - \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } + \if_int_compare:w #1 < \c_zero_int + \prg_replicate:nn {-#1} + { + \flag_raise:n { __regex_begin } + \exp_not:n { { \if_false: } \fi: } + } \fi: \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > 0 \exp_stop_f: - \flag_raise:n { __regex_begin } - \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } + \if_int_compare:w #1 > \c_zero_int + \prg_replicate:nn {#1} + { + \flag_raise:n { __regex_end } + \exp_not:n { \if_false: { \fi: } } + } \fi: } +\cs_new_protected:Npn \__regex_extract_check:w + { + \exp_after:wN \__regex_extract_check:n + \exp_after:wN { \if_false: } \fi: + } +\cs_new_protected:Npn \__regex_extract_check:n #1 + { + \tl_if_empty:nF {#1} + { + \int_incr:N \l__regex_added_begin_int + \int_incr:N \l__regex_added_end_int + \tex_afterassignment:D \__regex_extract_check:w + \__kernel_tl_gset:Nx \g__regex_internal_tl + { + \exp_after:wN \__regex_extract_check_loop:w + \g__regex_internal_tl + \__regex_tmp:w \__regex_extract_check_end:w + #1 + } + } + } +\cs_new:Npn \__regex_extract_check_loop:w #1 \__regex_tmp:w #2 + { + #2 + \exp_not:o {#1} + \__regex_tmp:w { } + \__regex_extract_check_loop:w \prg_do_nothing: + } +\cs_new:Npn \__regex_extract_check_end:w + \exp_not:o #1#2 \__regex_extract_check_loop:w #3 \__regex_tmp:w + { + { \exp_not:o {#1} } + #3 + \if_false: { \fi: } + \__regex_tmp:w + } +\cs_new:Npn \__regex_extract_map:N #1 + { + \exp_after:wN \__regex_extract_map_aux:NNn + \exp_after:wN #1 + \g__regex_internal_tl \use_none:nnn + } +\cs_new:Npn \__regex_extract_map_aux:NNn #1#2#3 + { #3 #2 #1 \prg_do_nothing: } +\cs_new:Npn \__regex_extract_map_loop:w #1#2 \__regex_tmp:w #3 + { + \exp_after:wN #1 \exp_after:wN {#2} + #3 \__regex_extract_map_loop:w #1 \prg_do_nothing: + } \cs_new_protected:Npn \__regex_extract: { \if_meaning:w \c_true_bool \g__regex_success_bool @@ -26438,18 +26700,23 @@ \__kernel_intarray_gset:Nnn \g__regex_submatch_prev_intarray { \l__regex_zeroth_submatch_int } { \l__regex_start_pos_int } \int_zero:N \l__regex_internal_a_int - \clist_map_inline:Nn \l__regex_success_submatches_tl - { - \if_int_compare:w \l__regex_internal_a_int < \l__regex_capturing_group_int - \__kernel_intarray_gset:Nnn \g__regex_submatch_begin_intarray - { \__regex_int_eval:w \l__regex_zeroth_submatch_int + \l__regex_internal_a_int } {##1} - \else: - \__kernel_intarray_gset:Nnn \g__regex_submatch_end_intarray - { \__regex_int_eval:w \l__regex_zeroth_submatch_int + \l__regex_internal_a_int - \l__regex_capturing_group_int } {##1} - \fi: - \int_incr:N \l__regex_internal_a_int - } + \exp_after:wN \__regex_extract_aux:w \l__regex_success_submatches_tl + \prg_break_point: \__regex_use_none_delimit_by_q_recursion_stop:w , + \q__regex_recursion_stop + \fi: + } +\cs_new_protected:Npn \__regex_extract_aux:w #1 , + { + \prg_break: #1 \prg_break_point: + \if_int_compare:w \l__regex_internal_a_int < \l__regex_capturing_group_int + \__kernel_intarray_gset:Nnn \g__regex_submatch_begin_intarray + { \__regex_int_eval:w \l__regex_zeroth_submatch_int + \l__regex_internal_a_int } {#1} + \else: + \__kernel_intarray_gset:Nnn \g__regex_submatch_end_intarray + { \__regex_int_eval:w \l__regex_zeroth_submatch_int + \l__regex_internal_a_int - \l__regex_capturing_group_int } {#1} \fi: + \int_incr:N \l__regex_internal_a_int + \__regex_extract_aux:w } \cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3 { @@ -26513,28 +26780,43 @@ } \cs_new_protected:Npn \__regex_group_end_replace:N #1 { - \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: - \else: - \__kernel_msg_error:nnxxx { regex } { result-unbalanced } - { replacing } - { \int_max:nn { - \l__regex_balance_int } { 0 } } - { \int_max:nn { \l__regex_balance_int } { 0 } } - \fi: - \use:x + \int_set:Nn \l__regex_added_begin_int + { \int_max:nn { - \l__regex_balance_int } { 0 } } + \int_set:Nn \l__regex_added_end_int + { \int_max:nn { \l__regex_balance_int } { 0 } } + \__regex_group_end_replace_try: + \int_compare:nNnT { \l__regex_added_begin_int + \l__regex_added_end_int } > 0 { - \group_end: - \tl_set:Nn \exp_not:N #1 - { - \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: - \prg_replicate:nn { - \l__regex_balance_int } - { { \if_false: } \fi: } - \fi: - \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: - \prg_replicate:nn { \l__regex_balance_int } - { \if_false: { \fi: } } - \fi: - } + \__kernel_msg_error:nnxxx { regex } { result-unbalanced } + { replacing } { \int_use:N \l__regex_added_begin_int } + { \int_use:N \l__regex_added_end_int } + } + \group_end: + \tl_set_eq:NN #1 \g__regex_internal_tl + } +\cs_new_protected:Npn \__regex_group_end_replace_try: + { + \tex_afterassignment:D \__regex_group_end_replace_check:w + \__kernel_tl_gset:Nx \g__regex_internal_tl + { + \prg_replicate:nn { \l__regex_added_begin_int } { { \if_false: } \fi: } + \l__regex_internal_a_tl + \prg_replicate:nn { \l__regex_added_end_int } { \if_false: { \fi: } } + \if_false: { \fi: } + } + } +\cs_new_protected:Npn \__regex_group_end_replace_check:w + { + \exp_after:wN \__regex_group_end_replace_check:n + \exp_after:wN { \if_false: } \fi: + } +\cs_new_protected:Npn \__regex_group_end_replace_check:n #1 + { + \tl_if_empty:nF {#1} + { + \int_incr:N \l__regex_added_begin_int + \int_incr:N \l__regex_added_end_int + \__regex_group_end_replace_try: } } \tl_new:N \l__regex_peek_true_tl @@ -29025,16 +29307,20 @@ #4 \s__color_mark #5 \s__color_stop } } -\cs_new_protected:Npn \color_show:n #1 +\cs_new_protected:Npn \color_show:n + { \__color_show:Nn \__kernel_msg_show:nnxxxx } +\cs_new_protected:Npn \color_log:n + { \__color_show:Nn \__kernel_msg_log:nnxxxx } +\cs_new_protected:Npn \__color_show:Nn #1#2 { - \__kernel_msg_show:nnxxxx { color } { show } - {#1} + #1 { color } { show } + {#2} { - \__color_if_defined:nT {#1} + \__color_if_defined:nT {#2} { - \exp_args:Nv \__color_show:n { l__color_named_ #1 _tl } + \exp_args:Nv \__color_show:n { l__color_named_ #2 _tl } \prop_map_function:cN - { l__color_named_ #1 _prop } + { l__color_named_ #2 _prop } \msg_show_item_unbraced:nn } } @@ -30485,6 +30771,26 @@ { } } } +\cs_new_protected:Npn \coffin_show:N #1 + { \coffin_show:Nnn #1 \c_max_int \c_max_int } +\cs_generate_variant:Nn \coffin_show:N { c } +\cs_new_protected:Npn \coffin_log:N #1 + { \coffin_log:Nnn #1 \c_max_int \c_max_int } +\cs_generate_variant:Nn \coffin_log:N { c } +\cs_new_protected:Npn \coffin_show:Nnn + { \__coffin_show:NNNnn \__kernel_msg_term:nnxxxx \box_show:Nnn } +\cs_generate_variant:Nn \coffin_show:Nnn { c } +\cs_new_protected:Npn \coffin_log:Nnn + { \__coffin_show:NNNnn \__kernel_msg_log:nnxxxx \box_show:Nnn } +\cs_generate_variant:Nn \coffin_log:Nnn { c } +\cs_new_protected:Npn \__coffin_show:NNNnn #1#2#3#4#5 + { + \__coffin_if_exist:NT #3 + { + \__coffin_show_structure:NN #1 #3 + #2 #3 {#4} {#5} + } + } \__kernel_msg_new:nnnn { coffin } { no-pole-intersection } { No~intersection~between~coffin~poles. } { @@ -31127,7 +31433,7 @@ } \cs_new:Npn \__text_expand_testopt:N #1 { - \str_if_eq:nnTF {#1} { \@protected@testopt } + \token_if_eq_meaning:NNTF #1 \@protected@testopt { \__text_expand_testopt:NNn } { \__text_expand_encoding:N #1 } } @@ -33922,7 +34228,7 @@ { \__tl_range_collect_unbraced:w #1 ; { } #2 } \cs_new:Npn \__tl_range_collect_braced:w #1 ; #2#3 { - \if_int_compare:w #1 > 1 \exp_stop_f: + \if_int_compare:w #1 > \c_one_int \exp_after:wN \__tl_range_collect_braced:w \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; \fi: @@ -33930,7 +34236,7 @@ } \cs_new:Npn \__tl_range_collect_unbraced:w #1 ; #2#3 { - \if_int_compare:w #1 > 1 \exp_stop_f: + \if_int_compare:w #1 > \c_one_int \exp_after:wN \__tl_range_collect_unbraced:w \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; \fi: @@ -33997,6 +34303,24 @@ \prg_return_false: \fi: } +\cs_new_protected:Npn \legacy_if_set_true:n #1 + { \cs_set_eq:cN { if#1 } \if_true: } +\cs_new_protected:Npn \legacy_if_set_false:n #1 + { \cs_set_eq:cN { if#1 } \if_false: } +\cs_new_protected:Npn \legacy_if_gset_true:n #1 + { \cs_gset_eq:cN { if#1 } \if_true: } +\cs_new_protected:Npn \legacy_if_gset_false:n #1 + { \cs_gset_eq:cN { if#1 } \if_false: } +\cs_new_protected:Npn \legacy_if_set:nn #1#2 + { + \bool_if:nTF {#2} \legacy_if_set_true:n \legacy_if_set_false:n + {#1} + } +\cs_new_protected:Npn \legacy_if_gset:nn #1#2 + { + \bool_if:nTF {#2} \legacy_if_gset_true:n \legacy_if_gset_false:n + {#1} + } %% File: l3deprecation.dtx \bool_new:N \l__deprecation_grace_period_bool \scan_new:N \s__deprecation_mark |