[tex-k] Why is B952. "Don't allow implicit left brace after |#| (Udo Wermuth). @476" considered a bug?

Doug McKenna doug at mathemaesthetics.com
Mon Mar 1 21:14:52 CET 2021

When I first wrote the code in JSBox's interpreter for processing arguments in macro definitions (circa 2011--12), I recognized a (related) problem in this area, but decided that it wasn't a "bug" because it was "written in stone" and therefore how a TeX language interpreter (i.e., "tex.web") was supposed to work.  But I did leave myself the following comment:

>| What TeX does here in error situations is (as usual)
>| kind of weird.  As an example (and this is tested for
>| in "trip.tex"), if this '#' is about to introduce an
>| argument after arg |#9| has been processed, it is highly
>| likely that a digit follows the extra '#'.  In which case,
>| from the user's point of syntactic view, the '#' and its
>| following digit should collectively be considered "that
>| which is illegal" and summarily tossed.  But TeX merely
>| throws the '#' away, leaving the remaining digit on the
>| input to be parsed, which if the macro's argument list
>| wasn't delimited will now make it a delimited argument
>| list, no doubt leading to much misbehavior down the road.

To which I've just added:

>| This behavior was addressed in Knuth's 2021 TeX tune-up,
>| where he also changed "trip.tex" at line 356 by adding
>| to the argument list an extra '9' digit that triggers
>| this error and recovery.

FWIW, JSBox now executes the latest trip test "correctly", at least as best as I can tell after manually comparing log files, since its fully traced log file is formatted quite differently from the "trip.log" and "tripin.log".

I've used DEK's latest "trip.tex" to enhance JSBox's tracing some more, and to fix some formatting/indentation bugs.  I can supply either a 186-page PDF (printable with page numbers) of the log file, or just the text file, for anyone interested in understanding completely what "trip.tex" actually does.  TeX's logs don't do so very well, or in some cases, at all.

Doug McKenna

More information about the tex-k mailing list.