Invoke frozen original primitives in native TeX

This commit is contained in:
gloamxun committed 2026-11-28 14:19:26 +08:00
1 parent 2007ac5627
commit ba548ef05d
10 files changed
+219 -33

No files matched your search

@@ -18,7 +18,8 @@ impl Executor {
let c = match &mut token.kind {
TokenKind::Character(c, _) | TokenKind::Command(CommandName::Active(c)) => c,
TokenKind::Command(
CommandName::Control(_) | CommandName::Font(_) | CommandName::FrozenRelax,
CommandName::Control(_) | CommandName::Font(_) | CommandName::FrozenRelax
| CommandName::FrozenPrimitivePrefix | CommandName::FrozenPrimitive(_),
) => continue,
};
self.reads.insert(Dependency::CaseCode(kind, *c));
@@ -387,11 +387,19 @@ impl Executor {
reads: &mut BTreeSet<Dependency>,
) {
match name {
CommandName::FrozenRelax => {
CommandName::FrozenRelax | CommandName::FrozenPrimitivePrefix
| CommandName::FrozenPrimitive(_) => {
if let Ok(escape) = u8::try_from(self.state.escapechar) {
out.character(char::from(escape));
}
out.text("relax ");
let name = match name {
CommandName::FrozenRelax => "relax",
CommandName::FrozenPrimitivePrefix => self.state.primitive_prefix_name(),
CommandName::FrozenPrimitive(name) => name,
_ => unreachable!(),
};
out.text(name);
out.push(' ');
}
CommandName::Font(font) => {
reads.insert(Dependency::FontResources);
@@ -569,7 +577,8 @@ impl Executor {
.unwrap_or_default();
format!("{escape}{} ", self.font_token_name(*font))
}
CommandName::FrozenRelax => unreachable!("frozen relax is not a macro"),
CommandName::FrozenRelax | CommandName::FrozenPrimitivePrefix
| CommandName::FrozenPrimitive(_) => unreachable!("frozen primitive is not a macro"),
CommandName::Active(c) => c.to_string(),
CommandName::Control(name) => {
if name.chars().count() == 1 {
@@ -882,7 +882,7 @@ impl Executor {
| Font | Fontdimen | Hyphenchar | Skewchar | Lpcode | Rpcode | Efcode | Pdffontexpand
| Knbccode | Knaccode | Letterspacefont | Textfont | Scriptfont
| Scriptscriptfont | Endlinechar | Newlinechar | Escapechar | Globaldefs | Time
| Day | Month | Year | BeginGroup | EndGroup | Relax | Message | Errmessage
| Day | Month | Year | BeginGroup | EndGroup | Relax | DeferredPrimitive | Message | Errmessage
| Endinput | Showbox | Show | Showthe | Showtokens | Showlists | Showifs | Showgroups
| Discretionary | DiscretionaryHyphen
| Parshape | LinePenalties(_) | Partokenname => {