Closed robertbachmann closed 3 years ago
I registered this problem. But now, I am not able to find the core. I tried to copy \_printcomment
definition from verbatim.opm to testing file doc.tex
and I did a slight modification in it:
\_def\_printcomments{\_ttskip
{\_reloading \_rm \_everypar={}%
\_noindent XXX\_vcomments YYY\_ignorespaces \_scantextokens\_ea{\_vcomments}ZZZ\_par}%
\_ttskip
}
Now, when I run your test then I see XXX YYY ZZZ in both tests, the first expansion of \_vcomments
in both tests but the result of \_scantextokens
is missing in the first test. I don't know why.
The problem was in "waiting \endinput
". It can be illustrated by following code
\def\a{\endinput \scantokens{ABC}}
\a
\end
The \endinput
primitive sets only a flag that if a next line will be opened, then current file is closed. \endinput
does not do this work immediatelly. It means that following code in the macro \a
is processed with "waiting \endinput
". If this code includes \scantokens
then the \endiput
is applied to this internal stream (before ABC
in our example). The result is, that our example skips ABC and follows the reading of the file by \end
command. Empty output is here and TeX is finished at \end
and it does not start reading from terminal (which is more expected behavior in this case, but not realized). Maybe, this is a bug in eTeX (i.e. in pdfTeX, LuaTeX etc. too). But \endinput
with context of following \scantokens
is not well documented, so we don't know if this is bug or feature.
It would be nice if we can use
%%
in addition to_doc/_cod
for literate .opm module programming.However currently I can not get it to work.
Example files:
Result is: