Skip to content

Commit

Permalink
add extra meaning test for #1448 (#1520)
Browse files Browse the repository at this point in the history
* add extra meaning test for #1448

* forgot to add test file to git

* chmod

* luatex (l3build could perhaps have normalised this)

* eol eof

* document use of special uccodes for catcode 12 tokens

* Correct a missing "%"

---------

Co-authored-by: Joseph Wright <[email protected]>
  • Loading branch information
davidcarlisle and josephwright authored Oct 30, 2024
1 parent 40c1b17 commit 68386bf
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 7 deletions.
31 changes: 24 additions & 7 deletions required/amsmath/amsmath.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \begin{macrocode}
\DeclareRelease{}{1994-06-01}{amsmath-2018-12-01.sty}
\DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty}
\DeclareCurrentRelease{}{2019-04-01}
\DeclareCurrentRelease{}{2024-10-30}
% \end{macrocode}
%
% \begin{macrocode}
\ProvidesPackage{amsmath}[2024/08/11 v2.17r AMS math features]
\ProvidesPackage{amsmath}[2024/10/30 v2.17s AMS math features]
% \end{macrocode}
%
% \section{Catcode defenses}
Expand Down Expand Up @@ -1002,6 +1002,10 @@ Foreign command \@backslashchar#1;\MessageBreak
\let\DOTSI\relax
\let\DOTSB\relax
\let\DOTSX\relax
% \end{macrocode}
% In the definitions below, special \cs{uccode}s are used to generate macros
% with arguments delimited by catcode 12 letters as returned by \cs{meaning}.
% \begin{macrocode}
{\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h
\uppercase{%
\gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2%
Expand Down Expand Up @@ -1039,6 +1043,13 @@ Foreign command \@backslashchar#1;\MessageBreak
}
\fi
% \end{macrocode}
% \changes{v2.17s}{2024/10/30}{guard against primitive if (gh/1448)}
% \begin{macrocode}
{\uccode`7=`\\ \uccode`(=`i \uccode`)=`f
\uppercase{\gdef\testif@#1#2#3#4\testif@{%
\ifx7#1\ifx(#2\ifx)#3\@tempswafalse\fi\fi\fi}
}}
% \end{macrocode}
% \begin{macrocode}
\newcount\classnum@
\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096
Expand Down Expand Up @@ -1159,11 +1170,17 @@ Foreign command \@backslashchar#1;\MessageBreak
% \changes{v2.15d}{2016/06/28}{Add space token to prevent runaway
% argument error}
% \changes{v2.17r}{2024/06/29}{Drop \cs{protect} if present (gh/1265)}
% \begin{macrocode}
\begingroup
\def\protect{\protect}% % make it a quark
\xdef\meaning@{\@xp\stripprotect@\@let@token.........\stripprotect@. .........}%
\endgroup
% \changes{v2.17s}{2024/10/30}{skip protect testif detect primitive if (gh/1448)}
% \begin{macrocode}
\xdef\meaning@{\meaning\@let@token. .........}%
\@tempswatrue
\@xp\testif@\meaning@....\testif@
\if@tempswa
\begingroup
\def\protect{\protect}% % make it a quark
\xdef\meaning@{\@xp\stripprotect@\@let@token.........\stripprotect@. .........}%
\endgroup
\fi
% \end{macrocode}
% In previous versions \verb|\long| macros were not seen by the lookahead.
% That was bad as this file uses \verb|\(re)newcommand| for \verb|\implies| etc.
Expand Down
178 changes: 178 additions & 0 deletions required/amsmath/testfiles/github-1448.luatex.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0, direction TLT
.\glue 16.0
.\vbox(617.0+0.0)x345.0, shifted 62.0, direction TLT
..\vbox(12.0+0.0)x345.0, glue set 12.0fil, direction TLT
...\glue 0.0 plus 1.0fil
...\hbox(0.0+0.0)x345.0, direction TLT
....\hbox(0.0+0.0)x345.0, direction TLT
..\glue 25.0
..\glue(\lineskip) 0.0
..\vbox(550.0+0.0)x345.0, glue set 479.94873fil, direction TLT
...\write-{}
...\glue(\topskip) 4.16667
...\hbox(5.83333+0.83333)x345.0, glue set 301.50708fil, direction TLT
....\localpar
.....\localinterlinepenalty=0
.....\localbrokenpenalty=0
.....\localleftbox=null
.....\localrightbox=null
....\hbox(0.0+0.0)x15.0, direction TLT
....\mathon
....\OML/cmm/m/it/10 x
....\glue(\thinmuskip) 1.66663
....\hbox(4.44444+0.0)x11.66661, direction TLT
.....\OMS/cmsy/m/n/10 ^^A
.....\glue(\thinmuskip) 1.66663
.....\OMS/cmsy/m/n/10 ^^A
.....\glue(\thinmuskip) 1.66663
.....\OMS/cmsy/m/n/10 ^^A
....\glue(\thinmuskip) 1.66663
....\OT1/cmr/m/n/10 +
....\mathoff
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 5.33334
...\hbox(5.83333+0.83333)x345.0, glue set 301.50708fil, direction TLT
....\localpar
.....\localinterlinepenalty=0
.....\localbrokenpenalty=0
.....\localleftbox=null
.....\localrightbox=null
....\hbox(0.0+0.0)x15.0, direction TLT
....\mathon
....\OML/cmm/m/it/10 x
....\glue(\thinmuskip) 1.66663
....\hbox(4.44444+0.0)x11.66661, direction TLT
.....\OMS/cmsy/m/n/10 ^^A
.....\glue(\thinmuskip) 1.66663
.....\OMS/cmsy/m/n/10 ^^A
.....\glue(\thinmuskip) 1.66663
.....\OMS/cmsy/m/n/10 ^^A
....\glue(\thinmuskip) 1.66663
....\OMS/cmsy/m/n/10 ^^@
....\mathoff
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 6.51389
...\hbox(4.65279+0.0)x345.0, glue set 304.28485fil, direction TLT
....\localpar
.....\localinterlinepenalty=0
.....\localbrokenpenalty=0
.....\localleftbox=null
.....\localrightbox=null
....\hbox(0.0+0.0)x15.0, direction TLT
....\mathon
....\OML/cmm/m/it/10 x
....\glue(\thinmuskip) 1.66663
....\hbox(4.44444+0.0)x11.66661, direction TLT
.....\OMS/cmsy/m/n/10 ^^A
.....\glue(\thinmuskip) 1.66663
.....\OMS/cmsy/m/n/10 ^^A
.....\glue(\thinmuskip) 1.66663
.....\OMS/cmsy/m/n/10 ^^A
....\glue(\thinmuskip) 1.66663
....\OMS/cmsy/m/n/10 ^^C
....\mathoff
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 5.05556
...\hbox(6.94444+0.0)x345.0, glue set 304.99323fil, direction TLT
....\localpar
.....\localinterlinepenalty=0
.....\localbrokenpenalty=0
.....\localleftbox=null
.....\localrightbox=null
....\hbox(0.0+0.0)x15.0, direction TLT
....\mathon
....\OML/cmm/m/it/10 x
....\glue(\thinmuskip) 1.66663
....\hbox(1.05554+0.0)x11.66661, direction TLT
.....\OML/cmm/m/it/10 :
.....\glue(\thinmuskip) 1.66663
.....\OML/cmm/m/it/10 :
.....\glue(\thinmuskip) 1.66663
.....\OML/cmm/m/it/10 :
....\glue(\thinmuskip) 1.66663
....\OML/cmm/m/it/10 b
....\mathoff
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x345.0, glue set 303.56958fil, direction TLT
....\localpar
.....\localinterlinepenalty=0
.....\localbrokenpenalty=0
.....\localleftbox=null
.....\localrightbox=null
....\hbox(0.0+0.0)x15.0, direction TLT
....\mathon
....\OML/cmm/m/it/10 x
....\glue(\thinmuskip) 1.66663
....\hbox(1.05554+0.0)x11.66661, direction TLT
.....\OML/cmm/m/it/10 :
.....\glue(\thinmuskip) 1.66663
.....\OML/cmm/m/it/10 :
.....\glue(\thinmuskip) 1.66663
.....\OML/cmm/m/it/10 :
....\glue(\thinmuskip) 1.66663
....\OML/cmm/m/it/10 x
....\mathoff
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 7.55556
...\hbox(4.44444+1.94444)x345.0, glue set 303.01172fil, direction TLT
....\localpar
.....\localinterlinepenalty=0
.....\localbrokenpenalty=0
.....\localleftbox=null
.....\localrightbox=null
....\hbox(0.0+0.0)x15.0, direction TLT
....\mathon
....\OML/cmm/m/it/10 x
....\glue(\thinmuskip) 1.66663
....\hbox(1.05554+0.0)x11.66661, direction TLT
.....\OML/cmm/m/it/10 :
.....\glue(\thinmuskip) 1.66663
.....\OML/cmm/m/it/10 :
.....\glue(\thinmuskip) 1.66663
.....\OML/cmm/m/it/10 :
....\glue(\thinmuskip) 1.66663
....\hbox(4.44444+1.94444)x6.27313, direction TLT
.....\hbox(4.44444+1.94444)x6.27313, direction TLT
......\mathon
......\OML/cmm/b/it/10 y
......\kern0.37038 (italic)
......\mathoff
....\mathoff
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\glue -1.94444
...\glue 0.0 plus 1.0fil
...\glue 0.0
...\glue 0.0 plus 0.0001fil
..\glue(\baselineskip) 23.55556
..\hbox(6.44444+0.0)x345.0, direction TLT
...\hbox(6.44444+0.0)x345.0, glue set 170.0fil, direction TLT
....\glue 0.0 plus 1.0fil
....\OT1/cmr/m/n/10 1
....\glue 0.0 plus 1.0fil
(github-1448.aux)
34 changes: 34 additions & 0 deletions required/amsmath/testfiles/github-1448.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
\documentclass{article}

\input{test2e}

% 2.17r gave low level argument errors as teh \if nesting
% was wrong if the \futurelet found a primitive \if... token

\usepackage{amsmath}


\newcommand\test{\iftrue x\fi}

\DeclareRobustCommand\testr{\DOTSB+}
\protected\def\testp{\DOTSB-}
\def\testd{\DOTSB*}

\begin{document}

\START
\showoutput
$ x \dots \testr$

$ x \dots \testp$

$ x \dots \testd$

$x \dots \iffalse a\else b\fi $

$x \dots \test$

$x \dots \boldsymbol{y} $


\end{document}
Loading

0 comments on commit 68386bf

Please sign in to comment.