Resolve csname during runtime expansion

\csname only worked inside \edef bodies, so a normal macro such as
\def\a{\csname foo\endcsname} leaked the literal construct. Handle it in the
expand loop: read through \endcsname, expand the inner text with the current
runtime table and scopes, look the resulting control sequence up, and splice
its body (nothing when undefined). Macro arguments are not consumed, so a
parameterized target is left alone for now.

A preview test defines \a through \csname, uses both \a and a direct
\csname foo\endcsname, and checks "Z and Z and ." with no warnings.
This commit is contained in:
gloamxun committed 2026-10-27 00:49:07 +08:00
1 parent 34d54d91a4
commit e48a64da7a
3 files changed
+72 -3

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
PDF opt-in with `?engine=route-d`; flat `/preview` and project previews now
prefer route-D with a v1 fallback). 997 workspace tests are green and no oracle
prefer route-D with a v1 fallback). 998 workspace tests are green and no oracle
fixture is ignored. Preview JSON also carries a `warnings` array naming
environments route-D cannot lay out and control words that survived layout, so
unsupported source is reported instead of being silently typeset.