From 834dc4844f624a22142bd6c3e5abd4210acc8410 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 6 Apr 2019 21:15:38 +0000 Subject: l3kernel (6apr19) git-svn-id: svn://tug.org/texlive/trunk@50818 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 38 +++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'Master/texmf-dist/source/latex/l3kernel/l3tl.dtx') diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index a5eae16dbb9..c9d8c8b4825 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-03-26} +% \date{Released 2019-04-06} % % \maketitle % @@ -469,6 +469,16 @@ % token count $1$ according to \cs{tl_count:n}. % \end{function} % +% \begin{function}[EXP,pTF]{\tl_if_single_token:n} +% \begin{syntax} +% \cs{tl_if_single_token_p:n} \Arg{token list} +% \cs{tl_if_single_token:nTF} \Arg{token list} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if the token list consists of exactly one token, \emph{i.e.}~is +% either a single space character or a single \enquote{normal} token. +% Token groups (|{|\ldots|}|) are not single tokens. +% \end{function} +% % \begin{function}[added = 2013-07-24, EXP, noTF]{\tl_case:Nn, \tl_case:cn} % \begin{syntax} % \cs{tl_case:NnTF} \meta{test token list variable} \\ @@ -2224,6 +2234,32 @@ % \end{macro} % \end{macro} % +% \begin{macro}[EXP,pTF]{\tl_if_single_token:n} +% There are four cases: empty token list, token list starting with a +% normal token, with a brace group, or with a space token. If the +% token list starts with a normal token, remove it and check for +% emptiness. For the next case, an empty token list is not a single +% token. Finally, we have a non-empty token list starting with a +% space or a brace group. Applying \texttt{f}-expansion yields an +% empty result if and only if the token list is a single space. +% \begin{macrocode} +\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } + { + \tl_if_head_is_N_type:nTF {#1} + { \@@_if_empty_if:o { \use_none:n #1 } } + { + \tl_if_empty:nTF {#1} + { \if_false: } + { \@@_if_empty_if:o { \exp:w \exp_end_continue_f:w #1 } } + } + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[EXP, noTF]{\tl_case:Nn, \tl_case:cn} % \begin{macro}[EXP]{\@@_case:nnTF} % \begin{macro}[EXP]{\@@_case:Nw} -- cgit v1.2.3