Consider the following:

\catcode`\{=1\catcode`\}=2
\directlua{token.set_macro("foo", [[foo\ foo]])}
\show\foo
\toks0\expandafter{\foo}\end
> \foo=macro:
->fooBAD foo.
l.5 \show\foo

?
)
Runaway text?
fooBAD foo} \par \end
! File ended while scanning text of \toks.
<inserted text>
}
set_macro needs to check if the space is the only characterafter a backslash 
before removing a "trailing" space. I attached a patch.

Thanks,
Udi
diff --git a/source/texk/web2c/luatexdir/lua/lnewtokenlib.c b/source/texk/web2c/luatexdir/lua/lnewtokenlib.c
index aa42038b3..e6fcc9cc7 100644
--- a/source/texk/web2c/luatexdir/lua/lnewtokenlib.c
+++ b/source/texk/web2c/luatexdir/lua/lnewtokenlib.c
@@ -1332,8 +1332,14 @@ static int set_macro(lua_State * L)
                         str += _s ;
                         _lname = _lname + _s ;
                     } else if (_c == 10) {
-                        /* we ignore a trailing space like normal scanning does */
-                        str += _s ;
+                        if (_lname == 0) {
+                            /* backslash immediately followed by space: control space */
+                            _lname = _lname + _s ;
+                            str += _s ;
+                        } else {
+                            /* we ignore a trailing space like normal scanning does */
+                            str += _s ;
+                        }
                         break ;
                     } else {
                         if (_lname == 0) {
_______________________________________________
dev-luatex mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to