[latex3-commits] [latex3/latex3] main: cs yields 16 (bc8902c7b)

github at latex-project.org github at latex-project.org
Sun Oct 15 22:04:00 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/bc8902c7b44723024bee40330831bd07da13c167

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

commit bc8902c7b44723024bee40330831bd07da13c167
Author: Jonathan Spratte <jspratte at yahoo.de>
Date:   Fri May 19 21:44:31 2023 +0200

    cs yields 16


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

bc8902c7b44723024bee40330831bd07da13c167
 l3kernel/l3token.dtx              | 12 ++++++------
 l3kernel/testfiles/m3token002.lvt |  6 ++++++
 l3kernel/testfiles/m3token002.tlg |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/l3kernel/l3token.dtx b/l3kernel/l3token.dtx
index b0650bdaa..7ccef53b6 100644
--- a/l3kernel/l3token.dtx
+++ b/l3kernel/l3token.dtx
@@ -486,11 +486,11 @@
 %     \cs{token_to_catcode:N} \meta{token}
 %   \end{syntax}
 %   Converts the given \meta{token} into a number describing its category code.
-%   If \meta{token} is a macro this expands to $13$. This can't detect the
-%   categories $0$ (escape character), $5$ (end of line), $9$ (ignored
-%   character), $14$ (comment character), or $15$ (invalid character). Control
-%   sequences or active characters let to a token of one of the detectable
-%   category codes will yield that category.
+%   If \meta{token} is a control sequence this expands to $16$. This can't
+%   detect the categories $0$ (escape character), $5$ (end of line), $9$
+%   (ignored character), $14$ (comment character), or $15$ (invalid character).
+%   Control sequences or active characters let to a token of one of the
+%   detectable category codes will yield that category.
 % \end{function}
 %
 % \section{Token conditionals}
@@ -1927,7 +1927,7 @@
                       \if_catcode:w \exp_not:N #1 \c_space_token
                         10
                       \else:
-                        13
+                        \token_if_cs:NTF #1 { 16 } { 13 }
                       \fi:
                     \fi:
                   \fi:
diff --git a/l3kernel/testfiles/m3token002.lvt b/l3kernel/testfiles/m3token002.lvt
index a3c521f19..8b4518ab0 100644
--- a/l3kernel/testfiles/m3token002.lvt
+++ b/l3kernel/testfiles/m3token002.lvt
@@ -367,6 +367,8 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \OMIT
+\group_begin:
+\char_set_catcode_active:N \~
 \cs_undefine:N \undefined_control_sequence:
 \cs_generate_variant:Nn \token_to_catcode:N { c }
 \TIMO
@@ -383,6 +385,7 @@
   \token_to_catcode:c { @sptoken },
   \token_to_catcode:N a,
   \token_to_catcode:N +,
+  \token_to_catcode:N ~,
   \token_to_catcode:N \prg_do_nothing:,
   \token_to_catcode:N \relax,
   \token_to_catcode:N \if:w,
@@ -390,6 +393,9 @@
   \token_to_catcode:N \else:,
   \token_to_catcode:N \undefined_control_sequence:
 }
+\OMIT
+\group_end:
+\TIMO
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
diff --git a/l3kernel/testfiles/m3token002.tlg b/l3kernel/testfiles/m3token002.tlg
index 3016eb3ce..2ff4e40ba 100644
--- a/l3kernel/testfiles/m3token002.tlg
+++ b/l3kernel/testfiles/m3token002.tlg
@@ -349,5 +349,5 @@ undefined, undefined, undefined, \relax, \relax, \meaning
 ============================================================
 TEST 31: token_to_catcode
 ============================================================
-1,2,3,4,5,6,7,8,9,10,11,12,13,13,13,13,13,13
+1,2,3,4,5,6,7,8,9,10,11,12,13,16,16,16,16,16,16
 ============================================================





More information about the latex3-commits mailing list.