Recognize space aliases when scanning TeX quantities

This commit is contained in:
gloamxun committed 2026-11-28 08:20:52 +08:00
1 parent da48cf9cad
commit 69efe0b895
3 files changed
+44 -4

No files matched your search

@@ -261,7 +261,7 @@ impl Executor {
for (i, c) in keyword.chars().enumerate() {
let next = loop {
let next = self.expanded(files)?;
if i == 0 && next.as_ref().is_some_and(|t| t.token.kind.is_space()) {
if i == 0 && next.as_ref().is_some_and(|t| self.is_spacer(&t.token)) {
continue;
}
break next;
@@ -299,7 +299,7 @@ impl Executor {
}
pub(super) fn optional_space(&mut self, files: &mut impl SourceProvider) -> Result<(), Error> {
if let Some(t) = self.expanded(files)?
&& !t.token.kind.is_space()
&& !self.is_spacer(&t.token)
{
self.unread(t)?;
}
@@ -361,7 +361,7 @@ impl Executor {
TokenKind::Character('.' | ',', CatCode::Other)
) {
has_point = true;
} else if !t.token.kind.is_space() {
} else if !self.is_spacer(&t.token) {
self.unread(t)?;
}
break;
@@ -389,7 +389,7 @@ impl Executor {
digits.push(c as i64 - '0' as i64);
}
} else {
if !t.token.kind.is_space() {
if !self.is_spacer(&t.token) {
self.unread(t)?;
}
break;
@@ -238,6 +238,10 @@ fn native_units_glue_and_printing_match_actual_pdftex() {
r"{\let\out=\report\catcode112=12 \dimen0=1pT \out{\the\dimen0}}",
r"\dimen0=.pt \dimen1=1.25pt \report{\the\dimen0/\the\dimen1}",
r"\skip0=1pt plus2fil L L \report{\the\skip0}",
r"\def\bindspace#1{\let\endnumber= #1}\bindspace{ }\spaceskip=4pt\setbox0=\hbox{\kern-0.00017pt\endnumber\kern0.00017pt\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
r"\dimendef\widthreg=2\widthreg=2pt\setbox0=\hbox{\kern\widthreg\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
r"\setbox0=\hbox{\kern1pt\endnumber\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
r"\setbox0=\hbox{\hskip2pt\endnumber\endnumber plus3pt\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
] {
cases.push(source.into());
}