blefloch / latex-unravel

Watching TeX digest tokens
24 stars 1 forks source link

After space skipping, only first token in argument is taken as argument #64

Open muzimuzhi opened 3 months ago

muzimuzhi commented 3 months ago
\documentclass{article}
\usepackage{unravel}

\begin{document}
\def\mygobble#1{}

% expected: gobble "a\ERROR" as a whole and leave nothing
\expandafter\mygobble\space{a\ERROR}
% actual: gobble "a" only and leave "\ERROR"
\unravel{\expandafter\mygobble\space{a\ERROR}}

\end{document}

gives

|| 
|> \expandafter \mygobble \space {a\ERROR }
[===== Step 1 =====] \expandafter \mygobble 
|| \expandafter \mygobble 
|> \space {a\ERROR }
[===== Step 2 =====] \space = macro:-> 
|| \expandafter \mygobble 
|>  {a\ERROR }
[===== Step 3 =====] back_input: \expandafter \mygobble 
|| 
|> \mygobble  {a\ERROR }
[===== Step 4 =====] \mygobble = macro:#1->
|| 
|> \ERROR 
! Undefined control sequence.
\l__unravel_head_tl ->\ERROR 

Found when unraveling code using \@ifundefined{<csname>}␣{<true code containing 2 or more tokens>}{<false code>}.