[latex3-commits] [git/LaTeX3-latex3-latex3] morechk: improve cs_use/tl_use when expanding (3a6fa1a)

Will Robertson wspr81 at gmail.com
Mon Apr 15 15:08:04 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : morechk
Link       : https://github.com/latex3/latex3/commit/3a6fa1a4d686185d159a91caa3e2bffd30e16ad7

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

commit 3a6fa1a4d686185d159a91caa3e2bffd30e16ad7
Author: Will Robertson <wspr81 at gmail.com>
Date:   Mon Apr 15 22:38:04 2019 +0930

    improve cs_use/tl_use when expanding


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

3a6fa1a4d686185d159a91caa3e2bffd30e16ad7
 l3kernel/l3basics.dtx |   39 ++++++++++++++++++++++++++++++++++-----
 l3kernel/l3tl.dtx     |    5 +++--
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
index d9b4140..c9f22ff 100644
--- a/l3kernel/l3basics.dtx
+++ b/l3kernel/l3basics.dtx
@@ -1824,22 +1824,37 @@
                   { \token_to_str:N ##1 }
               }
           }
-        \cs_set:Npn \__kernel_chk_exp_cs_exist:N ##1
+
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:NTF ##1 ##2 ##3
           {
             \@@_suspended:T \use_none:nnn
-            \cs_if_exist:NF ##1
+            \cs_if_exist:NTF ##1
+              { ##2 }
               {
                 \__kernel_msg_expandable_error:nnn
                   { kernel } { command-erroneous } { ##1 }
+                ##3
               }
           }
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:NT ##1 ##2
+          {
+            \__kernel_chk_exp_cs_exist:NTF ##1 { ##2 } { }
+          }
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:NF ##1 ##2
+          {
+            \__kernel_chk_exp_cs_exist:NTF ##1 { } { ##2 }
+          }
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:N ##1
+          {
+            \__kernel_chk_exp_cs_exist:NTF ##1 { } { }
+          }
+
         \cs_set:Npn \__kernel_chk_exp_var_exist:NTF ##1 ##2 ##3
           {
             \@@_suspended:T \use_none:nnnn
             \cs_if_exist:NTF ##1
               { ##2 }
               {
-                ##3
                 \__kernel_msg_expandable_error:nnn
                   { kernel } { variable-not-defined } { ##1 }
                 ##3
@@ -1880,6 +1895,9 @@
         \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 { }
         \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 { }
         \cs_set:Npn \__kernel_chk_exp_cs_exist:N  ##1 { }
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:NT  ##1##2 { ##2 }
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:NF  ##1##2 { }
+        \cs_set:Npn \__kernel_chk_exp_cs_exist:NTF  ##1##2##3 { ##2 }
         \cs_set:Npn \__kernel_chk_exp_var_exist:N  ##1 { }
         \cs_set:Npn \__kernel_chk_exp_var_exist:NT ##1##2 { ##2 }
         \cs_set:Npn \__kernel_chk_exp_var_exist:NF ##1##2 { }
@@ -1894,10 +1912,20 @@
       { \exp_args:Nc \__kernel_chk_var_exist:N }
     \cs_set:Npn \__kernel_chk_exp_cs_exist:c
       { \exp_args:Nc \__kernel_chk_exp_cs_exist:N }
+    \cs_set:Npn \__kernel_chk_exp_cs_exist:cT
+      { \exp_args:Nc \__kernel_chk_exp_cs_exist:NT }
+    \cs_set:Npn \__kernel_chk_exp_cs_exist:cF
+      { \exp_args:Nc \__kernel_chk_exp_cs_exist:NF }
+    \cs_set:Npn \__kernel_chk_exp_cs_exist:cTF
+      { \exp_args:Nc \__kernel_chk_exp_cs_exist:NTF }
+    \cs_set:Npn \__kernel_chk_exp_cs_exist:cT
+      { \exp_args:Nc \__kernel_chk_exp_cs_exist:NT }
     \cs_set:Npn \__kernel_chk_exp_var_exist:c
       { \exp_args:Nc \__kernel_chk_exp_var_exist:N }
     \cs_set:Npn \__kernel_chk_exp_var_exist:cF
       { \exp_args:Nc \__kernel_chk_exp_var_exist:NF }
+    \cs_set:Npn \__kernel_chk_exp_var_exist:cTF
+      { \exp_args:Nc \__kernel_chk_exp_var_exist:NTF }
     \tex_ifodd:D \l at expl@check at declarations@bool
       \use:c { @@_check-declarations_on: }
     \else:
@@ -2859,11 +2887,12 @@
   {
     \cs_set:Npn \cs_use:N #1
       {
-        \exp:w \__kernel_chk_exp_cs_exist:N #1 \exp_after:wN \exp_end: #1
+        \exp:w \__kernel_chk_exp_cs_exist:NTF #1 { \exp_after:wN \exp_end: #1 }
+                                                 { \exp_after:wN \exp_end:    }
       }
     \cs_set:Npn \cs_use:c #1
       {
-        \cs:w \__kernel_chk_exp_cs_exist:c {#1} #1 \cs_end:
+        \cs:w \__kernel_chk_exp_cs_exist:cTF {#1} {#1} {empty} \cs_end:
       }
   }
   {
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index ad3bb82..1878866 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -2444,11 +2444,12 @@
   {
     \cs_new:Npn \tl_use:N #1
       {
-        \exp:w \__kernel_chk_exp_var_exist:N #1 \exp_after:wN \exp_end: #1
+        \exp:w \__kernel_chk_exp_var_exist:NTF #1 { \exp_after:wN \exp_end: #1 }
+                                                  { \exp_after:wN \exp_end:    }
       }
     \cs_new:Npn \tl_use:c #1
       {
-        \cs:w \__kernel_chk_exp_var_exist:c {#1} #1 \cs_end:
+        \cs:w \__kernel_chk_exp_var_exist:cTF {#1} {#1} {empty} \cs_end:
       }
   }
   {





More information about the latex3-commits mailing list