summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-05-21 17:35:11 +0200
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-05-21 17:40:23 +0200
commit071a2b996b39a81a04a44eaaea613813a7b053ea (patch)
tree813396f345916439bba10c727a34ab11135b7c8f
parent88043b9759cef08232e34964f488cac414c16067 (diff)
downloadluatexbase-071a2b996b39a81a04a44eaaea613813a7b053ea.tar.gz
better catcode defenses for luatex.sty
-rw-r--r--Makefile4
-rw-r--r--luatex.dtx46
2 files changed, 29 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 8b7aa1b..7cd55ca 100644
--- a/Makefile
+++ b/Makefile
@@ -143,8 +143,8 @@ check-base: $(UNPACKED_BASE)
lualatex --interaction=batchmode test-base-latex.tex >/dev/null
check-luatex: install-runfiles
- #$(TESTENV) lualatex --interaction=batchmode test-luatex1.tex >/dev/null
- #$(TESTENV) lualatex --interaction=batchmode test-luatex2.tex >/dev/null
+ $(TESTENV) luatex --interaction=batchmode test-luatex1.tex >/dev/null
+ $(TESTENV) lualatex --interaction=batchmode test-luatex2.tex >/dev/null
#$(TESTENV) lualatex --interaction=batchmode test-luatex3.tex >/dev/null
#$(TESTENV) lualatex --interaction=batchmode test-luatex4.tex >/dev/null
$(TESTENV) luatex --interaction=batchmode test-luatex5.tex >/dev/null
diff --git a/luatex.dtx b/luatex.dtx
index baeebf4..27dc35c 100644
--- a/luatex.dtx
+++ b/luatex.dtx
@@ -156,31 +156,28 @@ See source file '\inFileName' for licence and contact information.
%
% \subsection{Preliminaries}
%
-% Reload protection, especially for \plaintex.
-%
-% \begin{macrocode}
- \csname lltxb@luatex@loaded\endcsname
-\expandafter\let\csname lltxb@luatex@loaded\endcsname\endinput
-% \end{macrocode}
-%
% Catcode defenses.
%
% \begin{macrocode}
-\begingroup
+\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode123 1 % {
\catcode125 2 % }
\catcode 35 6 % #
- \toks0{}%
- \def\x{}%
+ \toks0\expandafter{\expandafter\endlinechar\the\endlinechar}%
+ \edef\x{\endlinechar13}%
\def\y#1 #2 {%
\toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
\edef\x{\x \catcode#1 #2}}%
- \y 123 1 % {
- \y 125 2 % }
- \y 35 6 % #
+ \y 13 5 % endlinechar
+ \y 61 12 % =
+ \y 32 10 % space
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
\y 10 12 % ^^J
+ \y 33 12 % !
\y 34 12 % "
- \y 36 3 % $ $
+ \y 36 3 % $ $
\y 39 12 % '
\y 40 12 % (
\y 41 12 % )
@@ -190,14 +187,25 @@ See source file '\inFileName' for licence and contact information.
\y 45 12 % -
\y 46 12 % .
\y 47 12 % /
+ \y 58 12 % :
\y 60 12 % <
- \y 61 12 % =
\y 64 11 % @ (letter)
\y 62 12 % >
+ \y 91 12 % [
+ \y 93 12 % ]
+ \y 94 7 % ^
\y 95 12 % _ (other)
\y 96 12 % `
- \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
-\expandafter\y\csname lltxb@luatex@AtEnd\endcsname
+ \toks0\expandafter{\the\toks0 \relax\noexpand\endinput}%
+ \edef\y#1{\endgroup\edef#1{\the\toks0}\x\relax}%
+\expandafter\y\csname lltxb@luatex@endinput\endcsname
+% \end{macrocode}
+%
+% Reload protection, especially for \plaintex.
+%
+% \begin{macrocode}
+ \csname lltxb@luatex@loaded\endcsname
+\expandafter\let\csname lltxb@luatex@loaded\endcsname\lltxb@luatex@endinput
% \end{macrocode}
%
% Package declaration.
@@ -235,7 +243,7 @@ See source file '\inFileName' for licence and contact information.
This package can only be used with the LuaTeX engine^^J%
(command `lualatex' or `luatex').^^J%
Package loading has been stopped to prevent additional errors.}
- \lltxb@luatex@AtEnd
+ \lltxb@luatex@endinput%
\expandafter\endinput
\fi
% \end{macrocode}
@@ -295,7 +303,7 @@ See source file '\inFileName' for licence and contact information.
% This is the end, my friend\dots the end.
%
% \begin{macrocode}
-\lltxb@luatex@AtEnd
+\lltxb@luatex@endinput%
%</texpackage>
% \end{macrocode}
%