From 603f539beba9a248911c5fcf5ea7905cf0a65c10 Mon Sep 17 00:00:00 2001 From: PhelypeOleinik Date: Thu, 12 Mar 2020 22:46:20 -0300 Subject: [PATCH] Yet more quark replacements (l3expan) --- l3kernel/l3expan.dtx | 109 +++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 40 deletions(-) diff --git a/l3kernel/l3expan.dtx b/l3kernel/l3expan.dtx index f356ac22df..45538ed8c9 100644 --- a/l3kernel/l3expan.dtx +++ b/l3kernel/l3expan.dtx @@ -2165,6 +2165,35 @@ %<@@=cs> % \end{macrocode} % +% \begin{variable}{\s_@@_mark,\s_@@_stop} +% Internal scan marks. No \pkg{l3scan} yet, so do things by hand. +% \begin{macrocode} +\cs_new_eq:NN \s_@@_mark \scan_stop: +\cs_new_eq:NN \s_@@_stop \scan_stop: +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\q_@@_recursion_stop} +% Internal recursion quarks. No \pkg{l3quark} yet, so do things by hand. +% \begin{macrocode} +\cs_new:Npn \q_@@_recursion_stop { \q_@@_recursion_stop } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[EXP]{ +% \@@_use_none_delimit_by_s_stop:w, +% \@@_use_i_delimit_by_s_stop:nw, +% \@@_use_none_delimit_by_q_recursion_stop:w +% } +% Internal scan marks. +% \begin{macrocode} +\cs_new:Npn \@@_use_none_delimit_by_s_stop:w #1 \s_@@_stop { } +\cs_new:Npn \@@_use_i_delimit_by_s_stop:nw #1 #2 \s_@@_stop {#1} +\cs_new:Npn \@@_use_none_delimit_by_q_recursion_stop:w + #1 \q_@@_recursion_stop { } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\cs_generate_variant:Nn, \cs_generate_variant:cn} % \begin{arguments} % \item Base form of a function; \emph{e.g.},~\cs{tl_set:Nn} @@ -2189,7 +2218,7 @@ \exp_not:N #1 \tl_to_str:n {#2} , \exp_not:N \scan_stop: , - \exp_not:N \q_recursion_stop + \exp_not:N \q_@@_recursion_stop } } \cs_new_protected:Npn \cs_generate_variant:cn @@ -2229,20 +2258,20 @@ \exp_not:N \else: \exp_not:N \exp_after:wN \exp_not:N \@@_generate_variant:ww \exp_not:N \token_to_meaning:N #1 \tl_to_str:n { ma } - \exp_not:N \q_mark - \exp_not:N \q_mark \cs_new_protected:Npx + \exp_not:N \s_@@_mark + \exp_not:N \s_@@_mark \cs_new_protected:Npx \tl_to_str:n { pr } - \exp_not:N \q_mark \cs_new:Npx - \exp_not:N \q_stop + \exp_not:N \s_@@_mark \cs_new:Npx + \exp_not:N \s_@@_stop \exp_not:N \fi: } \exp_last_unbraced:NNNNo \cs_new_protected:Npn \@@_generate_variant:ww - #1 { \tl_to_str:n { ma } } #2 \q_mark + #1 { \tl_to_str:n { ma } } #2 \s_@@_mark { \@@_generate_variant:wwNw #1 } \exp_last_unbraced:NNNNo \cs_new_protected:Npn \@@_generate_variant:wwNw - #1 { \tl_to_str:n { pr } } #2 \q_mark #3 #4 \q_stop + #1 { \tl_to_str:n { pr } } #2 \s_@@_mark #3 #4 \s_@@_stop { \cs_set_eq:NN \@@_tmp:w #3 } % \end{macrocode} % \end{macro} @@ -2265,7 +2294,7 @@ \if_meaning:w \c_false_bool #3 \__kernel_msg_error:nnx { kernel } { missing-colon } { \token_to_str:c {#1} } - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \exp_after:wN \@@_use_none_delimit_by_q_recursion_stop:w \fi: \@@_generate_variant:Nnnw #4 {#1}{#2} } @@ -2325,7 +2354,7 @@ \cs_new_protected:Npn \@@_generate_variant:Nnnw #1#2#3#4 , { \if_meaning:w \scan_stop: #4 - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \exp_after:wN \@@_use_none_delimit_by_q_recursion_stop:w \fi: \use:x { @@ -2333,11 +2362,11 @@ \@@_generate_variant_loop:nNwN { } #4 \@@_generate_variant_loop_end:nwwwNNnn - \q_mark + \s_@@_mark #3 ~ { ~ { } \fi: \@@_generate_variant_loop_long:wNNnn } ~ { } - \q_stop + \s_@@_stop \exp_not:N #1 {#2} {#4} } \@@_generate_variant:Nnnw #1 {#2} {#3} @@ -2407,7 +2436,7 @@ % argument: this empty brace group produces the correct signature for % the full variant. % \begin{macrocode} -\cs_new:Npn \@@_generate_variant_loop:nNwN #1#2#3 \q_mark #4 +\cs_new:Npn \@@_generate_variant_loop:nNwN #1#2#3 \s_@@_mark #4 { \if:w #2 #4 \exp_after:wN \@@_generate_variant_loop_same:w @@ -2426,7 +2455,7 @@ #1 \prg_do_nothing: #2 - \@@_generate_variant_loop:nNwN { } #3 \q_mark + \@@_generate_variant_loop:nNwN { } #3 \s_@@_mark } \cs_new:Npn \@@_generate_variant_loop_base:N #1 { @@ -2454,46 +2483,46 @@ #1 \prg_do_nothing: #2#3#4 { #3 { #1 \@@_generate_variant_same:N #2 } } \cs_new:Npn \@@_generate_variant_loop_end:nwwwNNnn - #1#2 \q_mark #3 ~ #4 \q_stop #5#6#7#8 + #1#2 \s_@@_mark #3 ~ #4 \s_@@_stop #5#6#7#8 { \scan_stop: \scan_stop: \fi: - \exp_not:N \q_mark - \exp_not:N \q_stop + \exp_not:N \s_@@_mark + \exp_not:N \s_@@_stop \exp_not:N #6 \exp_not:c { #7 : #8 #1 #3 } } -\cs_new:Npn \@@_generate_variant_loop_long:wNNnn #1 \q_stop #2#3#4#5 +\cs_new:Npn \@@_generate_variant_loop_long:wNNnn #1 \s_@@_stop #2#3#4#5 { \exp_not:n { - \q_mark + \s_@@_mark \__kernel_msg_error:nnxx { kernel } { variant-too-long } {#5} { \token_to_str:N #3 } \use_none:nnn - \q_stop + \s_@@_stop #3 #3 } } \cs_new:Npn \@@_generate_variant_loop_invalid:NNwNNnn - #1#2 \fi: \fi: \fi: #3 \q_stop #4#5#6#7 + #1#2 \fi: \fi: \fi: #3 \s_@@_stop #4#5#6#7 { \fi: \fi: \fi: \exp_not:n { - \q_mark + \s_@@_mark \__kernel_msg_error:nnxxxx { kernel } { invalid-variant } {#7} { \token_to_str:N #5 } {#1} {#2} \use_none:nnn - \q_stop + \s_@@_stop #5 #5 } } \cs_new:Npn \@@_generate_variant_loop_special:NNwNNnn - #1#2#3 \q_stop #4#5#6#7 + #1#2#3 \s_@@_stop #4#5#6#7 { - #3 \q_stop #4 #5 {#6} {#7} + #3 \s_@@_stop #4 #5 {#6} {#7} \exp_not:n { \__kernel_msg_error:nnxxxx @@ -2534,7 +2563,7 @@ % combining the |\exp_args:N #3| variant and the base function. % \begin{macrocode} \cs_new_protected:Npn \@@_generate_variant:wwNN - #1 \q_mark #2 \q_stop #3#4 + #1 \s_@@_mark #2 \s_@@_stop #3#4 { #2 \cs_if_free:NT #4 @@ -2568,20 +2597,20 @@ \cs_new_protected:Npx \@@_generate_internal_variant:n #1 { \exp_not:N \@@_generate_internal_variant:wwnNwn - #1 \exp_not:N \q_mark + #1 \exp_not:N \s_@@_mark { \cs_set_eq:NN \exp_not:N \@@_tmp:w \cs_new_protected:Npx } \cs_new_protected:cpn \use:x - \token_to_str:N x \exp_not:N \q_mark + \token_to_str:N x \exp_not:N \s_@@_mark { } \cs_new:cpn \exp_not:N \tex_expanded:D - \exp_not:N \q_stop + \exp_not:N \s_@@_stop {#1} } \exp_last_unbraced:NNNNo \cs_new_protected:Npn \@@_generate_internal_variant:wwnNwn #1 - { \token_to_str:N x } #2 \q_mark #3#4#5#6 \q_stop #7 + { \token_to_str:N x } #2 \s_@@_mark #3#4#5#6 \s_@@_stop #7 { #3 \cs_if_free:cT { exp_args:N #7 } @@ -2600,7 +2629,7 @@ \exp_after:wN \@@_generate_internal_test_aux:w \exp_after:wN #1 \fi: ##3 - \q_mark + \s_@@_mark { \use:x { @@ -2609,12 +2638,12 @@ } } #1 - \q_mark + \s_@@_mark { \exp_not:n { \@@_generate_internal_one_go:NNn ##1 ##2 {##3} } } - \q_stop + \s_@@_stop } \cs_new_protected:Npn \@@_generate_internal_test_aux:w - ##1 #1 ##2 \q_mark ##3 ##4 \q_stop {##3} + ##1 #1 ##2 \s_@@_mark ##3 ##4 \s_@@_stop {##3} \cs_if_exist:NTF \tex_expanded:D { \cs_new_eq:NN \@@_generate_internal_test:Nw @@ -2722,20 +2751,20 @@ \if_meaning:w \c_false_bool #3 \__kernel_msg_error:nnx { kernel } { missing-colon } { \token_to_str:c {#1} } - \use_i_delimit_by_q_stop:nw + \@@_use_i_delimit_by_s_stop:nw \fi: \exp_after:wN \@@_generate_variant:w - \tl_to_str:n {#5} , \scan_stop: , \q_recursion_stop - \use_none_delimit_by_q_stop:w \q_mark {#1} {#2} {#4} \q_stop + \tl_to_str:n {#5} , \scan_stop: , \q_@@_recursion_stop + \@@_use_none_delimit_by_s_stop:w \s_@@_mark {#1} {#2} {#4} \s_@@_stop } \cs_new_protected:Npn \@@_generate_variant:w - #1 , #2 \q_mark #3#4#5 + #1 , #2 \s_@@_mark #3#4#5 { \if_meaning:w \scan_stop: #1 \scan_stop: - \if_meaning:w \q_nil #1 \q_nil + \if_meaning:w \q_@@_nil #1 \q_@@_nil \use_i:nnn \fi: - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \exp_after:wN \@@_use_none_delimit_by_q_recursion_stop:w \else: \cs_if_exist_use:cTF { @@_generate_variant_#1_form:nnn } { {#3} {#4} {#5} } @@ -2745,7 +2774,7 @@ {#1} { \token_to_str:c { #3 : #4 } } } \fi: - \@@_generate_variant:w #2 \q_mark {#3} {#4} {#5} + \@@_generate_variant:w #2 \s_@@_mark {#3} {#4} {#5} } \cs_new_protected:Npn \@@_generate_variant_p_form:nnn #1#2 { \cs_generate_variant:cn { #1 _p : #2 } }