[latex3-commits] [l3svn] r7359 - Enforce that \cC can only be followed by a match-all dot (or group)

noreply at latex-project.org noreply at latex-project.org
Thu Jul 13 15:24:24 CEST 2017


Author: bruno
Date: 2017-07-13 15:24:24 +0200 (Thu, 13 Jul 2017)
New Revision: 7359

Modified:
   trunk/l3kernel/l3regex.dtx
   trunk/l3kernel/testfiles/m3expl001.luatex.tlg
   trunk/l3kernel/testfiles/m3expl001.ptex.tlg
   trunk/l3kernel/testfiles/m3expl001.tlg
   trunk/l3kernel/testfiles/m3expl001.uptex.tlg
   trunk/l3kernel/testfiles/m3expl001.xetex.tlg
   trunk/l3kernel/testfiles/m3expl003.luatex.tlg
   trunk/l3kernel/testfiles/m3expl003.ptex.tlg
   trunk/l3kernel/testfiles/m3expl003.tlg
   trunk/l3kernel/testfiles/m3expl003.uptex.tlg
   trunk/l3kernel/testfiles/m3expl003.xetex.tlg
   trunk/l3kernel/testfiles/m3regex009.lvt
   trunk/l3kernel/testfiles/m3regex009.tlg
Log:
Enforce that \cC can only be followed by a match-all dot (or group)


Modified: trunk/l3kernel/l3regex.dtx
===================================================================
--- trunk/l3kernel/l3regex.dtx	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/l3regex.dtx	2017-07-13 13:24:24 UTC (rev 7359)
@@ -680,7 +680,6 @@
 %   \item Test for the maximum register \cs{c_max_register_int}.
 %   \item Find out whether the fact that |\W| and friends match the
 %     end-marker leads to bugs. Possibly update \cs{__regex_item_reverse:n}.
-%   \item Enforce that |\cC| can only be followed by a match-all dot.
 %   \item The empty cs should be matched by |\c{}|, not by
 %     |\c{csname.?endcsname\s?}|.
 % \end{itemize}
@@ -3005,6 +3004,7 @@
                 \else:
                   \c_@@_catcode_in_class_mode_int
                 \fi:
+            \token_if_eq_charcode:NNT C #2 { \@@_compile_c_C:NN }
           }
       }
       { \cs_if_exist_use:cF { @@_compile_c_#2:w } }
@@ -3016,6 +3016,26 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[aux]{\@@_compile_c_C:NN}
+%   If |\cC| is not followed by |.| or |(...)| then complain because
+%   that construction cannot match anything, except in cases like
+%   |\cC[\c{...}]|, where it has no effect.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_compile_c_C:NN #1#2
+  {
+    \token_if_eq_meaning:NNTF #1 \@@_compile_special:N
+      {
+        \token_if_eq_charcode:NNTF #2 .
+          { \use_none:n }
+          { \token_if_eq_charcode:NNF #2 ( } % )
+      }
+      { \use:n }
+    { \__msg_kernel_error:nnn { kernel } { c-C-invalid } {#2} }
+    #1 #2
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}[aux]
 %   {
 %     \@@_compile_c_[:w,
@@ -6191,6 +6211,13 @@
     a~control~sequence~test~'\iow_char:N\\c{...}'.~
     To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'.
   }
+\__msg_kernel_new:nnnn { kernel } { c-C-invalid }
+  { '\iow_char:N\\cC'~should~be~followed~by~'.'~or~'(',~not~'#1'. }
+  {
+    The~'\iow_char:N\\cC'~construction~restricts~the~next~item~to~be~a~
+    control~sequence~or~the~next~group~to~be~made~of~control~sequences.~
+    It~only~makes~sense~to~follow~it~by~'.'~or~by~a~group.
+  }
 \__msg_kernel_new:nnnn { kernel } { c-missing-rbrace }
   { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. }
   {

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4678,6 +4678,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4933,6 +4934,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4668,6 +4668,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4923,6 +4924,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4668,6 +4668,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4923,6 +4924,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4666,6 +4666,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4921,6 +4922,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4656,6 +4656,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4911,6 +4912,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4679,6 +4679,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4934,6 +4935,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4669,6 +4669,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4924,6 +4925,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4669,6 +4669,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4924,6 +4925,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4667,6 +4667,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4922,6 +4923,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -4657,6 +4657,7 @@
 Defining \__regex_compile_special_group_-:w on line ...
 Defining \__regex_compile_/c: on line ...
 Defining \__regex_compile_c_test:NN on line ...
+Defining \__regex_compile_c_C:NN on line ...
 Defining \__regex_compile_c_[:w on line ...
 Defining \__regex_compile_c_lbrack_loop:NN on line ...
 Defining \__regex_compile_c_lbrack_add:N on line ...
@@ -4912,6 +4913,7 @@
 Defining message LaTeX/kernel/range-missing-end on line ...
 Defining message LaTeX/kernel/range-backwards on line ...
 Defining message LaTeX/kernel/c-bad-mode on line ...
+Defining message LaTeX/kernel/c-C-invalid on line ...
 Defining message LaTeX/kernel/c-missing-rbrace on line ...
 Defining message LaTeX/kernel/c-missing-rbrack on line ...
 Defining message LaTeX/kernel/c-missing-category on line ...

Modified: trunk/l3kernel/testfiles/m3regex009.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3regex009.lvt	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3regex009.lvt	2017-07-13 13:24:24 UTC (rev 7359)
@@ -149,6 +149,11 @@
     \test:x { [ \iow_char:N \\c { x \iow_char:N \\c [AL] . } ] }
     \test:x { [ \iow_char:N \\c { x \iow_char:N \\c L } ] }
     \test:x { [ \iow_char:N \\c { x \iow_char:N \\c [AL] } ] }
+    \test:x { \iow_char:N \\c C A }
+    \test:x { \iow_char:N \\c C . }
+    \test:x { \iow_char:N \\c C \iow_char:N \\A }
+    \test:x { \iow_char:N \\c C (?i) A } % not detected
+    \test:x { \iow_char:N \\c C (...) } % ok
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Modified: trunk/l3kernel/testfiles/m3regex009.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3regex009.tlg	2017-07-13 12:30:07 UTC (rev 7358)
+++ trunk/l3kernel/testfiles/m3regex009.tlg	2017-07-13 13:24:24 UTC (rev 7359)
@@ -831,6 +831,58 @@
 | The '\c' escape cannot be used within a control sequence test '\c{...}'. To
 | combine several category tests, use '\c[...]'.
 |...............................................
+"\cCA"
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/c-C-invalid"
+! 
+! '\cC' should be followed by '.' or '(', not 'A'.
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...  }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| The '\cC' construction restricts the next item to be a control sequence or
+| the next group to be made of control sequences. It only makes sense to
+| follow it by '.' or by a group.
+|...............................................
+"\cC."
+"\cC\A"
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/c-C-invalid"
+! 
+! '\cC' should be followed by '.' or '(', not 'A'.
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...  }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| The '\cC' construction restricts the next item to be a control sequence or
+| the next group to be made of control sequences. It only makes sense to
+| follow it by '.' or by a group.
+|...............................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/bad-escape"
+! 
+! Invalid escape '\A' following a category test.
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...  }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| The escape sequence '\A' may not appear following a category test such as
+| '\cL' because it does not match exactly one character.
+|...............................................
+"\cC(?i)A"
+"\cC(...)"
 ============================================================
 ============================================================
 TEST 7: Malformed u escape



More information about the latex3-commits mailing list