diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3seq.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 0babc835ec9..10692dcf430 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2556 2011-08-12 14:00:43Z bruno $ +\GetIdInfo$Id: l3seq.dtx 2586 2011-08-15 03:59:12Z bruno $ {L3 Experimental sequences and stacks} %</driver|package> %<*driver> @@ -722,6 +722,21 @@ % according to the variant chosen. % \end{function} % +% \begin{function} +% {\seq_set_split:Nnn,\seq_gset_split:Nnn} +% \begin{syntax} +% \cs{seq_set_split:Nnn} \meta{sequence} +% ~~\Arg{delimiter} \Arg{token list} +% \end{syntax} +% This function splits the \meta{token list} into \meta{items} +% separated by \meta{delimiter}, ignoring all explicit space +% characters from both sides of each \meta{item}, then removing +% one set of outer braces if any. The result is assigned to +% \meta{sequence}, locally or globally according to the function +% chosen. The \meta{delimiter} may not contain |{|, |}| or |#| +% (assuming \TeX{}'s normal category code r\'egime). +% \end{function} +% % \section{Internal sequence functions} % % \begin{function}{\seq_if_empty_err_break:N} @@ -1816,6 +1831,69 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\seq_set_split:Nnn,\seq_gset_split:Nnn} +% \begin{macro}[aux]{\seq_set_split_aux:NNnn} +% \begin{macro}[aux] +% { +% \seq_set_split_aux_i:w, \seq_set_split_aux_ii:w, +% \seq_set_split_aux_end: +% } +% The goal is to split a given token list at a marker, +% strip spaces from each item, and remove one set of +% outer braces if after removing leading and trailing +% spaces the item is enclosed within braces. After +% \cs{tl_replace_all:Nnn}, the token list \cs{l_seq_tmpa_tl} +% is a repetition of the pattern +% \cs{seq_set_split_aux_i:w} \cs{prg_do_nothing:} +% \meta{item with spaces} \cs{seq_set_split_aux_end:}. +% Then, \texttt{x}-expansion causes \cs{seq_set_split_aux_i:w} +% to trim spaces, and leaves its result as +% \cs{seq_set_split_aux_ii:w} \meta{trimmed item} +% \cs{seq_set_split_aux_end:}. This is then converted +% to the \pkg{l3seq} internal structure by another +% \texttt{x}-expansion. In the first step, we insert +% \cs{prg_do_nothing:} to avoid losing braces too early: +% that would cause space trimming to act within those +% lost braces. The second step is solely there to strip +% braces which are outermost after space trimming. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \seq_set_split:Nnn + { \seq_set_split_aux:NNnn \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_split:Nnn + { \seq_set_split_aux:NNnn \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 + { + \tl_if_empty:nTF {#4} + { #1 #2 { } } + { + \tl_set:Nn \l_seq_tmpa_tl + { + \seq_set_split_aux_i:w \prg_do_nothing: + #4 + \seq_set_split_aux_end: + } + \tl_replace_all:Nnn \l_seq_tmpa_tl { #3 } + { + \seq_set_split_aux_end: + \seq_set_split_aux_i:w \prg_do_nothing: + } + \tl_set:Nx \l_seq_tmpa_tl { \l_seq_tmpa_tl } + #1 #2 { \l_seq_tmpa_tl } + } + } +\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: + { + \exp_not:N \seq_set_split_aux_ii:w + \exp_args:No \tl_trim_spaces:n {#1} + \exp_not:N \seq_set_split_aux_end: + } +\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: + { \exp_not:n { \seq_item:n {#1} } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Deprecated interfaces} % % A few functions which are no longer documented: these were moved |