Freeze unexpanded tokens through an edef

\unexpanded passed its text straight through, so \edef\b{\unexpanded{\a}}
expanded \a at definition time. Split the expander into an inner pass with a
freeze flag: the edef-style wrapper protects each backslash in \unexpanded's
argument with the existing no-expand marker, which the pass restores on the way
out, while the normal document pass still writes the text through so it expands
at use time.

A test defines a=A, \edef b={\unexpanded{\a}}, redefines a=C, and checks \b
prints C with no warnings; the earlier \expanded/\unexpanded/\detokenize test
still passes.
This commit is contained in:
gloamxun committed 2026-10-27 01:47:08 +08:00
1 parent 4024fa7435
commit 16b61cd368
4 files changed
+60 -10

No files matched your search

+4 -4
View File
@@ -14,12 +14,12 @@ cargo fmt --all -- --check
cargo test --workspace --offline
```
The workspace currently passes **1015 tests**:
The workspace currently passes **1016 tests**:
| Suite | Tests |
| --- | --- |
| route-D unit (engine) | 437 |
| engine binary unit | 386 |
| engine binary unit | 387 |
| server integration | 63 |
| v1 integration | 71 |
| pdfLaTeX oracle | 42 |
@@ -83,8 +83,8 @@ reports 0 warnings, 1/1/1/2 pages and under 1.5 s per preview.
- Images inside a nested table are not merged into the outer display list.
- `\valign` cells are left-aligned; its preamble alignments/vertical rules are
ignored.
- `\unexpanded` passes text through; the `\edef` freeze semantics are not
modelled.
- `\unexpanded` freezes its tokens during an edef-style pass and they expand
at use time; the wider token-stream semantics of `\edef` remain textual.
## Continuing