[latex3-commits] [git/latex3] master: Forbid jumping over non N/n type arguments (see #418) (1543003)
Bruno Le Floch
bruno at le-floch.fr
Mon Nov 27 23:20:51 CET 2017
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/1543003e7161eb2a1a94cb7b382590cf3631b324
>---------------------------------------------------------------
commit 1543003e7161eb2a1a94cb7b382590cf3631b324
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Mon Nov 27 17:09:08 2017 -0500
Forbid jumping over non N/n type arguments (see #418)
This commit forbids \cs_generate_variant:Nn \foo:on { ox } and similar
cases where an identical letter, other than N,n,T,F,p, appears in the
base form and the requested variant.
>---------------------------------------------------------------
1543003e7161eb2a1a94cb7b382590cf3631b324
l3kernel/l3expan.dtx | 11 +++++++++++
l3kernel/testfiles/m3expan002.tlg | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/l3kernel/l3expan.dtx b/l3kernel/l3expan.dtx
index 5e347e9..7216ff4 100644
--- a/l3kernel/l3expan.dtx
+++ b/l3kernel/l3expan.dtx
@@ -1809,6 +1809,17 @@
\cs_new:Npn \@@_generate_variant_loop_same:w
#1 \prg_do_nothing: #2#3#4
{
+ \if:w N #2 \else:
+ \if:w n #2 \else:
+ \if:w p #2 \else:
+ \if:w T #2 \else:
+ \if:w F #2 \else:
+ \@@_generate_variant_loop_special:NNwNNnn #2#2
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+ \fi:
#3 { #1 \@@_generate_variant_same:N #2 }
}
\cs_new:Npn \@@_generate_variant_loop_end:nwwwNNnn
diff --git a/l3kernel/testfiles/m3expan002.tlg b/l3kernel/testfiles/m3expan002.tlg
index 0998bf0..06f25e0 100644
--- a/l3kernel/testfiles/m3expan002.tlg
+++ b/l3kernel/testfiles/m3expan002.tlg
@@ -43,9 +43,24 @@ 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 ...
+*************************************************
+* LaTeX warning: "kernel/invalid-variant"
+*
+* Variant form 'oNoT' invalid for base form '\foo:oNnTF'.
+*************************************************
Defining \exp_args:NnNx on line ...
Defining \foo:oNxTF on line ...
+*************************************************
+* LaTeX warning: "kernel/invalid-variant"
+*
+* Variant form 'oNxTF' invalid for base form '\foo:oNnTF'.
+*************************************************
Defining \foo:ocnTF on line ...
+*************************************************
+* LaTeX warning: "kernel/invalid-variant"
+*
+* Variant form 'ocnTF' invalid for base form '\foo:oNnTF'.
+*************************************************
Variant \foo:oNnTF already defined; not changing it on line ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -103,6 +118,11 @@ l. ... }
| signature starting with 'oNnTFF', but that is longer than the signature
| (part after the colon) of '\foo:oNnTF'.
|...............................................
+*************************************************
+* LaTeX warning: "kernel/invalid-variant"
+*
+* Variant form 'oNnTFF' invalid for base form '\foo:oNnTF'.
+*************************************************
\long macro:->\exp_args:NnNo \foo:oNnTF
\protected\long macro:->\exp_args:NnNx \foo:oNnTF
\long macro:->\exp_args:Nnc \foo:oNnTF
More information about the latex3-commits
mailing list