LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Will Robertson <[log in to unmask]>
Thu, 12 Feb 2009 17:00:10 +1030
text/plain (1045 bytes) , smime.p7s (2446 bytes)
Hello again,

Having some more troubles, this time with \token_if_expandable. Here's  
the code:

% \begin{macro}{\token_if_expandable_p:N}
% \begin{macro}[TF]{\token_if_expandable:N}
%   Check if token is expandable. We use the fact that \TeX\ will
%   temporarily convert "\exp_not:N" \m{token} into "\scan_stop:" if
%   \m{token} is expandable.
%    \begin{macrocode}
\def_new:Npn \token_if_expandable_p:N #1{
   \exp_after:NN \if_token_eq:NN \exp_not:N #1 \scan_stop:
\def_test_function_new:npn {token_if_expandable:N} #1{
%    \end{macrocode}
% \end{macro}
% \end{macro}

Unfortunately, the only token I can find that trips this "true" is  
\relax or \scan_stop:, which isn't exactly what I thought the intended  
behaviour was supposed to be.

   \token_if_expandable:NTF \relax {T}{F}

Ideally, I'd like to be able to write  \def\foo{bar}  and know whether  
or not \foo is expandable; until reading about this test I didn't  
think such a thing was even possible.

Any comments?