On 10/26/2016 2:25 PM, David Carlisle wrote:
Hans,
there is no token \UNDEFINED so it cannot be reported as such
I think that is a terminology problem that is the source of the confusion.
there is no entry in the internal table of control names that
presumably you are looking up here but \UNDEFINED is a token in the
usual TeX sense \UNDEFINED can take part in token lists
\def\foo{\UNDEFINED} if \UNDEFINED isn't a "token" what is it?
Actually while writing the above, I guessed that the following would
work and in fact it does
\def\z{\UNDEFINED}
\directlua{texio.write_nl("[" .. token.scan_csname() .. "]")}\par
\directlua{texio.write_nl("[" .. token.get_next().csname .. "]")}\par
\directlua{texio.write_nl("[" .. token.scan_csname() .. "]")}\UNDEFINED
\directlua{texio.write_nl("[" .. token.get_next().csname .. "]")}\UNDEFINED
produces
[par]
[par]
[UNDEFINED]
[UNDEFINED]
but I wonder if the manual could be clarified, not everyone would guess that:-)
indeed (i bet that there are a few more confusing cases, esp because tex
itself when scanning puts stuff back while the token.* functions are
just picking things up)
i think can add your example as explanation somewhere
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------