diff options
author | Karl Berry <karl@freefriends.org> | 2016-03-26 22:56:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-03-26 22:56:01 +0000 |
commit | acbc4b3c1d3629ae290305ff7c6056eb83d1151c (patch) | |
tree | 59c4ad13167b9bad138b2c231cbd6bc9f2c9c311 /Master/texmf-dist/source/latex/l3kernel/l3str.dtx | |
parent | 473c539aefe98fc932ea0ed651464b9f91482938 (diff) |
l3 (26mar16)
git-svn-id: svn://tug.org/texlive/trunk@40146 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3str.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3str.dtx | 80 |
1 files changed, 52 insertions, 28 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 7e43436ecd5..05b327cf286 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3str.dtx Copyright (C) 2011-2015 The LaTeX3 Project +%% File: l3str.dtx Copyright (C) 2011-2016 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 @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3str.dtx 6357 2016-01-03 08:42:55Z joseph $ +\GetIdInfo$Id: l3str.dtx 6441 2016-03-24 10:11:59Z joseph $ {L3 Strings} %</driver|package> %<*driver> @@ -425,8 +425,15 @@ % \iow_term:x { \str_range:nnn { abcdef } { -2 } { -1 } } % \iow_term:x { \str_range:nnn { abcdef } { 0 } { -1 } } % \end{verbatim} -% will print \texttt{bcd}, \texttt{cdef}, \texttt{ef}, and an empty -% line to the terminal. +% will print \texttt{bcde}, \texttt{cdef}, \texttt{ef}, and an empty +% line to the terminal. The \meta{start index} must always be smaller than +% or equal to the \meta{end index}: if this is not the case then no output +% is generated. Thus +% \begin{verbatim} +% \iow_term:x { \str_range:nnn { abcdef } { 5 } { 2 } } +% \iow_term:x { \str_range:nnn { abcdef } { -1 } { -4 } } +% \end{verbatim} +% both yield empty strings. % \end{function} % % \section{String manipulation} @@ -490,7 +497,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[rEXP, added = 2014-06-19, updated = 2015-09-04] +% \begin{function}[EXP, added = 2014-06-19, updated = 2016-03-07] % {\str_fold_case:n, \str_fold_case:V} % \begin{syntax} % \cs{str_fold_case:n} \Arg{tokens} @@ -1017,7 +1024,7 @@ \cs_new:Npn \@@_item:nn #1#2 { \exp_after:wN \@@_item:w - \int_use:N \__int_eval:w #2 \exp_after:wN ; + \__int_value:w \__int_eval:w #2 \exp_after:wN ; \__int_value:w \@@_count:n {#1} ; #1 \q_stop } @@ -1030,7 +1037,7 @@ { \exp_after:wN \use_i_delimit_by_q_stop:nw \exp:w \exp_after:wN \@@_skip_exp_end:w - \int_use:N \__int_eval:w #1 + #2 ; + \__int_value:w \__int_eval:w #1 + #2 ; } } { @@ -1069,12 +1076,12 @@ \exp_after:wN \@@_skip_loop:wNNNNNNNN \else: \exp_after:wN \@@_skip_end:w - \int_use:N \__int_eval:w + \__int_value:w \__int_eval:w \fi: #1 ; } \cs_new:Npn \@@_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9 - { \exp_after:wN \@@_skip_exp_end:w \int_use:N \__int_eval:w #1 - \c_eight ; } + { \exp_after:wN \@@_skip_exp_end:w \__int_value:w \__int_eval:w #1 - \c_eight ; } \cs_new:Npn \@@_skip_end:w #1 ; { \exp_after:wN \@@_skip_end:NNNNNNNN @@ -1114,8 +1121,8 @@ { \exp_after:wN \@@_range:w \__int_value:w \@@_count:n {#1} \exp_after:wN ; - \int_use:N \__int_eval:w #2 - \c_one \exp_after:wN ; - \int_use:N \__int_eval:w #3 ; + \__int_value:w \__int_eval:w #2 - \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #3 ; #1 \q_stop } \cs_new:Npn \@@_range:w #1; #2; #3; @@ -1127,7 +1134,7 @@ \cs_new:Npn \@@_range:nnw #1#2 { \exp_after:wN \@@_collect_delimit_by_q_stop:w - \int_use:N \__int_eval:w #2 - #1 \exp_after:wN ; + \__int_value:w \__int_eval:w #2 - #1 \exp_after:wN ; \exp:w \@@_skip_exp_end:w #1 ; } % \end{macrocode} @@ -1193,7 +1200,7 @@ \cs_new:Npn \@@_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 { \exp_after:wN \@@_collect_loop:wn - \int_use:N \__int_eval:w #1 - \c_seven ; + \__int_value:w \__int_eval:w #1 - \c_seven ; { #2 #3#4#5#6#7#8#9 } } \cs_new:Npn \@@_collect_end:wn #1 ; @@ -1390,6 +1397,9 @@ % } % \begin{macro}[aux, EXP]{\@@_change_case:nn} % \begin{macro}[aux, EXP]{\@@_change_case_aux:nn} +% \begin{macro}[aux, EXP]{\@@_change_case_result:n} +% \begin{macro}[aux, EXP]{\@@_change_case_output:nw, \@@_change_case_output:fw} +% \begin{macro}[aux, EXP]{\@@_change_case_end:nw} % \begin{macro}[aux, EXP]{\@@_change_case_loop:nw} % \begin{macro}[aux, EXP]{\@@_change_case_space:n} % \begin{macro}[aux, EXP]{\@@_change_case_char:nN} @@ -1414,7 +1424,12 @@ \cs_new:Npn \@@_change_case_aux:nn #1#2 { \@@_change_case_loop:nw {#2} #1 \q_recursion_tail \q_recursion_stop + \@@_change_case_result:n { } } +\cs_new:Npn \@@_change_case_output:nw #1#2 \@@_change_case_result:n #3 + { #2 \@@_change_case_result:n { #3 #1 } } +\cs_generate_variant:Nn \@@_change_case_output:nw { f } +\cs_new:Npn \@@_change_case_end:wn #1 \@@_change_case_result:n #2 { #2 } \cs_new:Npn \@@_change_case_loop:nw #1#2 \q_recursion_stop { \tl_if_head_is_space:nTF {#2} @@ -1425,16 +1440,20 @@ \use:x { \cs_new:Npn \exp_not:N \@@_change_case_space:n ##1 \c_space_tl } { - \c_space_tl + \@@_change_case_output:nw { ~ } \@@_change_case_loop:nw {#1} } \cs_new:Npn \@@_change_case_char:nN #1#2 { - \quark_if_recursion_tail_stop:N #2 + \quark_if_recursion_tail_stop_do:Nn #2 + { \@@_change_case_end:wn } \cs_if_exist:cTF { c__unicode_ #1 _ #2 _tl } - { \tl_to_str:c { c__unicode_ #1 _ #2 _tl } } + { + \@@_change_case_output:fw + { \tl_to_str:c { c__unicode_ #1 _ #2 _tl } } + } { \@@_change_case_char_aux:nN {#1} #2 } - \__str_change_case_loop:nw {#1} + \@@_change_case_loop:nw {#1} } % \end{macrocode} % For Unicode engines there's a look up to see if the current character @@ -1446,18 +1465,20 @@ { \cs_new:Npn \@@_change_case_char_aux:nN #1#2 { - \int_compare:nNnTF { \use:c { @@_lookup_ #1 :N } #2 } = { 0 } - { #2 } + \int_compare:nNnTF { \use:c { __str_lookup_ #1 :N } #2 } = { 0 } + { \@@_change_case_output:nw {#2} } { - \utex_char:D \use:c { @@_lookup_ #1 :N } #2 ~ + \@@_change_case_output:fw + { \utex_char:D \use:c { __str_lookup_ #1 :N } #2 ~ } } } - \cs_new_protected:Npn \@@_lookup_lower:N #1 { \tex_lccode:D `#1 } - \cs_new_protected:Npn \@@_lookup_upper:N #1 { \tex_uccode:D `#1 } - \cs_new_eq:NN \@@_lookup_fold:N \@@_lookup_lower:N + \cs_set_protected:Npn \@@_lookup_lower:N #1 { \tex_lccode:D `#1 } + \cs_set_protected:Npn \@@_lookup_upper:N #1 { \tex_uccode:D `#1 } + \cs_set_eq:NN \@@_lookup_fold:N \@@_lookup_lower:N } { - \cs_new:Npn \@@_change_case_char_aux:nN #1#2 { #2 } + \cs_new:Npn \@@_change_case_char_aux:nN #1#2 + { \@@_change_case_output:nw {#2} } } % \end{macrocode} % \end{macro} @@ -1467,6 +1488,9 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{variable} % { @@ -1533,7 +1557,7 @@ % \tn{lccode} and \tn{uccode} values) but this covers only the simple % one-to-one situations and does not fully handle for example case folding. % -% The data required for cross-module manipulations is loaded here: currenty +% The data required for cross-module manipulations is loaded here: currently % this means for |str| and |tl| functions. As such, the prefix used is not % |str| but rather |unicode|. For performance (as the entire data set must % be read during each run) and as this code comes somewhat early in the @@ -1566,7 +1590,7 @@ \scan_stop: %</package> % \end{macrocode} -% Set up to read each file. As they use C-style comments, thre is a need to +% Set up to read each file. As they use C-style comments, there is a need to % deal with |#|. At the same time, spaces are important so they need to be % picked up as they are important. Beyond that, the current category code % scheme works fine. With no I/O loop available, hard-code one that will work @@ -1660,8 +1684,8 @@ % \end{macrocode} % The set up for case folding is in two parts. For the basic (core) mappings, % folding is the same as lower casing in most positions so only store -% the differences. For the more complex foldings, always sotre the result, -% splitting up the two or three code points in the inout as required. +% the differences. For the more complex foldings, always store the result, +% splitting up the two or three code points in the input as required. % \begin{macrocode} \cs_set_protected:Npn \@@_parse_auxi:w #1 ;~ #2 ;~ #3 ; #4 \q_stop { |