diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx index 69a198da208..e40e4fae79e 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3tl-analysis.dtx Copyright (C) 2011-2012 The LaTeX3 Project +%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3tl-analysis.dtx 4745 2014-05-06 10:41:27Z joseph $ +\GetIdInfo$Id: l3tl-analysis.dtx 5899 2015-08-31 21:49:59Z joseph $ {L3 Experimental token lists analysis} %</driver|package> %<*driver> @@ -798,31 +798,26 @@ % in the input stream, and call \cs{@@_b_normals:ww} % with its first argument decremented. % \begin{macrocode} -\group_begin: - \char_set_catcode_other:N A - \char_set_catcode_other:N B - \char_set_catcode_other:N C - \char_set_uccode:nn { `? } { `D } - \tl_to_uppercase:n - { - \cs_new:Npn \@@_b_char:Nww #1 - { - \if_meaning:w #1 \tex_undefined:D ? \else: - \if_catcode:w #1 \c_catcode_other_token C \else: - \if_catcode:w #1 \c_catcode_letter_token B \else: - \if_catcode:w #1 \c_math_toggle_token 3 \else: - \if_catcode:w #1 \c_alignment_token 4 \else: - \if_catcode:w #1 \c_math_superscript_token 7 \else: - \if_catcode:w #1 \c_math_subscript_token 8 \else: - \if_catcode:w #1 \c_space_token A \else: - 6 - \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: - \__int_value:w `#1 \s__tl - \exp_after:wN \@@_b_normals:ww - \int_use:N \__int_eval:w \c_minus_one + - } - } -\group_end: +\cs_new:Npx \@@_b_char:Nww #1 + { + \exp_not:N \if_meaning:w #1 \exp_not:N \tex_undefined:D + \token_to_str:N D \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_catcode_other_token + \token_to_str:N C \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_catcode_letter_token + \token_to_str:N B \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_toggle_token 3 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_alignment_token 4 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_superscript_token 7 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_subscript_token 8 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_space_token + \token_to_str:N A \exp_not:N \else: + 6 + \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: } + \exp_not:N \__int_value:w `#1 \s__tl + \exp_not:N \exp_after:wN \exp_not:N \@@_b_normals:ww + \exp_not:N \int_use:N \exp_not:N \__int_eval:w \c_minus_one + + } % \end{macrocode} % \end{macro} % @@ -949,33 +944,39 @@ % \subsection{Showing the results} % % \begin{macro}{\tl_show_analysis:N, \tl_show_analysis:n} -% \begin{macro}[int]{\@@_show:N} +% \begin{macro}[int]{\@@_show:} % Add to \cs{@@:n} a third pass to display tokens to the terminal. +% If the token list variable is not defined, throw the same error +% as \cs{tl_show:N} by simply calling that function. % \begin{macrocode} \cs_new_protected:Npn \tl_show_analysis:N #1 { - \exp_args:No \@@:n {#1} - \@@_show:N #1 + \tl_if_exist:NTF #1 + { + \exp_args:No \@@:n {#1} + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { \token_to_str:N #1 } { \tl_if_empty:NTF #1 { } { ? } } { } { } + \@@_show: + } + { \tl_show:N #1 } } \cs_new_protected:Npn \tl_show_analysis:n #1 { \@@:n {#1} - \tl_set:Nn \l_@@_internal_tl {#1} - \@@_show:N \l_@@_internal_tl + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { } { \tl_if_empty:nTF {#1} { } { ? } } { } { } + \@@_show: } -\cs_new_protected:Npn \@@_show:N #1 +\cs_new_protected:Npn \@@_show: { \group_begin: - \use:x + \exp_args:NNx + \group_end: + \__msg_show_wrap:n { - \group_end: - \exp_not:n { \__msg_show_variable:Nnn #1 } - { tl-analysis } - { - \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl - \s__tl { ? \__prg_break: } \s__tl - \__prg_break_point: - } + \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl + \s__tl { ? \__prg_break: } \s__tl + \__prg_break_point: } } % \end{macrocode} @@ -1104,10 +1105,8 @@ % \begin{macrocode} \__msg_kernel_new:nnn { kernel } { show-tl-analysis } { - The~token~list~ - \str_if_eq:nnF {#1} { \l_@@_internal_tl } - { \token_to_str:N #1 ~ } - \tl_if_empty:NTF #1 + The~token~list~ \tl_if_empty:nF {#1} { #1 ~ } + \tl_if_empty:nTF {#2} { is~empty } { contains~the~tokens: } } |