diff options
author | Karl Berry <karl@freefriends.org> | 2015-06-19 22:34:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-06-19 22:34:54 +0000 |
commit | 8ec6f52457309f1e1152d881c29acc8f8c775442 (patch) | |
tree | 3b3247c79f170cc40a286743fb4e1265255cbb06 /Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx | |
parent | 487de9cd41f430fd78e869079c420f36a8ff051a (diff) |
l3 (19jun15)
git-svn-id: svn://tug.org/texlive/trunk@37621 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx | 204 |
1 files changed, 104 insertions, 100 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 41e883c9397..abc040a20d0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3candidates.dtx 5544 2015-03-01 18:30:00Z joseph $ +\GetIdInfo$Id: l3candidates.dtx 5613 2015-05-21 11:59:04Z joseph $ {L3 Experimental additions to l3kernel} %</driver|package> %<*driver> @@ -806,7 +806,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP, added = 2014-06-30, updated = 2015-02-18]^^A +% \begin{function}[EXP, added = 2014-06-30, updated = 2015-05-07]^^A % { % \tl_lower_case:n, \tl_upper_case:n, \tl_mixed_case:n, % \tl_lower_case:nn, \tl_upper_case:nn, \tl_mixed_case:nn @@ -867,6 +867,14 @@ % \begin{verbatim} % $ $ \( \) % \end{verbatim} +% +% Note that while expansion occurs when searching the text it does not +% apply to math mode material (which should be unaffected by case changing). +% As such, whilst the opening token for math mode may be \enquote{hidden} +% inside a command/macro, the closing one cannot be as this is being +% searched for in math mode. Typically, in the types of \enquote{text} +% the case changing functions are intended to apply to this should not be +% an issue. % \end{variable} % % \begin{variable}{\l_tl_case_change_exclude_tl} @@ -948,22 +956,8 @@ % input is left unchanged. % % Context-sensitive mappings are enabled: language-dependent cases are -% discussed below. All context detection works before any expansion of -% following tokens and thus any control sequences are taken as the end of -% the current \enquote{word}/character context. -% -% \begin{variable}{\l_tl_change_case_after_final_sigma_tl} -% The \enquote{final sigma} rule for Greek letters is enabled and active for -% all inputs. It is implemented here in a modified form which takes account -% of the requirements of the likely real use cases, performance and -% expandability. A capital sigma will map to a final-sigma if it is followed -% by a space, the end of the input or one of the characters listed in -% \cs{l_tl_change_case_after_final_sigma_tl}, which has standard setting -% \begin{verbatim} -% ) ] } . : ; , ! ? ' " -% \end{verbatim} -% with comparisons are made on a character basis. -% \end{variable} +% discussed below. Context detection will expand input but treats any +% unexpandable control sequences as \enquote{failures} to match a context. % % Language-sensitive conversions are enabled using the \meta{language} % argument, and follow Unicode Consortium guidelines. Currently, the @@ -3138,9 +3132,9 @@ % \begin{macro}[aux, EXP]{\@@_change_case_cs:N} % \begin{macro}[aux, EXP]{\@@_change_case_cs:NN} % \begin{macro}[aux, EXP]{\@@_change_case_cs:NNn} +% \begin{macro}[aux, EXP]{\@@_change_case_if_expandable:NTF} % \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:Nnw} % \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:NN} -% \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:NNnw} % The mechanism for the core conversion of case is based on the idea that % we can use a loop to grab the entire token list plus a quark: the latter is % used as an end marker and to avoid any brace stripping. Depending on the @@ -3494,23 +3488,34 @@ % When a control sequence is not on the exclude list the other test if % to see if it is expandable. Once again, if there is a hit then the loop % function is grabbed as part of the clean-up and reinserted before the -% now expanded material. +% now expanded material. The test for expandablity has to check for +% end-of-recursion as it is needed by the look-ahead code which might hit +% the end of the input. The test is done in two parts as \cs{bool_if:nTF} +% will choke if |#1| is |(|! % \begin{macrocode} -\cs_new:Npn \@@_change_case_cs_expand:Nnw #1#2 +\cs_new:Npn \@@_change_case_if_expandable:NTF #1 { - \bool_if:nTF + \token_if_expandable:NTF #1 { - \token_if_expandable_p:N #1 - && ! \token_if_protected_macro_p:N #1 - && ! \token_if_protected_long_macro_p:N #1 + \bool_if:nTF + { + \token_if_protected_macro_p:N #1 + || \token_if_protected_long_macro_p:N #1 + || \token_if_eq_meaning_p:NN \q_recursion_tail #1 + } + { \use_ii:nn } + { \use_i:nn } } + { \use_ii:nn } + } +\cs_new:Npn \@@_change_case_cs_expand:Nnw #1#2 + { + \@@_change_case_if_expandable:NTF #1 { \@@_change_case_cs_expand:NN #1 } { #2 } } \cs_new:Npn \@@_change_case_cs_expand:NN #1#2 { \exp_after:wN #2 #1 } -\cs_new:Npn \@@_change_case_cs_expand:NNnw #1#2#3 - { \@@_change_case_cs_expand:Nnw #2 {#3} #1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -3547,7 +3552,6 @@ % \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:Nnw} % \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:w} % \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:Nw} -% \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma_loop:NN} % \begin{macro}[aux, EXP]{\@@_change_case_upper_sigma:Nnw} % If the current char is an upper case sigma, the a check is made on the next % item in the input. If it is \texttt{N}-type and not a control sequence @@ -3565,34 +3569,22 @@ } \cs_new:Npn \@@_change_case_lower_sigma:w #1 \q_recursion_stop { - \tl_if_head_is_N_type:nTF {#1} - { \@@_change_case_lower_sigma:Nw #1 \q_recursion_stop } - { \c__unicode_final_sigma_tl } + \tl_if_head_is_N_type:nTF {#1} + { \@@_change_case_lower_sigma:Nw #1 \q_recursion_stop } + { \c__unicode_final_sigma_tl } } \cs_new:Npn \@@_change_case_lower_sigma:Nw #1#2 \q_recursion_stop { - \token_if_cs:NTF #1 - { \c__unicode_final_sigma_tl } + \@@_change_case_if_expandable:NTF #1 { - \exp_after:wN \@@_change_case_lower_sigma_loop:NN - \exp_after:wN #1 \l_tl_case_change_after_final_sigma_tl - \q_recursion_tail \q_recursion_stop + \exp_after:wN \@@_change_case_lower_sigma:w #1 + #2 \q_recursion_stop + } + { + \token_if_letter:NTF #1 + { \c__unicode_std_sigma_tl } + { \c__unicode_final_sigma_tl } } - } -% \end{macrocode} -% Assuming the next token is not a control sequence, a loop is used to test -% if the next char is something that can be interpreted as the end of a word. -% Rather than use all of the Unicode data for this, the simplifying -% assumption is made that in real text the end of a word will be indicated by -% a small number of chars. -% \begin{macrocode} -\cs_new:Npn \@@_change_case_lower_sigma_loop:NN #1#2 - { - \quark_if_recursion_tail_stop_do:Nn #2 - { \c__unicode_std_sigma_tl } - \int_compare:nNnT { `#1 } = { `#2 } - { \use_i_delimit_by_q_recursion_stop:nw { \c__unicode_final_sigma_tl } } - \@@_change_case_lower_sigma_loop:NN #1 } % \end{macrocode} % Simply skip to the final step for upper casing. @@ -3603,7 +3595,6 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}[aux, EXP]{\@@_change_case_lower_tr:Nnw} % \begin{macro}[aux, EXP]{\@@_change_case_lower_tr_auxi:Nw} @@ -3643,15 +3634,22 @@ } \cs_new:Npn \@@_change_case_lower_tr_auxii:Nw #1#2 \q_recursion_stop { - \bool_if:nTF + \@@_change_case_if_expandable:NTF #1 { - \token_if_cs_p:N #1 - || ! ( \int_compare_p:nNn { `#1 } = { "0307 } ) + \exp_after:wN \@@_change_case_lower_tr_auxi:Nw #1 + #2 \q_recursion_stop } - { \@@_change_case_output:Vwn \c__unicode_dotless_i_tl } { - \@@_change_case_output:nwn { i } - \use_i:nn + \bool_if:nTF + { + \token_if_cs_p:N #1 + || ! ( \int_compare_p:nNn { `#1 } = { "0307 } ) + } + { \@@_change_case_output:Vwn \c__unicode_dotless_i_tl } + { + \@@_change_case_output:nwn { i } + \use_i:nn + } } } % \end{macrocode} @@ -3742,18 +3740,25 @@ } \cs_new:Npn \@@_change_case_lower_lt:NNw #1#2#3 \q_recursion_stop { - \bool_if:nT + \@@_change_case_if_expandable:NTF #2 { - ! \token_if_cs_p:N #2 - && - ( - \int_compare_p:nNn { `#2 } = { "0300 } - || \int_compare_p:nNn { `#2 } = { "0301 } - || \int_compare_p:nNn { `#2 } = { "0303 } - ) + \exp_after:wN \@@_change_case_lower_lt:Nw \exp_after:wN #1 #2 + #3 \q_recursion_stop + } + { + \bool_if:nT + { + ! \token_if_cs_p:N #2 + && + ( + \int_compare_p:nNn { `#2 } = { "0300 } + || \int_compare_p:nNn { `#2 } = { "0301 } + || \int_compare_p:nNn { `#2 } = { "0303 } + ) + } + { \@@_change_case_output:Vwn \c__unicode_dot_above_tl } + #1 #2#3 \q_recursion_stop } - { \@@_change_case_output:Vwn \c__unicode_dot_above_tl } - #1 #2#3 \q_recursion_stop } % \end{macrocode} % For upper casing, the test required is for a dot-above char after an I, @@ -3790,14 +3795,21 @@ } \cs_new:Npn \@@_change_case_upper_lt:NNw #1#2#3 \q_recursion_stop { - \bool_if:nTF + \@@_change_case_if_expandable:NTF #2 + { + \exp_after:wN \@@_change_case_upper_lt:Nw \exp_after:wN #1 #2 + #3 \q_recursion_stop + } { - ! \token_if_cs_p:N #2 - && \int_compare_p:nNn { `#2 } = { "0307 } + \bool_if:nTF + { + ! \token_if_cs_p:N #2 + && \int_compare_p:nNn { `#2 } = { "0307 } + } + { #1 } + { #1 #2 } + #3 \q_recursion_stop } - { #1 } - { #1 #2 } - #3 \q_recursion_stop } % \end{macrocode} % \end{macro} @@ -4028,21 +4040,28 @@ } \cs_new:Npn \@@_change_case_mixed_nl:NNw #1#2#3 \q_recursion_stop { - \bool_if:nTF + \@@_change_case_if_expandable:NTF #2 { - ! ( \token_if_cs_p:N #2 ) - && - ( - \int_compare_p:nNn { `#2 } = { `j } - || \int_compare_p:nNn { `#2 } = { `J } - ) + \exp_after:wN \@@_change_case_mixed_nl:Nw \exp_after:wN #1 #2 + #3 \q_recursion_stop } { - \@@_change_case_output:nwn { J } - #1 + \bool_if:nTF + { + ! ( \token_if_cs_p:N #2 ) + && + ( + \int_compare_p:nNn { `#2 } = { `j } + || \int_compare_p:nNn { `#2 } = { `J } + ) + } + { + \@@_change_case_output:nwn { J } + #1 + } + { #1 #2 } + #3 \q_recursion_stop } - { #1 #2 } - #3 \q_recursion_stop } % \end{macrocode} % \end{macro} @@ -4071,21 +4090,6 @@ %</package> % \end{macrocode} % \end{variable} -% -% \begin{variable}{\l_tl_case_change_after_final_sigma_tl} -% Characters coming after a final sigma. -% \begin{macrocode} -\tl_new:N \l_tl_case_change_after_final_sigma_tl -\tl_set:Nx \l_tl_case_change_after_final_sigma_tl - { % ( - ) % [ - ] % \{ - \cs_to_str:N \} - . : ; , - ! ? ' " - } -% \end{macrocode} -% \end{variable} % % \begin{variable}{\l_tl_mixed_case_ignore_tl} % Characters to skip over when finding the first letter in a word to be |