summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintexpr.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintexpr.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintexpr.sty86
1 files changed, 46 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index 0565e1d0212..239625f466c 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -21,9 +21,9 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09i of December 18, 2013)
+%% The xint bundle (version 1.09j of January 9, 2014)
%% xintexpr: Expandable expression parser
-%% Copyright (C) 2013 by Jean-Francois Burnol
+%% Copyright (C) 2013-2014 by Jean-Francois Burnol
%%----------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
@@ -53,8 +53,7 @@
\else
\ifx\x\relax % plain-TeX, first loading of xintexpr.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintexpr}{Package xintfrac is required}%
- \y{xintexpr}{Will try \string\input\space xintfrac.sty}%
+ \y{xintexpr}{now issuing \string\input\space xintfrac.sty}%
\def\z{\endgroup\input xintfrac.sty\relax}%
\fi
\else
@@ -62,8 +61,7 @@
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintexpr}{Package xintfrac is required}%
- \y{xintexpr}{Will try \string\RequirePackage{xintfrac}}%
+ \y{xintexpr}{now issuing \string\RequirePackage{xintfrac}}%
\def\z{\endgroup\RequirePackage{xintfrac}}%
\fi
\else
@@ -103,8 +101,8 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2013/12/18 v1.09i Expandable expression parser (jfB)]%
-\def\xint_gob_til_! #1!{}% nota bene: ! is of catcode 11
+ [2014/01/09 v1.09j Expandable expression parser (jfB)]%
+\def\xint_gob_til_! #1!{}% nota bene: this ! has catcode 11
\edef\XINT_expr_lock #1!%
{\noexpand\expandafter\space\noexpand\csname .=#1\noexpand\endcsname }%
\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }%
@@ -112,13 +110,15 @@
\def\XINT_expr_unexpectedtoken {\xintError:ignored }%
\def\XINT_newexpr_setprefix #1>{\noexpand\romannumeral-`0}%
\def\xint_UDxintrelaxfork #1\xint_relax #2#3\krof {#2}%
-\def\XINT_expr_done {!\XINT_expr_usethe\XINT_expr_print }%
-\let\XINT_iiexpr_done \XINT_expr_done
-\def\XINT_iexpr_done {!\XINT_expr_usethe\XINT_iexpr_print }%
-\def\XINT_flexpr_done {!\XINT_expr_usethe\XINT_flexpr_print }%
-\def\XINT_boolexpr_done{!\XINT_expr_usethe\XINT_boolexpr_print }%
-\def\XINT_expr_usethe {use_xintthe!\xintError:use_xintthe! }%
-\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral-`0#1}%
+\def\xint_protect {\noexpand\xint_protect\noexpand }% 1.09j
+\def\XINT_expr_done {!\XINT_expr_usethe\xint_protect\XINT_expr_print }%
+\let\XINT_iiexpr_done \XINT_expr_done
+\def\XINT_iexpr_done {!\XINT_expr_usethe\xint_protect\XINT_iexpr_print }%
+\def\XINT_flexpr_done {!\XINT_expr_usethe\xint_protect\XINT_flexpr_print }%
+\def\XINT_boolexpr_done {!\XINT_expr_usethe\xint_protect\XINT_boolexpr_print }%
+\protected\def\XINT_expr_usethe #1#2#3% modified in 1.09j
+ {\xintError:missing_xintthe!\show#3missing xintthe (see log)!}%
+\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}%
\let\XINT_expr_print \XINT_expr_unlock
\def\XINT_iexpr_print #1{\xintRound:csv {\XINT_expr_unlock #1}}%
\def\XINT_flexpr_print #1{\xintFloat:csv {\XINT_expr_unlock #1}}%
@@ -133,19 +133,19 @@
\def\xintiieval
{\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
\def\xinttheexpr
- {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xinteval }%
+ {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
\def\xintthefloatexpr
- {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xintfloateval }%
+ {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xintfloateval }%
\def\xinttheiiexpr
- {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xintiieval }%
+ {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xintiieval }%
\def\xintiexpr {\romannumeral0\expandafter\expandafter\expandafter
- \XINT_iexpr_done \expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+ \XINT_iexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
\def\xinttheiexpr {\romannumeral-`0\expandafter\expandafter\expandafter
- \XINT_iexpr_print\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+ \XINT_iexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
- \XINT_boolexpr_done \expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+ \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
- \XINT_boolexpr_print\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+ \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
\let\xintnumexpr \xintiexpr % deprecated
\let\xintthenumexpr\xinttheiexpr % deprecated
\def\xintifboolexpr #1%
@@ -183,7 +183,7 @@
}%
\def\XINT_expr_getnext_gotonetoken_wehope\Z #1%
{% screens out sub-expressions and \count or \dimen registers/variables
- \xint_gob_til_! #1\XINT_expr_subexpr !%
+ \xint_gob_til_! #1\XINT_expr_subexpr !% recall this ! has catcode 11
\ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs
\expandafter\XINT_expr_countdimenetc_fork
\else
@@ -192,7 +192,7 @@
\fi
#1%
}%
-\def\XINT_expr_subexpr !#1\fi {\expandafter\XINT_expr_getop\xint_gobble_iii }%
+\def\XINT_expr_subexpr !#1\fi !{\expandafter\XINT_expr_getop\xint_gobble_iii }%
\def\XINT_expr_countdimenetc_fork #1%
{%
\ifx\count#1\else\ifx#1\dimen\else\ifx#1\numexpr\else\ifx#1\dimexpr\else
@@ -212,10 +212,10 @@
{% The * is in truth catcode 12 #. For (hacking) use with \xintNewExpr.
\XINT_expr_sixwayfork
#1-.+*{\xint_c_xviii ({}}% back to until for oparen triggering
- (#1.+*-%
- (-#1+*{\XINT_expr_scandec_II.}%
- (-.#1*\XINT_expr_getnext%
- (-.+#1{\XINT_expr_scandec_II}%
+ (#1.+*{-}%
+ (-#1+*{\XINT_expr_scandec_II .}%
+ (-.#1*{\XINT_expr_getnext }%
+ (-.+#1{\XINT_expr_scandec_II }%
(-.+*{\XINT_expr_scan_dec_or_func #1}%
\krof
}}%
@@ -269,11 +269,12 @@
\XINT_expr_lock\romannumeral-`0\XINT_expr_scanfracpart_b
}%
\def\XINT_expr_scanintpart_a #1% Please no braced material: 123{FORBIDDEN}
-{%
+{% careful that ! has catcode letter... spaces needed after <cs>...
\ifcat #1\relax
- \expandafter !%
- \else \expandafter\expandafter\expandafter
- \XINT_expr_scanintpart_aa\expandafter\string
+ \expandafter !% stop number scan if \relax, \count, \numexpr, or
+ \else \xint_afterfi{\ifx !#1\expandafter !\else % also \xintexpr etc..
+ \expandafter\expandafter\expandafter
+ \XINT_expr_scanintpart_aa\expandafter\string\fi }%
\fi #1%
}%
\def\XINT_expr_scanintpart_aa #1%
@@ -285,7 +286,7 @@
\expandafter\expandafter\expandafter
\XINT_expr_scandec_transition
\else % gather what we got so far, leave catcode 12 #1 in stream
- \expandafter\expandafter\expandafter !% ! of catcode 11 ...
+ \expandafter\expandafter\expandafter !% ! of catcode 11, space needed
\fi
\fi
#1%
@@ -303,9 +304,10 @@
\def\XINT_expr_scanfracpart_a #1%
{%
\ifcat #1\relax
- \expandafter !%
- \else \expandafter\expandafter\expandafter
- \XINT_expr_scanfracpart_aa\expandafter\string
+ \expandafter !% stop number scan
+ \else \xint_afterfi{\ifx !#1\expandafter !\else
+ \expandafter\expandafter\expandafter
+ \XINT_expr_scanfracpart_aa\expandafter\string\fi }%
\fi #1%
}%
\def\XINT_expr_scanfracpart_aa #1%
@@ -332,10 +334,14 @@
\ifcat #2\relax\expandafter\xint_firstoftwo
\else \expandafter\xint_secondoftwo
\fi
- {\ifx #2\relax\expandafter\XINT_expr_foundend\expandafter#1%
- \else
- \xint_afterfi{\XINT_expr_foundop *#1#2}%
- \fi }%
+ {\ifx #2\relax\expandafter\xint_firstofthree
+ \else\expandafter\xint_secondofthree % tacit multiplication
+ \fi }%
+ {\ifx !#2\expandafter\xint_secondofthree % tacit multiplication
+ \else\expandafter\xint_thirdofthree
+ \fi }%
+ {\XINT_expr_foundend #1}%
+ {\XINT_expr_foundop *#1#2}%
{\XINT_expr_foundop #2#1}%
}%
\def\XINT_expr_foundend {\xint_c_ \relax }% \relax is a place holder here.