diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3token.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3token.dtx | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index ecbc69d46b4..fa14dede902 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1107,7 +1107,7 @@ % \cs{char_generate:nn} but omits various sanity tests. In particular, this % means it is used in certain places where engine variations need to be % accounted for by the kernel. The \meta{catcode} must give an explicit -% integer after a single expansion. +% integer when expanded (and must not absorb a space for instance). % \end{function} % % \end{documentation} @@ -1131,13 +1131,15 @@ % \begin{macro}{\char_show_value_catcode:n} % Simple wrappers around the primitives. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_catcode:nn #1#2 { \tex_catcode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: - } + } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_catcode:n #1 - { \tex_the:D \tex_catcode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_catcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_catcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_catcode:n {#1} } } % \end{macrocode} @@ -1269,40 +1271,48 @@ % \begin{macro}{\char_show_value_sfcode:n} % Pretty repetitive, but necessary! % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_mathcode:nn #1#2 { \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_mathcode:n #1 - { \tex_the:D \tex_mathcode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_mathcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_mathcode:n {#1} } } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_lccode:nn #1#2 { \tex_lccode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_lccode:n #1 - { \tex_the:D \tex_lccode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_lccode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_lccode:n #1 { \__msg_show_wrap:n { > ~ \char_value_lccode:n {#1} } } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_uccode:nn #1#2 { \tex_uccode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_uccode:n #1 - { \tex_the:D \tex_uccode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_uccode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_uccode:n #1 { \__msg_show_wrap:n { > ~ \char_value_uccode:n {#1} } } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_sfcode:nn #1#2 { \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_sfcode:n #1 - { \tex_the:D \tex_sfcode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_sfcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_sfcode:n {#1} } } % \end{macrocode} @@ -1385,6 +1395,7 @@ % the interface layer, turn the two arguments into integers up-front so % this is only done once. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \char_generate:nn #1#2 { \exp:w \exp_after:wN \@@_generate_aux:w @@ -1395,8 +1406,7 @@ { \exp:w \exp_after:wN \@@_generate_aux:nnw \exp_after:wN - { \__int_value:w \__int_eval:w #1 \exp_after:wN } - {#2} \exp_end: + { \__int_value:w \__int_eval:w #1 } {#2} \exp_end: } % \end{macrocode} % Before doing any actual conversion, first some special case filtering. @@ -2250,61 +2260,53 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_true_remove:w { - \group_align_safe_end: \tex_afterassignment:D \@@_true_aux:w \cs_set_eq:NN \@@_tmp:w } % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\@@_token_generic:NN} -% The generic function stores the test token in both implicit and +% \begin{macro}{\@@_token_generic_aux:NNNTF} +% The generic functions store the test token in both implicit and % explicit modes, and the \texttt{true} and \texttt{false} code as % token lists, more or less. The two branches have to be absorbed here % as the input stream needs to be cleared for the peek function itself. +% Here, |#1| is \cs{@@_true_remove:w} when removing the token and +% \cs{@@_true_aux:w} otherwise. % \begin{macrocode} -\cs_new_protected:Npn \@@_token_generic:NNTF #1#2#3#4 +\cs_new_protected:Npn \@@_token_generic_aux:NNNTF #1#2#3#4#5 { - \cs_set_eq:NN \l_@@_search_token #2 - \tl_set:Nn \l_@@_search_tl {#2} - \cs_set:Npx \@@_true:w + \group_align_safe_begin: + \cs_set_eq:NN \l_@@_search_token #3 + \tl_set:Nn \l_@@_search_tl {#3} + \cs_set:Npx \@@_true_aux:w { \exp_not:N \group_align_safe_end: - \exp_not:n {#3} + \exp_not:n {#4} } + \cs_set_eq:NN \@@_true:w #1 \cs_set:Npx \@@_false:w { \exp_not:N \group_align_safe_end: - \exp_not:n {#4} + \exp_not:n {#5} } - \group_align_safe_begin: - \peek_after:Nw #1 + \peek_after:Nw #2 } -\cs_new_protected:Npn \@@_token_generic:NNT #1#2#3 - { \@@_token_generic:NNTF #1 #2 {#3} { } } -\cs_new_protected:Npn \@@_token_generic:NNF #1#2#3 - { \@@_token_generic:NNTF #1 #2 { } {#3} } % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\@@_token_remove_generic:NN} +% \begin{macro}[TF]{\@@_token_generic:NN, \@@_token_remove_generic:NN} % For token removal there needs to be a call to the auxiliary % function which does the work. % \begin{macrocode} -\cs_new_protected:Npn \@@_token_remove_generic:NNTF #1#2#3#4 - { - \cs_set_eq:NN \l_@@_search_token #2 - \tl_set:Nn \l_@@_search_tl {#2} - \cs_set_eq:NN \@@_true:w \@@_true_remove:w - \cs_set:Npx \@@_true_aux:w { \exp_not:n {#3} } - \cs_set:Npx \@@_false:w - { - \exp_not:N \group_align_safe_end: - \exp_not:n {#4} - } - \group_align_safe_begin: - \peek_after:Nw #1 - } +\cs_new_protected:Npn \@@_token_generic:NNTF + { \@@_token_generic_aux:NNNTF \@@_true_aux:w } +\cs_new_protected:Npn \@@_token_generic:NNT #1#2#3 + { \@@_token_generic:NNTF #1 #2 {#3} { } } +\cs_new_protected:Npn \@@_token_generic:NNF #1#2#3 + { \@@_token_generic:NNTF #1 #2 { } {#3} } +\cs_new_protected:Npn \@@_token_remove_generic:NNTF + { \@@_token_generic_aux:NNNTF \@@_true_remove:w } \cs_new_protected:Npn \@@_token_remove_generic:NNT #1#2#3 { \@@_token_remove_generic:NNTF #1 #2 {#3} { } } \cs_new_protected:Npn \@@_token_remove_generic:NNF #1#2#3 |