[latex3-commits] [l3svn] 01/04: Reduce use of \tl_to_lowercase:n

noreply at latex-project.org noreply at latex-project.org
Wed Sep 23 14:42:10 CEST 2015


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit d3131afecce2033dd5d5d6b2a6181069cf614cb9
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Sep 23 09:17:06 2015 +0100

    Reduce use of \tl_to_lowercase:n
    
    Not every use is removed here as there is one that needs other
    changes. Note that most are simply converted to \tex_lowercase:D,
    which is OK in l3kernel and covers the bootstrap/edge case situation.
---
 l3kernel/l3candidates.dtx |   14 +++-----
 l3kernel/l3doc.dtx        |    2 +-
 l3kernel/l3file.dtx       |    2 +-
 l3kernel/l3fp-parse.dtx   |   60 ++++++++++++++++-----------------
 l3kernel/l3keys.dtx       |   36 ++++++++++----------
 l3kernel/l3msg.dtx        |    4 +--
 l3kernel/l3tl.dtx         |    4 +--
 l3kernel/l3token.dtx      |   82 ++++++++++++++++++++++-----------------------
 8 files changed, 97 insertions(+), 107 deletions(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index aba3ef9..a007b70 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -4598,12 +4598,7 @@
 %   \cs{@@_token_generic:NNTF} function.
 %    \begin{macrocode}
 \group_begin:
-  \char_set_catcode_other:N \O
-  \char_set_catcode_other:N \U
-  \char_set_catcode_other:N \T
-  \char_set_catcode_other:N \E
-  \char_set_catcode_other:N \R
-  \tl_to_lowercase:n
+  \cs_set_protected:Npn \@@_tmp:w #1 \q_stop
     {
       \cs_new_protected_nopar:Npn \@@_execute_branches_N_type:
         {
@@ -4615,16 +4610,17 @@
             \exp_after:wN \@@_N_type:w
               \token_to_meaning:N \l_peek_token
               \q_mark \@@_N_type_aux:nnw
-              OUTER \q_mark \use_none_delimit_by_q_stop:w
+              #1 \q_mark \use_none_delimit_by_q_stop:w
               \q_stop
             \exp_after:wN \@@_true:w
           \else:
             \exp_after:wN \@@_false:w
           \fi:
         }
-      \cs_new_protected:Npn \@@_N_type:w #1 OUTER #2 \q_mark #3
-        { #3 {#1} {#2} }
+      \cs_new_protected:Npn \@@_N_type:w ##1 #1 ##2 \q_mark ##3
+        { ##3 {##1} {##2} }
     }
+  \exp_after:wN \@@_tmp:w \tl_to_str:n { outer } \q_stop
 \group_end:
 \cs_new_protected:Npn \@@_N_type_aux:nnw #1 #2 #3 \fi:
   {
diff --git a/l3kernel/l3doc.dtx b/l3kernel/l3doc.dtx
index 8f5bfc3..4649f6e 100644
--- a/l3kernel/l3doc.dtx
+++ b/l3kernel/l3doc.dtx
@@ -2984,7 +2984,7 @@ Do not distribute a modified version of this file.
   \char_set_lccode:nn { `\^^B } { `\\ }
   \char_set_lccode:nn { `\^^L } { `\{ }
   \char_set_lccode:nn { `\^^R } { `\} }
-  \tl_to_lowercase:n
+  \tex_lowercase:D
     {
       \group_end:
       \cs_set_protected:Npn \xmacro at code
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 445c7ee..f4db82d 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -1548,7 +1548,7 @@
 \group_begin:
   \char_set_catcode_other:N \*
   \char_set_lccode:nn {`\*} {`\ }
-  \tl_to_lowercase:n { \tl_const:Nn \c_catcode_other_space_tl { * } }
+  \tex_lowercase:D { \tl_const:Nn \c_catcode_other_space_tl { * } }
 \group_end:
 %    \end{macrocode}
 % \end{macro}
diff --git a/l3kernel/l3fp-parse.dtx b/l3kernel/l3fp-parse.dtx
index b07048f..3cc51d2 100644
--- a/l3kernel/l3fp-parse.dtx
+++ b/l3kernel/l3fp-parse.dtx
@@ -626,20 +626,17 @@
 %   the first |s__fp|.  If the \meta{token} does not contain that
 %   string, the result is |_?|.
 %    \begin{macrocode}
-\group_begin:
-\char_set_catcode_other:N \S
-\char_set_catcode_other:N \F
-\char_set_catcode_other:N \P
-\char_set_lccode:nn { `\- } { `\_ }
-\tl_to_lowercase:n
-  {
-    \group_end:
-    \cs_new:Npn \@@_type_from_scan:N #1
-      {
-        \exp_after:wN \@@_type_from_scan:w
-        \token_to_str:N #1 \q_mark S--FP-? \q_mark \q_stop
-      }
-    \cs_new:Npn \@@_type_from_scan:w #1 S--FP #2 \q_mark #3 \q_stop {#2}
+\cs_new:Npx \@@_type_from_scan:N #1
+  {
+    \exp_not:N \exp_after:wN \exp_not:N \@@_type_from_scan:w
+    \exp_not:N \token_to_str:N #1 \exp_not:N \q_mark
+      \tl_to_str:n { s__fp _? } \exp_not:N \q_mark \exp_not:N \q_stop
+  }
+\use:x
+  {
+    \cs_new:Npn \exp_not:N \@@_type_from_scan:w
+      ##1 \tl_to_str:n { s__fp } ##2 \exp_not:N \q_mark ##3 \exp_not:N \q_stop
+      {##2}
   }
 %    \end{macrocode}
 % \end{macro}
@@ -843,28 +840,27 @@
         \exp_after:wN \@@_parse_exponent:N
         \exp:w \@@_parse_expand:w
   }
-\group_begin:
-\char_set_catcode_other:N \P
-\char_set_catcode_other:N \T
-\char_set_catcode_other:N \M
-\char_set_catcode_other:N \U
-\tl_to_lowercase:n
-  {
-    \group_end:
-    \cs_new:Npn \@@_parse_one_register_aux:Nw #1
+\cs_new:Npx \@@_parse_one_register_aux:Nw #1
+  {
+    \exp_not:n
       {
         \exp_after:wN \use:nn
         \exp_after:wN \@@_parse_one_register_auxii:wwwNw
-        \exp_after:wN { \tex_the:D #1 }
-          ; \@@_parse_one_register_dim:ww
-          PT ; \@@_parse_one_register_mu:www
-          . PT ; \@@_parse_one_register_int:www
-          \q_stop
       }
-    \cs_new:Npn \@@_parse_one_register_auxii:wwwNw
-        #1 . #2 PT #3 ; #4#5 \q_stop { #4 #1.#2; }
-    \cs_new:Npn \@@_parse_one_register_mu:www #1 MU; #2;
-      { \@@_parse_one_register_dim:ww #1; }
+    \exp_not:N \exp_after:wN { \exp_not:N \tex_the:D #1 }
+      ; \exp_not:N \@@_parse_one_register_dim:ww
+      \tl_to_str:n { pt } ; \exp_not:N \@@_parse_one_register_mu:www
+      . \tl_to_str:n { pt } ; \exp_not:N \@@_parse_one_register_int:www
+      \exp_not:N \q_stop
+  }
+\use:x
+  {
+    \cs_new:Npn \exp_not:N \@@_parse_one_register_auxii:wwwNw
+        ##1 . ##2 \tl_to_str:n { pt } ##3 ; ##4##5 \exp_not:N \q_stop
+        { ##4 ##1.##2; }
+    \cs_new:Npn \exp_not:N \@@_parse_one_register_mu:www
+      ##1 \tl_to_str:n { mu } ; ##2 ;
+      { \exp_not:N \@@_parse_one_register_dim:ww ##1 ; }
   }
 \cs_new:Npn \@@_parse_one_register_int:www #1; #2.; #3;
   { \@@_parse:n { #1 e #3 } }
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index ea3199e..3657345 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -912,24 +912,24 @@
 \group_begin:
   \char_set_catcode_active:n { `\= }
   \char_set_catcode_active:n { `\, }
-  \char_set_lccode:nn { `\8 } { `\= }
-  \char_set_lccode:nn { `\9 } { `\, }
-\tl_to_lowercase:n
-  {
-    \group_end:
-    \cs_new_protected:Npn \@@_parse:n #1
-      {
-        \group_begin:
-          \tl_set:Nn \l_@@_sanitise_tl {#1}
-          \tl_replace_all:Nnn \l_@@_sanitise_tl { = } { 8 }
-          \tl_replace_all:Nnn \l_@@_sanitise_tl { , } { 9 }
-          \tl_clear:N \l_@@_parse_tl
-          \exp_after:wN \@@_parse_elt:w \exp_after:wN
-            \q_nil \l_@@_sanitise_tl 9 \q_recursion_tail 9 \q_recursion_stop
-        \exp_after:wN \group_end:
-        \l_@@_parse_tl
-      }
-  }
+  \cs_new_protected:Npx \@@_parse:n #1
+    {
+      \group_begin:
+        \tl_set:Nn \exp_not:N \l_@@_sanitise_tl {#1}
+        \tl_replace_all:Nnn \exp_not:N \l_@@_sanitise_tl
+          { \exp_not:N = } { \token_to_str:N = }
+        \tl_replace_all:Nnn \exp_not:N \l_@@_sanitise_tl
+          { \exp_not:N , } { \token_to_str:N , }
+        \tl_clear:N \exp_not:N \l_@@_parse_tl
+        \exp_not:N \exp_after:wN
+          \exp_not:N \@@_parse_elt:w \exp_not:N \exp_after:wN
+          \exp_not:N \q_nil \exp_not:N \l_@@_sanitise_tl
+          \token_to_str:N , \exp_not:N \q_recursion_tail
+            \token_to_str:N , \exp_not:N \q_recursion_stop
+      \exp_not:N \exp_after:wN \group_end:
+      \exp_not:N \l_@@_parse_tl
+    }
+\group_end:
 %    \end{macrocode}
 % \end{macro}
 %
diff --git a/l3kernel/l3msg.dtx b/l3kernel/l3msg.dtx
index e256756..dd632c6 100644
--- a/l3kernel/l3msg.dtx
+++ b/l3kernel/l3msg.dtx
@@ -1060,7 +1060,7 @@
   \char_set_lccode:nn {`\}} {`\ }
   \char_set_lccode:nn {`\&} {`\!}
   \char_set_catcode_active:N \&
-\tl_to_lowercase:n
+\tex_lowercase:D
   {
     \group_end:
     \cs_new_protected:Npn \@@_interrupt_text:n #1
@@ -2013,7 +2013,7 @@
 \char_set_lccode:nn { `L } { `L }
 \char_set_lccode:nn { `T } { `T }
 \char_set_lccode:nn { `X } { `X }
-\tl_to_lowercase:n
+\tex_lowercase:D
   {
     \cs_new:Npx \@@_expandable_error:n #1
       {
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index 20a7b25..c4a624a 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -1612,7 +1612,7 @@
         { \use_ii:nn }
         {
           \char_set_lccode:nn { 0 } { \tex_newlinechar:D }
-          \tl_to_lowercase:n { \@@_set_rescan:NnTF ^^@ } {#1}
+          \tex_lowercase:D { \@@_set_rescan:NnTF ^^@ } {#1}
         }
           { \@@_set_rescan_multi:n }
           { \@@_set_rescan_single:nn { ' } }
@@ -1629,7 +1629,7 @@
           \int_compare:nNnTF { `#1 } < { `\~ }
             {
               \char_set_lccode:nn { 0 } { `#1 + 1 }
-              \tl_to_lowercase:n { \@@_set_rescan_single:nn { ^^@ } }
+              \tex_lowercase:D { \@@_set_rescan_single:nn { ^^@ } }
             }
             { \@@_set_rescan_single_aux:nn { } }
         }
diff --git a/l3kernel/l3token.dtx b/l3kernel/l3token.dtx
index 313380d..696de2f 100644
--- a/l3kernel/l3token.dtx
+++ b/l3kernel/l3token.dtx
@@ -1049,7 +1049,7 @@
   {
     \group_begin:
     \char_set_lccode:nn { 0 } {#1}
-    \tl_to_lowercase:n
+    \tex_lowercase:D
       { \group_end: \@@_set_catcode:Nn ^^@ } {#2}
    }
 \tex_catcode:D \c_zero = \c_thirteen
@@ -1068,7 +1068,7 @@
       {
         \group_begin:
         \char_set_lccode:nn { 0 } { `#1 }
-        \tl_to_lowercase:n
+        \tex_lowercase:D
           {
             \group_end:
             \seq_if_in:NnF \l_char_active_seq { ^^@ }
@@ -1605,25 +1605,22 @@
 %   cannot contain |ma|, regardless of the escape character, even if
 %   the escape character is |m|\ldots{}
 %
-%   Both |ma| and |:| must be of category code $12$ (other), and we
-%   achieve using the standard lowercasing technique.
+%   Both |ma| and |:| must be of category code $12$ (other), so are
+%   detokenized.
 %
 %    \begin{macrocode}
-\group_begin:
-\char_set_catcode_other:N \M
-\char_set_catcode_other:N \A
-\char_set_lccode:nn { `\; } { `\: }
-\char_set_lccode:nn { `\T } { `\T }
-\char_set_lccode:nn { `\F } { `\F }
-\tl_to_lowercase:n
+\use:x
   {
-    \group_end:
-    \prg_new_conditional:Npnn \token_if_macro:N #1 { p , T ,  F , TF }
+    \prg_new_conditional:Npnn \exp_not:N \token_if_macro:N ##1
+      { p , T ,  F , TF }
       {
-        \exp_after:wN \@@_if_macro_p:w
-        \token_to_meaning:N #1 MA; \q_stop
+        \exp_not:N \exp_after:wN \exp_not:N \@@_if_macro_p:w
+        \exp_not:N \token_to_meaning:N ##1 \tl_to_str:n { ma : }
+          \exp_not:N \q_stop
       }
-    \cs_new:Npn \@@_if_macro_p:w #1 MA #2 ; #3 \q_stop
+    \cs_new:Npn \exp_not:N  \@@_if_macro_p:w
+      ##1 \tl_to_str:n { ma } ##2 \c_colon_str ##3 \exp_not:N \q_stop
+  }
       {
         \if_int_compare:w \__str_if_eq_x:nn { #2 } { cro } = \c_zero
             \prg_return_true:
@@ -1631,7 +1628,6 @@
             \prg_return_false:
         \fi:
       }
-  }
 %    \end{macrocode}
 %  \end{macro}
 %  \end{macro}
@@ -1710,7 +1706,7 @@
 %   We convert the token list to lower case and restore the catcode and
 %   lowercase code changes.
 %    \begin{macrocode}
-\tl_to_lowercase:n
+\tex_lowercase:D
   {
     \group_end:
 %    \end{macrocode}
@@ -1900,7 +1896,7 @@
       }
     \cs_new:Npn \@@_if_long_macro:w #1 LOXG~MACRO #2 \q_stop { #1 ~ }
 %    \end{macrocode}
-% Finally the \cs{tl_to_lowercase:n} ends!
+% Finally the \cs{tex_lowercase:D} ends!
 %    \begin{macrocode}
   }
 %    \end{macrocode}
@@ -1960,29 +1956,31 @@
 %
 %    \begin{macrocode}
 \tex_chardef:D \c_token_A_int = `A ~ %
-\group_begin:
-\char_set_catcode_other:N \;
-\char_set_lccode:nn { `\; } { `\: }
-\char_set_lccode:nn { `\T } { `\T }
-\char_set_lccode:nn { `\F } { `\F }
-\tl_to_lowercase:n {
-  \group_end:
-  \prg_new_conditional:Npnn \token_if_primitive:N #1 { p , T , F , TF }
-    {
-      \token_if_macro:NTF #1
-        \prg_return_false:
-        {
-          \exp_after:wN \@@_if_primitive:NNw
-          \token_to_meaning:N #1 ; ; ; \q_stop #1
-        }
-    }
-  \cs_new:Npn \@@_if_primitive:NNw #1#2 #3 ; #4 \q_stop
-    {
-      \tl_if_empty:oTF { \@@_if_primitive_space:w #3 ~ }
-        { \@@_if_primitive_loop:N #3 ; \q_stop }
-        { \@@_if_primitive_nullfont:N }
-    }
-}
+\use:x
+  {
+    \prg_new_conditional:Npnn \exp_not:N \token_if_primitive:N ##1
+      { p , T , F , TF }
+      {
+        \exp_not:N \token_if_macro:NTF ##1
+          \exp_not:N \prg_return_false:
+          {
+            \exp_not:N \exp_after:wN \exp_not:N \@@_if_primitive:NNw
+            \exp_not:N \token_to_meaning:N ##1
+              \tl_to_str:n { : : : } \exp_not:N \q_stop ##1
+          }
+      }
+    \cs_new:Npn \exp_not:N \@@_if_primitive:NNw
+      ##1##2 ##3 \c_colon_str ##4 \exp_not:N \q_stop
+      {
+        \exp_not:N \tl_if_empty:oTF
+          { \exp_not:N \@@_if_primitive_space:w ##3 ~ }
+          {
+            \exp_not:N \@@_if_primitive_loop:N ##3
+              \c_colon_str \exp_not:N \q_stop
+          }
+          { \exp_not:N \@@_if_primitive_nullfont:N }
+      }
+  }
 \cs_new:Npn \@@_if_primitive_space:w #1 ~ { }
 \cs_new:Npn \@@_if_primitive_nullfont:N #1
   {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list