[latex3-commits] [git/LaTeX3-latex3-latex3] master: Use \:::-based form for \exp_args with more than 9 args (fixes #636) (42fb98c41)

Bruno Le Floch bruno at le-floch.fr
Tue Oct 1 23:29:35 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/42fb98c4110da217a9474a5314d67dde4fddf315

>---------------------------------------------------------------

commit 42fb98c4110da217a9474a5314d67dde4fddf315
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Tue Oct 1 23:29:35 2019 +0200

    Use \:::-based form for \exp_args with more than 9 args (fixes #636)


>---------------------------------------------------------------

42fb98c4110da217a9474a5314d67dde4fddf315
 l3kernel/CHANGELOG.md                    |   4 +
 l3kernel/l3expan.dtx                     |  13 ++-
 l3kernel/testfiles/m3expan002.luatex.tlg | 147 -------------------------------
 l3kernel/testfiles/m3expan002.lvt        |  19 ++++
 l3kernel/testfiles/m3expan002.tlg        |  32 +++++++
 5 files changed, 66 insertions(+), 149 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 47f16cc8c..e95b9204a 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Fixed
+
+- Variants using \exp_args functions with more than 9 arguments (see #636)
+
 ## [2019-09-30]
 
 ### Fixed
diff --git a/l3kernel/l3expan.dtx b/l3kernel/l3expan.dtx
index 06c78048a..9f279de4d 100644
--- a/l3kernel/l3expan.dtx
+++ b/l3kernel/l3expan.dtx
@@ -2556,7 +2556,8 @@
 %   \cs{cs_new_protected:cpn} \cs{use:x} (for protected) or
 %   \cs{cs_new:cpn} \cs{tex_expanded:D} (expandable) and the signature.  If |p|
 %   appears in the signature, or if the function to be defined is
-%   expandable and the primitive \tn{expanded} is not available, call
+%   expandable and the primitive \tn{expanded} is not available, or if there
+%   are more than $8$ arguments, call
 %   some fall-back code that just puts the appropriate |\::| commands.
 %   Otherwise, call \cs{@@_generate_internal_one_go:NNn} to construct
 %   the \cs[no-index]{exp_args:N\dots} function as a macro taking up to
@@ -2588,7 +2589,15 @@
   {
     \cs_new_protected:Npn \@@_generate_internal_variant:NNn ##1##2##3
       {
-        \@@_generate_internal_test:Nw ##2 ##3
+        \if_catcode:w X \use_none:nnnnnnnn ##3
+            \prg_do_nothing: \prg_do_nothing: \prg_do_nothing:
+            \prg_do_nothing: \prg_do_nothing: \prg_do_nothing:
+            \prg_do_nothing: \prg_do_nothing: X
+          \exp_after:wN \@@_generate_internal_test:Nw \exp_after:wN ##2
+        \else:
+          \exp_after:wN \@@_generate_internal_test_aux:w \exp_after:wN #1
+        \fi:
+        ##3
         \q_mark
         {
           \use:x
diff --git a/l3kernel/testfiles/m3expan002.luatex.tlg b/l3kernel/testfiles/m3expan002.luatex.tlg
deleted file mode 100644
index 87e4635e8..000000000
--- a/l3kernel/testfiles/m3expan002.luatex.tlg
+++ /dev/null
@@ -1,147 +0,0 @@
-This is a generated file for the LaTeX (2e + expl3) validation system.
-Don't change this file in any respect.
-Author: Bruno Le Floch
-============================================================
-TEST 1: Trimming trailing letters common between base and variant
-============================================================
-Defining \foo:nnnNN on line ...
-Defining \foo:onnNN on line ...
-Defining \exp_args:Noxvc on line ...
-Defining \foo:oxvcN on line ...
-Defining \exp_args:NonoNc on line ...
-Defining \foo:onoNc on line ...
-Defining \exp_args:Nnonc on line ...
-Defining \foo:noncN on line ...
-Variant \foo:nnnNN already defined; not changing it on line ...
-! LaTeX3 Error: Variant form 'nnnNNN' longer than base signature of
-(LaTeX3)        '\foo:nnnNN'.
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-LaTeX has been asked to create a variant of the function '\foo:nnnNN' with a
-signature starting with 'nnnNNN', but that is longer than the signature (part
-after the colon) of '\foo:nnnNN'.
-undefined
-\protected\long macro:->\exp_args:Noxvc \foo:nnnNN 
-\long macro:->\exp_args:NonoNc \foo:nnnNN 
-\long macro:->\exp_args:Nnonc \foo:nnnNN 
-undefined
-============================================================
-============================================================
-TEST 2: Leaving non-N/n-base letters unchanged is allowed
-============================================================
-Defining \foo:oNnTF on line ...
-Defining \exp_args:NnNo on line ...
-Defining \foo:oNoTF on line ...
-! LaTeX3 Error: Variant form 'oNoT' deprecated for base form '\foo:oNnTF'. One
-(LaTeX3)        should not change an argument from type 'o' to type 'o':
-(LaTeX3)        base form is already a variant.
-Type <return> to continue.
- ...                                              
-l. ...  }
-LaTeX does not know anything more about this error, sorry.
-Try typing <return> to proceed.
-If that doesn't work, type X <return> to quit.
-Defining \exp_args:NnNx on line ...
-Defining \foo:oNxTF on line ...
-! LaTeX3 Error: Variant form 'oNxTF' deprecated for base form '\foo:oNnTF'.
-(LaTeX3)        One should not change an argument from type 'o' to type 'o':
-(LaTeX3)        base form is already a variant.
-Type <return> to continue.
- ...                                              
-l. ...  }
-LaTeX does not know anything more about this error, sorry.
-Try typing <return> to proceed.
-If that doesn't work, type X <return> to quit.
-Defining \foo:ocnTF on line ...
-! LaTeX3 Error: Variant form 'ocnTF' deprecated for base form '\foo:oNnTF'.
-(LaTeX3)        One should not change an argument from type 'o' to type 'o':
-(LaTeX3)        base form is already a variant.
-Type <return> to continue.
- ...                                              
-l. ...  }
-LaTeX does not know anything more about this error, sorry.
-Try typing <return> to proceed.
-If that doesn't work, type X <return> to quit.
-Variant \foo:oNnTF already defined; not changing it on line ...
-! LaTeX3 Error: Variant form 'xNn' invalid for base form '\foo:oNnTF'.
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-LaTeX has been asked to create a variant of the function '\foo:oNnTF' with a
-signature starting with 'xNn', but cannot change an argument from type 'o' to
-type 'x'.
-Variant \foo:oNnTF already defined; not changing it on line ...
-! LaTeX3 Error: Variant form 'n' invalid for base form '\foo:oNnTF'.
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-LaTeX has been asked to create a variant of the function '\foo:oNnTF' with a
-signature starting with 'n', but cannot change an argument from type 'o' to
-type 'n'.
-Variant \foo:oNnTF already defined; not changing it on line ...
-! LaTeX3 Error: Variant form 'oNnTFF' longer than base signature of
-(LaTeX3)        '\foo:oNnTF'.
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-LaTeX has been asked to create a variant of the function '\foo:oNnTF' with a
-signature starting with 'oNnTFF', but that is longer than the signature (part
-after the colon) of '\foo:oNnTF'.
-\long macro:->\exp_args:NnNo \foo:oNnTF 
-\protected\long macro:->\exp_args:NnNx \foo:oNnTF 
-\long macro:->\exp_args:Nnc \foo:oNnTF 
-undefined
-undefined
-undefined
-Defining \foo:NNw on line ...
-Defining \foo:ccw on line ...
-\long macro:->\exp_args:Ncc \foo:NNw 
-============================================================
-============================================================
-TEST 3: Using p arguments
-============================================================
-Defining \exp_args:Ncpo on line ...
-Defining \cs_new:cpo on line ...
-\protected\long macro:->\exp_args:Ncpo \cs_new:Npn 
-\long macro:->\::c \::p \::o \::: 
-Defining \foo_bar:nw on line ...
-\long macro:#1#2\q_stop ->#1
-Defining \exp_args:NNpox on line ...
-Defining \prg_new_conditional:Npox on line ...
-\protected\long macro:->\exp_args:NNpox \prg_new_conditional:Npnn 
-\protected\long macro:->\::N \::p \::o \::x \::: 
-Defining \foo_bar:wF on line ...
-undefined
-\long macro:#1;->\prg_return_true: \exp_end: {}
-Variant \cs_new:Npn already defined; not changing it on line ...
-! LaTeX3 Error: Variant form 'No' invalid for base form '\cs_new:Npn'.
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-LaTeX has been asked to create a variant of the function '\cs_new:Npn' with a
-signature starting with 'No', but cannot change an argument from type 'p' to
-type 'o'.
-undefined
-============================================================
-============================================================
-TEST 4: \exp_args_generate:n 
-============================================================
-undefined,undefined,undefined
-! LaTeX3 Error: Invalid variant specifier 'a' in 'abc'.
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-LaTeX has been asked to create an \exp_args:N... function with signature
-'Nabc' but 'a' is not a valid argument specifier.
-Defining \exp_args:Nfoo on line ...
-Defining \exp_args:Nfox on line ...
-undefined,\long macro:#1#2#3#4->\tex_expanded:D {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{\__kernel_exp_not:w \exp_after:wN {#4}}},\protected\long macro:#1#2#3#4->\use:x {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{#4}}
-\long macro:#1#2#3#4->\tex_expanded:D {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{\__kernel_exp_not:w \exp_after:wN {#4}}},\protected\long macro:#1#2#3#4->\use:x {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{#4}}
-============================================================
diff --git a/l3kernel/testfiles/m3expan002.lvt b/l3kernel/testfiles/m3expan002.lvt
index bff792372..62a6a743b 100644
--- a/l3kernel/testfiles/m3expan002.lvt
+++ b/l3kernel/testfiles/m3expan002.lvt
@@ -81,4 +81,23 @@
     \TYPE { \cs_meaning:N \exp_args:Nfoo , \cs_meaning:N \exp_args:Nfox }
   }
 
+\TEST { \exp_args many~arguments }
+  {
+    \cs_new:Npn \foo:nnnnnnnnnn { } % 10 args
+    \cs_generate_variant:Nn \foo:nnnnnnnnnn { nonononon , nonononono , nVfnoevnno , nVfnoevxno , Vfnoevxo }
+    \TYPE { \cs_meaning:N \exp_args:Nnononono }
+    \TYPE { \cs_meaning:N \exp_args:Nnonononono }
+    \TYPE { \cs_meaning:N \exp_args:NnVfnoevnno }
+    \TYPE { \cs_meaning:N \exp_args:NnVfnoevxno }
+    \TYPE { \cs_meaning:N \exp_args:NVfnoevxo }
+    \exp_args_generate:n { noonoono , noonoonoo , noonoonoofoefoe }
+    \TYPE { \cs_meaning:N \exp_args:Nnoonoono }
+    \TYPE { \cs_meaning:N \exp_args:Nnoonoonoo }
+    \TYPE { \cs_meaning:N \exp_args:Nnoonoonoofoefoe }
+    \exp_args_generate:n { noxnoono , noxnoonoo , noxnoonoofxnxnx }
+    \TYPE { \cs_meaning:N \exp_args:Nnoxnoono }
+    \TYPE { \cs_meaning:N \exp_args:Nnoxnoonoo }
+    \TYPE { \cs_meaning:N \exp_args:Nnoxnoonoofxnxnx }
+  }
+
 \END
diff --git a/l3kernel/testfiles/m3expan002.tlg b/l3kernel/testfiles/m3expan002.tlg
index 87e4635e8..f9f5feeae 100644
--- a/l3kernel/testfiles/m3expan002.tlg
+++ b/l3kernel/testfiles/m3expan002.tlg
@@ -145,3 +145,35 @@ Defining \exp_args:Nfox on line ...
 undefined,\long macro:#1#2#3#4->\tex_expanded:D {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{\__kernel_exp_not:w \exp_after:wN {#4}}},\protected\long macro:#1#2#3#4->\use:x {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{#4}}
 \long macro:#1#2#3#4->\tex_expanded:D {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{\__kernel_exp_not:w \exp_after:wN {#4}}},\protected\long macro:#1#2#3#4->\use:x {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{#4}}
 ============================================================
+============================================================
+TEST 5: \exp_args many arguments
+============================================================
+Defining \foo:nnnnnnnnnn on line ...
+Defining \exp_args:Nnononono on line ...
+Defining \foo:nononononn on line ...
+Defining \exp_args:Nnonononono on line ...
+Defining \foo:nonononono on line ...
+Defining \exp_args:NnVfnoevnno on line ...
+Defining \foo:nVfnoevnno on line ...
+Defining \exp_args:NnVfnoevxno on line ...
+Defining \foo:nVfnoevxno on line ...
+Defining \exp_args:NVfnoevxo on line ...
+Defining \foo:Vfnoevxonn on line ...
+\long macro:#1#2#3#4#5#6#7#8#9->\tex_expanded:D {\exp_not:N #1{\exp_not:n {#2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{\exp_not:n {#4}}{\__kernel_exp_not:w \exp_after:wN {#5}}{\exp_not:n {#6}}{\__kernel_exp_not:w \exp_after:wN {#7}}{\exp_not:n {#8}}{\__kernel_exp_not:w \exp_after:wN {#9}}}
+\long macro:->\::n \::o \::n \::o \::n \::o \::n \::o \::n \::o \::: 
+\long macro:->\::n \::V \::f \::n \::o \::e \::v \::n \::n \::o \::: 
+\protected\long macro:->\::n \::V \::f \::n \::o \::e \::v \::x \::n \::o \::: 
+\protected\long macro:#1#2#3#4#5#6#7#8#9->\use:x {\exp_not:N #1{\__kernel_exp_not:w \exp_after:wN {\exp:w \__exp_eval_register:N #2}}{\__kernel_exp_not:w \exp_after:wN {\exp:w \exp_end_continue_f:w #3}}{\exp_not:n {#4}}{\__kernel_exp_not:w \exp_after:wN {#5}}{\__kernel_exp_not:w \tex_expanded:D {{#6}}}{\__kernel_exp_not:w \exp_after:wN {\exp:w \__exp_eval_register:c {#7}}}{#8}{\__kernel_exp_not:w \exp_after:wN {#9}}}
+Defining \exp_args:Nnoonoono on line ...
+Defining \exp_args:Nnoonoonoo on line ...
+Defining \exp_args:Nnoonoonoofoefoe on line ...
+\long macro:#1#2#3#4#5#6#7#8#9->\tex_expanded:D {\exp_not:N #1{\exp_not:n {#2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{\__kernel_exp_not:w \exp_after:wN {#4}}{\exp_not:n {#5}}{\__kernel_exp_not:w \exp_after:wN {#6}}{\__kernel_exp_not:w \exp_after:wN {#7}}{\exp_not:n {#8}}{\__kernel_exp_not:w \exp_after:wN {#9}}}
+\long macro:->\::n \::o \::o \::n \::o \::o \::n \::o \::o \::: 
+\long macro:->\::n \::o \::o \::n \::o \::o \::n \::o \::o \::f \::o \::e \::f \::o \::e \::: 
+Defining \exp_args:Nnoxnoono on line ...
+Defining \exp_args:Nnoxnoonoo on line ...
+Defining \exp_args:Nnoxnoonoofxnxnx on line ...
+\protected\long macro:#1#2#3#4#5#6#7#8#9->\use:x {\exp_not:N #1{\exp_not:n {#2}}{\__kernel_exp_not:w \exp_after:wN {#3}}{#4}{\exp_not:n {#5}}{\__kernel_exp_not:w \exp_after:wN {#6}}{\__kernel_exp_not:w \exp_after:wN {#7}}{\exp_not:n {#8}}{\__kernel_exp_not:w \exp_after:wN {#9}}}
+\protected\long macro:->\::n \::o \::x \::n \::o \::o \::n \::o \::o \::: 
+\protected\long macro:->\::n \::o \::x \::n \::o \::o \::n \::o \::o \::f \::x \::n \::x \::n \::x \::: 
+============================================================





More information about the latex3-commits mailing list