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.sty344
1 files changed, 265 insertions, 79 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index 2d8a4df7af5..889e3e521b9 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.4a 2020/02/19
+%% The xint bundle 1.4b 2020/02/25
%% Copyright (C) 2013-2020 by Jean-Francois Burnol
%% xintexpr: Expandable expression parser
%% ---------------------------------------------------------------
@@ -82,7 +82,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2020/02/19 v1.4a Expandable expression parser (JFB)]%
+ [2020/02/25 v1.4b Expandable expression parser (JFB)]%
\catcode`! 11
\let\XINT_Cmp \xintiiCmp
\def\XINTfstop{\noexpand\XINTfstop}%
@@ -120,6 +120,35 @@
\xint_orthat<]\XINT:expr:toblist_c>#1#2%
>%
\catcode`{ 1 \catcode`} 2 \catcode`< 12 \catcode`> 12
+\def\XINT:expr:flatten#1%
+{%
+ {{\expandafter\XINT:expr:flatten_checkempty\detokenize{#1}^}}%
+}%
+\def\XINT:expr:flatten_checkempty #1%
+{%
+ \if ^#1\expandafter\xint_gobble_i\else\expandafter\XINT:expr:flatten_a\fi
+ #1%
+}%
+\begingroup % should I check lccode s generally if corrupted context at load?
+\catcode`[ 1 \catcode`] 2 \lccode`[`{ \lccode`]`}
+\catcode`< 1 \catcode`> 2 \catcode`{ 12 \catcode`} 12
+\lowercase<\endgroup
+\def\XINT:expr:flatten_a {#1%
+<%
+ \if{#1\xint_dothis<\XINT:expr:flatten_a>\fi
+ \xint_orthat\XINT:expr:flatten_b #1%
+>%
+\def\XINT:expr:flatten_b #1}%
+<%
+ [#1]\XINT:expr:flatten_c }%
+>%
+\def\XINT:expr:flatten_c }#1%
+<%
+ \if ^#1\xint_dothis<\xint_gobble_i>\fi
+ \if{#1\xint_dothis<\XINT:expr:flatten_a>\fi
+ \xint_orthat<\XINT:expr:flatten_c>#1%
+>%
+>% back to normal catcodes
\catcode`& 4
\protected\def\xintexpralignbegin {\halign\bgroup\tabskip2ex\hfil##&&##\hfil\cr}%
\protected\def\xintexpralignend {\crcr\egroup}%
@@ -354,7 +383,6 @@
#1#2#3#4#5#6#7#8#9%
\xintthespaceseparated_b}%
\def\xintthespaceseparated_c !#1!#2^{#1}%
-\def\XINT:NEhook:unpack{\xint_stop_atfirstofone}%
\let\XINT:NEhook:f:one:from:one\expandafter
\let\XINT:NEhook:f:one:from:one:direct\empty
\let\XINT:NEhook:f:one:from:two\expandafter
@@ -1018,15 +1046,17 @@
\fi
}%
}%
+\def\XINT:NEhook:unpack{\xint_stop_atfirstofone}%
\xintFor* #1 in {{expr}{flexpr}{iiexpr}}:
{\expandafter\XINT_tmpa\csname XINT_#1_op_0\expandafter\endcsname
\csname XINT_#1_until_unpack\endcsname {#1}}%
\catcode`& 12
-\xintFor* #1 in {{==}{<=}{>=}{!=}{&&}{||}{**}{//}{/:}{..}{..[}{].}{]..}}%
+\xintFor* #1 in {{==}{<=}{>=}{&&}{||}{**}{//}{/:}{..}{..[}{].}{]..}}%
\do {\expandafter\def\csname XINT_expr_itself_#1\endcsname {#1}}%
\catcode`& 7
+\expandafter\edef\csname XINT_expr_itself_!=\endcsname{\string !=}%
\expandafter\let\csname XINT_expr_precedence_***\endcsname \xint_c_xvi
-\def\XINT_expr_defbin_c #1#2#3#4#5#6#7#8#9%
+\def\XINT_expr_defbin_c #1#2#3#4#5#6#7#8%
{%
\def #1##1% \XINT_expr_op_<op>
{%
@@ -1036,7 +1066,7 @@
\def #2##1##2##3##4% \XINT_expr_exec_<op>
{%
\expandafter##2\expandafter##3\expandafter
- {#9{\romannumeral`&&@#6##1##4}}%
+ {\romannumeral`&&@\XINT:NEhook:f:one:from:two{\romannumeral`&&@#6##1##4}}%
}%
\def #3##1% \XINT_expr_check-_<op>
{%
@@ -1065,60 +1095,44 @@
\csname XINT_#1_op_-#4\expandafter\endcsname
\csname #5\expandafter\endcsname
\csname XINT_expr_precedence_#2\endcsname
- {#1}{\romannumeral`&&@\XINT:NEhook:f:one:from:two}%
+ {#1}%
\expandafter % done 3 times but well
\let\csname XINT_expr_precedence_#2\expandafter\endcsname
\csname xint_c_#3\endcsname
}%
-\catcode`& 12
\XINT_expr_defbin_b {expr} {||} {vi}{xii} {xintOR}%
\XINT_expr_defbin_b {flexpr}{||} {vi}{xii} {xintOR}%
\XINT_expr_defbin_b {iiexpr}{||} {vi}{xii} {xintOR}%
+\catcode`& 12
\XINT_expr_defbin_b {expr} {&&} {viii}{xii} {xintAND}%
\XINT_expr_defbin_b {flexpr}{&&} {viii}{xii} {xintAND}%
\XINT_expr_defbin_b {iiexpr}{&&} {viii}{xii} {xintAND}%
+\catcode`& 7
\XINT_expr_defbin_b {expr} {xor}{vi}{xii} {xintXOR}%
\XINT_expr_defbin_b {flexpr}{xor}{vi}{xii} {xintXOR}%
\XINT_expr_defbin_b {iiexpr}{xor}{vi}{xii} {xintXOR}%
-\XINT_expr_defbin_b {expr} < {x}{xii} {xintLt}%
-\XINT_expr_defbin_b {flexpr} < {x}{xii} {xintLt}%
-\XINT_expr_defbin_b {iiexpr} < {x}{xii} {xintiiLt}%
-\XINT_expr_defbin_b {expr} > {x}{xii} {xintGt}%
-\XINT_expr_defbin_b {flexpr} > {x}{xii} {xintGt}%
-\XINT_expr_defbin_b {iiexpr} > {x}{xii} {xintiiGt}%
-\XINT_expr_defbin_b {expr} {==} {x}{xii} {xintEq}%
-\XINT_expr_defbin_b {flexpr}{==} {x}{xii} {xintEq}%
-\XINT_expr_defbin_b {iiexpr}{==} {x}{xii} {xintiiEq}%
-\XINT_expr_defbin_b {expr} {<=} {x}{xii} {xintLtorEq}%
-\XINT_expr_defbin_b {flexpr}{<=} {x}{xii} {xintLtorEq}%
-\XINT_expr_defbin_b {iiexpr}{<=} {x}{xii} {xintiiLtorEq}%
-\XINT_expr_defbin_b {expr} {>=} {x}{xii} {xintGtorEq}%
-\XINT_expr_defbin_b {flexpr}{>=} {x}{xii} {xintGtorEq}%
-\XINT_expr_defbin_b {iiexpr}{>=} {x}{xii} {xintiiGtorEq}%
-\XINT_expr_defbin_b {expr} {!=} {x}{xii} {xintNotEq}%
-\XINT_expr_defbin_b {flexpr}{!=} {x}{xii} {xintNotEq}%
-\XINT_expr_defbin_b {iiexpr}{!=} {x}{xii} {xintiiNotEq}%
-\XINT_expr_defbin_b {expr} {//} {xiv}{xiv}{xintDivFloor}% CHANGED IN 1.2p!
+\XINT_expr_defbin_b {expr} {//} {xiv}{xiv}{xintDivFloor}%
\XINT_expr_defbin_b {flexpr}{//} {xiv}{xiv}{XINTinFloatDivFloor}% "
\XINT_expr_defbin_b {iiexpr}{//} {xiv}{xiv}{xintiiDivFloor}% "
\XINT_expr_defbin_b {expr} {/:} {xiv}{xiv}{xintMod}% "
\XINT_expr_defbin_b {flexpr}{/:} {xiv}{xiv}{XINTinFloatMod}% "
\XINT_expr_defbin_b {iiexpr}{/:} {xiv}{xiv}{xintiiMod}% "
-\XINT_expr_defbin_b {expr} + {xii}{xii} {xintAdd}%
-\XINT_expr_defbin_b {flexpr} + {xii}{xii} {XINTinFloatAdd}%
-\XINT_expr_defbin_b {iiexpr} + {xii}{xii} {xintiiAdd}%
-\XINT_expr_defbin_b {expr} - {xii}{xii} {xintSub}%
-\XINT_expr_defbin_b {flexpr} - {xii}{xii} {XINTinFloatSub}%
-\XINT_expr_defbin_b {iiexpr} - {xii}{xii} {xintiiSub}%
+\XINT_expr_defbin_b {expr} + {xii}{xii}{xintAdd}%
+\XINT_expr_defbin_b {flexpr} + {xii}{xii}{XINTinFloatAdd}%
+\XINT_expr_defbin_b {iiexpr} + {xii}{xii}{xintiiAdd}%
+\XINT_expr_defbin_b {expr} - {xii}{xii}{xintSub}%
+\XINT_expr_defbin_b {flexpr} - {xii}{xii}{XINTinFloatSub}%
+\XINT_expr_defbin_b {iiexpr} - {xii}{xii}{xintiiSub}%
\XINT_expr_defbin_b {expr} * {xiv}{xiv}{xintMul}%
\XINT_expr_defbin_b {flexpr} * {xiv}{xiv}{XINTinFloatMul}%
\XINT_expr_defbin_b {iiexpr} * {xiv}{xiv}{xintiiMul}%
\XINT_expr_defbin_b {expr} / {xiv}{xiv}{xintDiv}%
\XINT_expr_defbin_b {flexpr} / {xiv}{xiv}{XINTinFloatDiv}%
-\XINT_expr_defbin_b {iiexpr} / {xiv}{xiv}{xintiiDivRound}% CHANGED IN 1.1!
-\XINT_expr_defbin_b {expr} ^ {xviii}{xviii} {xintPow}%
-\XINT_expr_defbin_b {flexpr} ^ {xviii}{xviii} {XINTinFloatPowerH}%
-\XINT_expr_defbin_b {iiexpr} ^ {xviii}{xviii} {xintiiPow}%
+\XINT_expr_defbin_b {iiexpr} / {xiv}{xiv}{xintiiDivRound}%
+\XINT_expr_defbin_b {expr} ^ {xviii}{xviii}{xintPow}%
+\XINT_expr_defbin_b {flexpr} ^ {xviii}{xviii}{XINTinFloatPowerH}%
+\XINT_expr_defbin_b {iiexpr} ^ {xviii}{xviii}{xintiiPow}%
+\catcode`& 12
\xintFor #1 in {and,or,xor,mod} \do
{%
\expandafter\def\csname XINT_expr_itself_#1\endcsname {#1}%
@@ -1138,8 +1152,6 @@
\expandafter\let\csname XINT_#1_op_mod\expandafter\endcsname
\csname XINT_#1_op_/:\endcsname
}%
-\expandafter\let\csname XINT_expr_precedence_=\expandafter\endcsname
- \csname XINT_expr_precedence_==\endcsname
\expandafter\let\csname XINT_expr_precedence_&\expandafter\endcsname
\csname XINT_expr_precedence_&&\endcsname
\expandafter\let\csname XINT_expr_precedence_|\expandafter\endcsname
@@ -1148,8 +1160,6 @@
\csname XINT_expr_precedence_^\endcsname
\xintFor #1 in {expr, flexpr, iiexpr} \do
{%
- \expandafter\let\csname XINT_#1_op_=\expandafter\endcsname
- \csname XINT_#1_op_==\endcsname
\expandafter\let\csname XINT_#1_op_&\expandafter\endcsname
\csname XINT_#1_op_&&\endcsname
\expandafter\let\csname XINT_#1_op_|\expandafter\endcsname
@@ -1158,35 +1168,113 @@
\csname XINT_#1_op_^\endcsname
}%
\catcode`& 7
-\def\XINT_expr_defbin_b #1#2#3#4%
+\def\XINT_expr_defbin_c #1#2#3#4#5#6#7%
+{%
+ \def #1##1% \XINT_expr_op_..[
+ {%
+ \expanded{\unexpanded{#2{##1}}\expandafter}%
+ \romannumeral`&&@\expandafter#3\romannumeral`&&@\XINT_expr_getnext
+ }%
+ \def #2##1##2##3##4% \XINT_expr_exec_..[
+ {%
+ ##2##3{{##1##4}}%
+ }%
+ \def #3##1% \XINT_expr_check-_..[
+ {%
+ \xint_UDsignfork
+ ##1{\expandafter#4\romannumeral`&&@#5}%
+ -{#4##1}%
+ \krof
+ }%
+ \def #4##1##2% \XINT_expr_checkp_..[
+ {%
+ \ifnum ##1>#6%
+ \expandafter#4%
+ \romannumeral`&&@\csname XINT_#7_op_##2\expandafter\endcsname
+ \else
+ \expandafter ##1\expandafter ##2%
+ \fi
+ }%
+}%
+\def\XINT_expr_defbin_b #1%
+{%
+ \expandafter\XINT_expr_defbin_c
+ \csname XINT_#1_op_..[\expandafter\endcsname
+ \csname XINT_#1_exec_..[\expandafter\endcsname
+ \csname XINT_#1_check-_..[\expandafter\endcsname
+ \csname XINT_#1_checkp_..[\expandafter\endcsname
+ \csname XINT_#1_op_-xii\expandafter\endcsname
+ \csname XINT_expr_precedence_..[\endcsname
+ {#1}%
+}%
+\XINT_expr_defbin_b {expr}%
+\XINT_expr_defbin_b {flexpr}%
+\XINT_expr_defbin_b {iiexpr}%
+\expandafter\let\csname XINT_expr_precedence_..[\endcsname\xint_c_vi
+\def\XINT_expr_defbin_c #1#2#3#4#5#6#7#8%
+{%
+ \def #1##1% \XINT_expr_op_<op>
+ {%
+ \expanded{\unexpanded{#2{##1}}\expandafter}%
+ \romannumeral`&&@\expandafter#3\romannumeral`&&@\XINT_expr_getnext
+ }%
+ \def #2##1##2##3##4% \XINT_expr_exec_<op>
+ {%
+ \expandafter##2\expandafter##3\expanded
+ {{\XINT:NEhook:x:one:from:two#8##1##4}}%
+ }%
+ \def #3##1% \XINT_expr_check-_<op>
+ {%
+ \xint_UDsignfork
+ ##1{\expandafter#4\romannumeral`&&@#5}%
+ -{#4##1}%
+ \krof
+ }%
+ \def #4##1##2% \XINT_expr_checkp_<op>
+ {%
+ \ifnum ##1>#6%
+ \expandafter#4%
+ \romannumeral`&&@\csname XINT_#7_op_##2\expandafter\endcsname
+ \else
+ \expandafter ##1\expandafter ##2%
+ \fi
+ }%
+}%
+\def\XINT_expr_defbin_b #1#2#3%
{%
\expandafter\XINT_expr_defbin_c
\csname XINT_#1_op_#2\expandafter\endcsname
\csname XINT_#1_exec_#2\expandafter\endcsname
\csname XINT_#1_check-_#2\expandafter\endcsname
\csname XINT_#1_checkp_#2\expandafter\endcsname
- \csname XINT_#1_op_-#4\expandafter\endcsname
- \expandafter{\expandafter}%
+ \csname XINT_#1_op_-xii\expandafter\endcsname
\csname XINT_expr_precedence_#2\endcsname
- {#1}{\expandafter}% REVOIR
- \expandafter
- \let\csname XINT_expr_precedence_#2\expandafter\endcsname
- \csname xint_c_#3\endcsname
+ {#1}#3%
+ \expandafter\let
+ \csname XINT_expr_precedence_#2\expandafter\endcsname\xint_c_vi
+}%
+\XINT_expr_defbin_b {expr} {..}\xintSeq:tl:x
+\XINT_expr_defbin_b {flexpr} {..}\xintSeq:tl:x
+\XINT_expr_defbin_b {iiexpr} {..}\xintiiSeq:tl:x
+\XINT_expr_defbin_b {expr} {]..}\xintSeqB:tl:x
+\XINT_expr_defbin_b {flexpr}{]..}\xintSeqB:tl:x
+\XINT_expr_defbin_b {iiexpr}{]..}\xintiiSeqB:tl:x
+\def\XINT_expr_defbin_d #1#2%
+{%
+ \def #1##1##2##3##4% \XINT_expr_exec_<op>
+ {%
+ \expandafter##2\expandafter##3\expandafter
+ {\romannumeral`&&@\XINT:NEhook:f:one:from:two{\romannumeral`&&@#2##1##4}}%
+ }%
}%
-\XINT_expr_defbin_b {expr} {..[}{vi}{xii}%
-\XINT_expr_defbin_b {flexpr}{..[}{vi}{xii}%
-\XINT_expr_defbin_b {iiexpr}{..[}{vi}{xii}%
\def\XINT_expr_defbin_c #1#2#3#4#5#6#7#8#9%
{%
\def #1##1% \XINT_expr_op_<op>
{%
\expanded{\unexpanded{#2{##1}}\expandafter}%
+ \romannumeral`&&@\expandafter#7%
\romannumeral`&&@\expandafter#3\romannumeral`&&@\XINT_expr_getnext
}%
- \def #2##1##2##3##4% \XINT_expr_exec_<op>
- {%
- \expandafter##2\expandafter##3\expanded{{#9#6##1##4}}%
- }%
\def #3##1% \XINT_expr_check-_<op>
{%
\xint_UDsignfork
@@ -1196,34 +1284,64 @@
}%
\def #4##1##2% \XINT_expr_checkp_<op>
{%
- \ifnum ##1>#7%
+ \ifnum ##1>#6%
\expandafter#4%
- \romannumeral`&&@\csname XINT_#8_op_##2\expandafter\endcsname
+ \romannumeral`&&@\csname XINT_#9_op_##2\expandafter\endcsname
\else
\expandafter ##1\expandafter ##2%
\fi
}%
+ \let #6\xint_c_x
+ \def #7##1% \XINT_expr_checkc_<op>
+ {%
+ \ifnum ##1=\xint_c_x\expandafter#8\fi ##1%
+ }%
+ \edef #8##1##2##3% \XINT_expr_execc_<op>
+ {%
+ \csname XINT_#9_precedence_\string&\string&\endcsname
+ \expandafter\noexpand\csname XINT_#9_itself_\string&\string&\endcsname
+ {##3}%
+ \XINTfstop.{##3}##2%
+ }%
+ \XINT_expr_defbin_d #2% \XINT_expr_exec_<op>
}%
-\def\XINT_expr_defbin_b #1#2#3#4#5#6%
+\def\XINT_expr_defbin_b #1#2%#3%
{%
\expandafter\XINT_expr_defbin_c
\csname XINT_#1_op_#2\expandafter\endcsname
\csname XINT_#1_exec_#2\expandafter\endcsname
\csname XINT_#1_check-_#2\expandafter\endcsname
\csname XINT_#1_checkp_#2\expandafter\endcsname
- \csname XINT_#1_op_-#4\expandafter\endcsname
- \csname #5\expandafter\endcsname
- \csname XINT_expr_precedence_#2\endcsname {#1}#6%
- \expandafter\let
+ \csname XINT_#1_op_-xii\expandafter\endcsname
\csname XINT_expr_precedence_#2\expandafter\endcsname
- \csname xint_c_#3\endcsname
-}%
-\XINT_expr_defbin_b {expr} {..} {vi}{xii}{xintSeq:tl:x}\XINT:NEhook:x:one:from:two
-\XINT_expr_defbin_b {flexpr}{..} {vi}{xii}{xintSeq:tl:x}\XINT:NEhook:x:one:from:two
-\XINT_expr_defbin_b {iiexpr}{..} {vi}{xii}{xintiiSeq:tl:x}\XINT:NEhook:x:one:from:two
-\XINT_expr_defbin_b {expr} {]..}{vi}{xii}{xintSeqB:tl:x}\XINT:NEhook:x:one:from:twoandone
-\XINT_expr_defbin_b {flexpr}{]..}{vi}{xii}{xintSeqB:tl:x}\XINT:NEhook:x:one:from:twoandone
-\XINT_expr_defbin_b {iiexpr}{]..}{vi}{xii}{xintiiSeqB:tl:x}\XINT:NEhook:x:one:from:twoandone
+ \csname XINT_#1_checkc_#2\expandafter\endcsname
+ \csname XINT_#1_execc_#2\endcsname
+ {#1}%#3%
+}%
+\XINT_expr_defbin_b {expr} <\xintLt
+\XINT_expr_defbin_b {flexpr}<\xintLt
+\XINT_expr_defbin_b {iiexpr}<\xintiiLt
+\XINT_expr_defbin_b {expr} >\xintGt
+\XINT_expr_defbin_b {flexpr}>\xintGt
+\XINT_expr_defbin_b {iiexpr}>\xintiiGt
+\XINT_expr_defbin_b {expr} {==}\xintEq
+\XINT_expr_defbin_b {flexpr}{==}\xintEq
+\XINT_expr_defbin_b {iiexpr}{==}\xintiiEq
+\XINT_expr_defbin_b {expr} {<=}\xintLtorEq
+\XINT_expr_defbin_b {flexpr}{<=}\xintLtorEq
+\XINT_expr_defbin_b {iiexpr}{<=}\xintiiLtorEq
+\XINT_expr_defbin_b {expr} {>=}\xintGtorEq
+\XINT_expr_defbin_b {flexpr}{>=}\xintGtorEq
+\XINT_expr_defbin_b {iiexpr}{>=}\xintiiGtorEq
+\XINT_expr_defbin_b {expr} {!=}\xintNotEq
+\XINT_expr_defbin_b {flexpr}{!=}\xintNotEq
+\XINT_expr_defbin_b {iiexpr}{!=}\xintiiNotEq
+\expandafter\let\csname XINT_expr_precedence_=\endcsname\xint_c_x
+\xintFor #1 in {expr, flexpr, iiexpr} \do
+{%
+ \expandafter\let\csname XINT_#1_op_=\expandafter\endcsname
+ \csname XINT_#1_op_==\endcsname
+}%
\def\xintSeq:tl:x #1#2%
{%
\expandafter\XINT_Seq:tl:x
@@ -1332,7 +1450,7 @@
}%
\def\XINT_expr_itself_obracket{obracket}%
\catcode`] 11 \catcode`[ 11
-\def\XINT_tmpa #1#2#3#4#5#6%
+\def\XINT_expr_defbin_c #1#2#3#4#5#6%
{%
\def #1##1%
{%
@@ -1361,8 +1479,9 @@
\fi
}%
}%
-\xintFor #1 in {expr,flexpr,iiexpr} \do {%
- \expandafter\XINT_tmpa
+\def\XINT_expr_defbin_b #1%
+{%
+ \expandafter\XINT_expr_defbin_c
\csname XINT_#1_op_obracket\expandafter\endcsname
\csname XINT_#1_op_]\expandafter\endcsname
\csname XINT_#1_until_cbracket_a\expandafter\endcsname
@@ -1370,11 +1489,14 @@
\csname XINT_#1_op_-xii\endcsname
{#1}%
}%
+\XINT_expr_defbin_b {expr}%
+\XINT_expr_defbin_b {flexpr}%
+\XINT_expr_defbin_b {iiexpr}%
\def\XINT_expr_missing_]
{\XINT_expandableerror{Ooops, looks like we are missing a ] here. Goodbye!}%
\xint_c_ \XINT_expr_done}%
\let\XINT_expr_precedence_]\xint_c_ii
-\def\XINT_tmpa #1#2#3#4#5#6%
+\def\XINT_expr_defbin_c #1#2#3#4#5#6%
{%
\def #1##1% \XINT_expr_op_[
{%
@@ -1409,8 +1531,9 @@
}%
}%
\let\XINT_expr_precedence_[ \xint_c_xx
-\xintFor #1 in {expr,flexpr,iiexpr} \do {%
-\expandafter\XINT_tmpa
+\def\XINT_expr_defbin_b #1%
+{%
+ \expandafter\XINT_expr_defbin_c
\csname XINT_#1_op_[\expandafter\endcsname
\csname XINT_#1_exec_]\expandafter\endcsname
\csname XINT_#1_check-_]\expandafter\endcsname
@@ -1418,8 +1541,11 @@
\csname XINT_#1_op_-xii\endcsname
{#1}%
}%
+\XINT_expr_defbin_b {expr}%
+\XINT_expr_defbin_b {flexpr}%
+\XINT_expr_defbin_b {iiexpr}%
\catcode`] 12 \catcode`[ 12
-\def\XINT_tmpa #1#2#3#4#5#6%
+\def\XINT_expr_defbin_c #1#2#3#4#5#6%
{%
\def #1##1% \XINT_expr_op_:
{%
@@ -1447,14 +1573,18 @@
}%
}%
\let\XINT_expr_precedence_: \xint_c_vi
-\xintFor #1 in {expr,flexpr,iiexpr} \do {%
-\expandafter\XINT_tmpa
+\def\XINT_expr_defbin_b #1%
+{%
+ \expandafter\XINT_expr_defbin_c
\csname XINT_#1_op_:\expandafter\endcsname
\csname XINT_#1_exec_:\expandafter\endcsname
\csname XINT_#1_check-_:\expandafter\endcsname
\csname XINT_#1_checkp_:\expandafter\endcsname
\csname XINT_#1_op_-xii\endcsname {#1}%
}%
+\XINT_expr_defbin_b {expr}%
+\XINT_expr_defbin_b {flexpr}%
+\XINT_expr_defbin_b {iiexpr}%
\def\XINT_ListSel_deeper #1%
{%
\if :#1\xint_dothis\XINT_ListSel_slice_next\fi
@@ -3249,6 +3379,23 @@
{\expandafter#1\expandafter#2\romannumeral0\XINT:NEhook:unpack}%
\let\XINT_flexpr_func_unpack\XINT_expr_func_unpack
\let\XINT_iiexpr_func_unpack\XINT_expr_func_unpack
+\def\XINT_expr_func_flat #1#2%#3%
+{%
+ \expandafter#1\expandafter#2\expanded
+ \XINT:NEhook:x:flatten\XINT:expr:flatten
+}%
+\let\XINT_flexpr_func_flat\XINT_expr_func_flat
+\let\XINT_iiexpr_func_flat\XINT_expr_func_flat
+\let\XINT:NEhook:x:flatten\empty
+\def\XINT_expr_func_zip #1#2%#3%
+{%
+ \expandafter#1\expandafter#2\romannumeral`&&@%
+ \XINT:NEhook:x:zip\XINT:expr:zip
+}%
+\let\XINT_flexpr_func_zip\XINT_expr_func_zip
+\let\XINT_iiexpr_func_zip\XINT_expr_func_zip
+\let\XINT:NEhook:x:zip\empty
+\def\XINT:expr:zip#1{\expandafter{\expanded\XINT_zip_A#1\xint_bye\xint_bye}}%
\def\XINT_tmpa #1#2#3#4#5%
{%
\def #1##1(##2)##3={%
@@ -3920,6 +4067,43 @@
\fi \XINT:expr:toblistwith{##1}{##2}%
}}\expandafter\XINT:NE:x:toblist\string#%
\def\XINT:NE:x:toblist:p\XINT:expr:toblistwith #1#2{{\XINTfstop.{#2}}}%
+\def\XINT:NE:x:flatten#1{%
+\def\XINT:NE:x:flatten\XINT:expr:flatten##1%
+{%
+ \if 0\expandafter\XINT:NE:hastilde\detokenize{##1}~!\relax
+ \expandafter\XINT:NE:hashash \detokenize{##1}#1!\relax 0%
+ \else
+ \expandafter\XINT:NE:x:flatten:p
+ \fi \XINT:expr:flatten{##1}%
+}}\expandafter\XINT:NE:x:flatten\string#%
+\def\XINT:NE:x:flatten:p\XINT:expr:flatten #1%
+{%
+ {{%
+ \detokenize
+ {%
+ \expandafter\XINT:expr:flatten_checkempty
+ \detokenize\expandafter{\expanded{#1}}$XINT_expr_caret%$
+ }%
+ }}%
+}%
+\def\XINT:NE:x:zip#1{%
+\def\XINT:NE:x:zip\XINT:expr:zip##1%
+{%
+ \if 0\expandafter\XINT:NE:hastilde\detokenize{##1}~!\relax
+ \expandafter\XINT:NE:hashash \detokenize{##1}#1!\relax 0%
+ \else
+ \expandafter\XINT:NE:x:zip:p
+ \fi \XINT:expr:zip{##1}%
+}}\expandafter\XINT:NE:x:zip\string#%
+\def\XINT:NE:x:zip:p\XINT:expr:zip #1%
+{%
+ \expandafter{%
+ \detokenize
+ {%
+ \expanded\expandafter\XINT_zip_A\expanded{#1}\xint_bye\xint_bye
+ }%
+ }%
+}%
\def\XINT:NE:x:mapwithin#1{%
\def\XINT:NE:x:mapwithin\XINT:expr:mapwithin ##1##2%
{%
@@ -4040,6 +4224,8 @@
\let\XINT:NEhook:rrseq \XINT:NE:rrseq
\let\XINT:NEhook:iterr \XINT:NE:iterr
\let\XINT:NEhook:x:toblist \XINT:NE:x:toblist
+ \let\XINT:NEhook:x:flatten \XINT:NE:x:flatten
+ \let\XINT:NEhook:x:zip \XINT:NE:x:zip
\let\XINT:NEhook:x:mapwithin \XINT:NE:x:mapwithin
\let\XINT:NEhook:x:ndmapx \XINT:NE:x:ndmapx
\let\XINT:NEhook:userfunc \XINT:NE:userfunc