[latex3-commits] [l3svn] r7371 - With enable-debug, wrap all expressions in parentheses (see #376)

noreply at latex-project.org noreply at latex-project.org
Sat Jul 15 16:59:02 CEST 2017


Author: bruno
Date: 2017-07-15 16:59:01 +0200 (Sat, 15 Jul 2017)
New Revision: 7371

Modified:
   trunk/l3experimental/xgalley/l3galley.dtx
   trunk/l3kernel/expl3.dtx
   trunk/l3kernel/l3basics.dtx
   trunk/l3kernel/l3box.dtx
   trunk/l3kernel/l3candidates.dtx
   trunk/l3kernel/l3file.dtx
   trunk/l3kernel/l3fp-convert.dtx
   trunk/l3kernel/l3int.dtx
   trunk/l3kernel/l3prg.dtx
   trunk/l3kernel/l3skip.dtx
   trunk/l3kernel/l3str.dtx
   trunk/l3kernel/l3token.dtx
   trunk/l3kernel/testfiles/m3compare001.tlg
   trunk/l3kernel/testfiles/m3int001.luatex.tlg
   trunk/l3kernel/testfiles/m3int001.ptex.tlg
   trunk/l3kernel/testfiles/m3int001.tlg
   trunk/l3kernel/testfiles/m3int001.uptex.tlg
   trunk/l3kernel/testfiles/m3int001.xetex.tlg
   trunk/l3kernel/testfiles/m3int002.luatex.tlg
   trunk/l3kernel/testfiles/m3int002.ptex.tlg
   trunk/l3kernel/testfiles/m3int002.tlg
   trunk/l3kernel/testfiles/m3int002.uptex.tlg
   trunk/l3kernel/testfiles/m3int002.xetex.tlg
   trunk/l3kernel/testfiles/m3skip001.tlg
   trunk/l3trial/l3auxdata/l3auxdata.dtx
   trunk/l3trial/l3check/l3check.dtx
   trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx
   trunk/l3trial/xbox/xbox.dtx
   trunk/l3trial/xfont/xfss.dtx
Log:
With enable-debug, wrap all expressions in parentheses (see #376)

Now "\int_eval:n { 123 a }" causes a "Missing parenthesis" error when
encountering the "a" because the argument is passed to \etex_numexpr:D
within ( ).  More precisely, that's only done when debugging is enabled
by one of check-declarations, log-functions, enable-debug, because I
fear it would slow down expl3 too much.


Modified: trunk/l3experimental/xgalley/l3galley.dtx
===================================================================
--- trunk/l3experimental/xgalley/l3galley.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3experimental/xgalley/l3galley.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -2018,7 +2018,7 @@
       {
         \dim_compare:nNnT
           { \etex_glueexpr:D \g_@@_interpar_vspace_user_tl } 
-            < { \etex_glueexpr:D #1 \scan_stop: }
+            < { \etex_glueexpr:D (#1) \scan_stop: }
           { \galley_vspace_set_single:n {#1} }
       }
   }
@@ -2310,6 +2310,7 @@
 %   generic build system is invoked (in case the
 %   \cs{etex_interlinepenalties:D} has accidentally been cleared).
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new_protected:Npn \galley_interline_penalty_set:n #1
   {
     \int_compare:nNnTF { \etex_interlinepenalties:D 0 } = 0

Modified: trunk/l3kernel/expl3.dtx
===================================================================
--- trunk/l3kernel/expl3.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/expl3.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1465,6 +1465,7 @@
       }
     \cs_set_protected:Npn \box_rotate:Nn #1#2
       { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } }
+    \__debug_patch_args:nNw { {#1} { (#2) } { (#3) } }
     \cs_set_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3
       {
         \hbox_set:Nn #1
@@ -1475,6 +1476,7 @@
               { \box_use:N #1 }
           }
       }
+    \__debug_patch_args:nNw { {#1} { (#2) } }
     \cs_set_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2
       {
         \hbox_set:Nn #1
@@ -1483,6 +1485,7 @@
               { \box_use:N #1 }
           }
       }
+    \__debug_patch_args:nNw { {#1} { (#2) } }
     \cs_set_protected:Npn \box_resize_to_wd:Nn #1#2
       {
         \hbox_set:Nn #1

Modified: trunk/l3kernel/l3basics.dtx
===================================================================
--- trunk/l3kernel/l3basics.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3basics.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1212,6 +1212,29 @@
 %   needed.
 % \end{function}
 %
+% \begin{function}{\__debug_patch_args:nNw}
+%   \begin{syntax}
+%     \cs{__debug_patch_args:nNw} \Arg{arguments} \meta{definition} \ldots{}
+%   \end{syntax}
+%   Like \cs{__debug_patch:nnNw}, this tweaks the following definition,
+%   but from the \enquote{inside out}.  Namely, it replaces |#1|, |#2|
+%   and so on in the \meta{replacement text} of the definition as
+%   indicated by the \meta{arguments}.  More precisely, a temporary
+%   function is defined using the \meta{definition} with the
+%   \meta{parameter text} and \meta{replacement text}, then the result
+%   of expanding that function once in front of the \meta{arguments} is
+%   used as \meta{parameter text} when defining the actual function.
+%   For instance,
+%   \begin{quote}
+%     \cs{__debug_patch_args:nNw} |{ { (#1) } }| \\
+%     \cs{cs_new:Npn} \cs{int_eval:n} |#1| \\
+%     ~~|{ \__int_value:w \__int_eval:w #1 \__int_eval_end: }|
+%   \end{quote}
+%   replaces |#1| by |(#1)| in the definition of \cs{int_eval:n} when
+%   debugging is enabled.
+%   This fails if the \meta{replacement text} contains~|##|.
+% \end{function}
+%
 % \begin{function}[EXP]{\__cs_count_signature:N, \__cs_count_signature:c}
 %   \begin{syntax}
 %     \cs{__cs_count_signature:N} \meta{function}
@@ -2410,11 +2433,12 @@
 % \end{macro}
 %
 % \begin{macro}[int]{\__debug_patch:nnNw}
+% \begin{macro}[aux,EXP]{\__debug_patch_case:N}
 % \begin{macro}[aux]
 %   {
 %     \__debug_patch_param:NNnnNnp,
-%     \__debug_patch_new:nnNNnn,
-%     \__debug_patch_new_conditional:nnNNnnn
+%     \__debug_patch_cs:nnNNnn,
+%     \__debug_patch_conditional:nnNNnnn
 %   }
 %   When debugging is not enabled, \cs{__debug_patch:nnNw} throws the
 %   patch away.  Otherwise it can be followed by \cs{cs_new:Npn} or
@@ -2429,31 +2453,35 @@
 \tex_ifodd:D \l at expl@enable at debug@bool
   \cs_set_protected:Npn \__debug_patch:nnNw #1#2#3
     {
-      \tex_ifcase:D
-        \if_meaning:w #3 \cs_new_protected:Npn  1~ \fi:
-        \if_meaning:w #3 \cs_new:Npn            1~ \fi:
-        \if_meaning:w #3 \cs_set_protected:Npn  1~ \fi:
-        \if_meaning:w #3 \cs_set:Npn            1~ \fi:
-        \if_meaning:w #3 \cs_gset_protected:Npn 1~ \fi:
-        \if_meaning:w #3 \cs_gset:Npn           1~ \fi:
-        \if_meaning:w #3 \prg_new_protected_conditional:Npnn 2~ \fi:
-        \if_meaning:w #3 \prg_new_conditional:Npnn           2~ \fi:
-        \__msg_kernel_error:nnx { kernel } { debug-unpatchable }
-          { \token_to_str:N #3 }
+      \tex_ifcase:D \__debug_patch_case:N #3
       \or:
         \exp_after:wN \__debug_patch_param:NNnnNnp
-        \exp_after:wN \__debug_patch_new:nnNNnn
+        \exp_after:wN \__debug_patch_cs:nnNNnn
       \else:
         \exp_after:wN \__debug_patch_param:NNnnNnp
-        \exp_after:wN \__debug_patch_new_conditional:nnNNnnn
+        \exp_after:wN \__debug_patch_conditional:nnNNnnn
       \fi:
       \use_none:nn {#1} {#2} #3
     }
+  \cs_set:Npn \__debug_patch_case:N #1
+    {
+      \if_meaning:w #1 \cs_new_protected:Npn  1~ \fi:
+      \if_meaning:w #1 \cs_new:Npn            1~ \fi:
+      \if_meaning:w #1 \cs_set_protected:Npn  1~ \fi:
+      \if_meaning:w #1 \cs_set:Npn            1~ \fi:
+      \if_meaning:w #1 \cs_gset_protected:Npn 1~ \fi:
+      \if_meaning:w #1 \cs_gset:Npn           1~ \fi:
+      \if_meaning:w #1 \prg_new_protected_conditional:Npnn 2~ \fi:
+      \if_meaning:w #1 \prg_new_conditional:Npnn           2~ \fi:
+      0~ %
+      \__msg_kernel_error:nnx { kernel } { debug-unpatchable }
+        { \token_to_str:N #1 }
+    }
   \cs_set_protected:Npn \__debug_patch_param:NNnnNnp #1#2#3#4#5#6#7#
     { #1 {#3} {#4} #5 #6 {#7} }
-  \cs_set_protected:Npn \__debug_patch_new:nnNNnn #1#2#3#4#5#6
+  \cs_set_protected:Npn \__debug_patch_cs:nnNNnn #1#2#3#4#5#6
     { #3 #4 #5 { #1 #6 #2 } }
-  \cs_set_protected:Npn \__debug_patch_new_conditional:nnNNnnn
+  \cs_set_protected:Npn \__debug_patch_conditional:nnNNnnn
       #1#2#3#4#5#6#7
     { #3 #4 #5 {#6} { #1 #7 #2 } }
 \fi:
@@ -2461,7 +2489,61 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
+% \begin{macro}[int]{\__debug_patch_args:nNw}
+% \begin{macro}[aux]
+%   {
+%     \__debug_tmp:w,
+%     \__debug_patch_args_param:NNnNnp,
+%     \__debug_patch_args_cs:nNNnn,
+%     \__debug_patch_args_conditional:nNNnnn
+%   }
+%   See \cs{__debug_patch:nnNw}.  The first argument is something like
+%   |{#1}{(#2)}|.  Define a temporary macro using the \meta{parameters}
+%   and \meta{code} of the definition that follows, then expand that
+%   temporary macro in front of the first argument to obtain new
+%   \meta{code}.  Then perform the definition as if that new \meta{code}
+%   was directly typed in the file.  To make it easy to expand in the
+%   definition, treat it as a \enquote{pre}-code to an empty definition.
+%    \begin{macrocode}
+\cs_set_protected:Npn \__debug_patch_args:nNw #1 { }
+%<*package>
+\tex_ifodd:D \l at expl@enable at debug@bool
+  \cs_set_protected:Npn \__debug_patch_args:nNw #1#2
+    {
+      \tex_ifcase:D \__debug_patch_case:N #2
+      \or:
+        \exp_after:wN \__debug_patch_args_param:NNnNnp
+        \exp_after:wN \__debug_patch_args_cs:nNNnn
+      \else:
+        \exp_after:wN \__debug_patch_args_param:NNnNnp
+        \exp_after:wN \__debug_patch_args_conditional:nNNnnn
+      \fi:
+      \use_none:n {#1} #2
+    }
+  \cs_set_protected:Npn \__debug_patch_args_param:NNnNnp #1#2#3#4#5#6#
+    { #1 {#3} #4 #5 {#6} }
+  \cs_set_protected:Npn \__debug_patch_args_cs:nNNnn #1#2#3#4#5
+    {
+      \cs_set:Npn \__debug_tmp:w #4 {#5}
+      \exp_after:wN \__debug_patch_cs:nnNNnn \exp_after:wN
+        { \__debug_tmp:w #1 } { } #2 #3 {#4} { }
+    }
+  \cs_set_protected:Npn \__debug_patch_args_conditional:nNNnnn
+      #1#2#3#4#5#6
+    {
+      \cs_set:Npn \__debug_tmp:w #4 {#6}
+      \exp_after:wN \__debug_patch_conditional:nnNNnnn \exp_after:wN
+        { \__debug_tmp:w #1 } { } #2 #3 {#4} {#5} { }
+    }
+\fi:
+%</package>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}[int]{\__chk_if_free_cs:N, \__chk_if_free_cs:c}
 %   This command is called by \cs{cs_new_nopar:Npn} and \cs{cs_new_eq:NN}
 %   \emph{etc.}\
@@ -2745,7 +2827,7 @@
     \exp_args:Nx \__cs_parm_from_arg_count_test:nnF
       {
         \exp_after:wN \exp_not:n
-        \if_case:w \__int_eval:w #2 \__int_eval_end:
+        \if_case:w \__int_eval:w (#2) \__int_eval_end:
              { }
         \or: { ##1 }
         \or: { ##1##2 }

Modified: trunk/l3kernel/l3box.dtx
===================================================================
--- trunk/l3kernel/l3box.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3box.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -944,13 +944,18 @@
 % \begin{macro}{\box_set_ht:Nn, \box_set_ht:cn}
 % \begin{macro}{\box_set_dp:Nn, \box_set_dp:cn}
 % \begin{macro}{\box_set_wd:Nn, \box_set_wd:cn}
-%   Measuring is easy: all primitive work. These primitives are not
+%   Setting the size is easy: all primitive work. These primitives are not
 %   expandable, so the derived functions are not either.
+%   When debugging, the dimension expression |#2| is surrounded by
+%   parentheses to catch early termination.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \box_set_dp:Nn #1#2
   { \box_dp:N #1 \__dim_eval:w #2 \__dim_eval_end: }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \box_set_ht:Nn #1#2
   { \box_ht:N #1 \__dim_eval:w #2 \__dim_eval_end: }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \box_set_wd:Nn #1#2
   { \box_wd:N #1 \__dim_eval:w #2 \__dim_eval_end: }
 \cs_generate_variant:Nn \box_set_ht:Nn { c }
@@ -980,13 +985,19 @@
 % \begin{macro}{\box_move_up:nn, \box_move_down:nn}
 % \testfile*
 %   Move box material in different directions.
+%   When debugging, the dimension expression |#1| is surrounded by
+%   parentheses to catch early termination.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new_protected:Npn \box_move_left:nn #1#2
   { \tex_moveleft:D \__dim_eval:w #1 \__dim_eval_end: #2 }
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new_protected:Npn \box_move_right:nn #1#2
   { \tex_moveright:D \__dim_eval:w #1 \__dim_eval_end: #2 }
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new_protected:Npn \box_move_up:nn #1#2
   { \tex_raise:D \__dim_eval:w #1 \__dim_eval_end: #2 }
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new_protected:Npn \box_move_down:nn #1#2
   { \tex_lower:D \__dim_eval:w #1 \__dim_eval_end: #2 }
 %    \end{macrocode}
@@ -1183,7 +1194,9 @@
 % \begin{macro}{\hbox_gset_to_wd:Nnn, \hbox_gset_to_wd:cnn}
 % \testfile*
 %   Storing material in a horizontal box with a specified width.
+%   Again, put the dimension expression in parentheses when debugging.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } {#3} }
 \cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3
   {
     \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end:
@@ -1229,6 +1242,7 @@
 % \begin{macro}{\hbox_gset_to_wd:Nnw, \hbox_gset_to_wd:cnw}
 %   Combining the above ideas.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2
   {
     \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end:
@@ -1248,6 +1262,7 @@
 %  \testfile*
 %   Put a horizontal box directly into the input stream.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new_protected:Npn \hbox_to_wd:nn #1#2
    {
      \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end:
@@ -1308,6 +1323,7 @@
 % \testfile*
 %   Put a vertical box directly into the input stream.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new_protected:Npn \vbox_to_ht:nn #1#2
   {
     \tex_vbox:D to \__dim_eval:w #1 \__dim_eval_end:
@@ -1363,6 +1379,7 @@
 %  \testfile*
 %  Storing material in a vertical box with a specified height.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } {#3} }
 \cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3
   {
     \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end:
@@ -1409,6 +1426,7 @@
 % \begin{macro}{\vbox_gset_to_ht:Nnw, \vbox_gset_to_ht:cnw}
 %   A combination of the above ideas.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2
   {
     \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end:
@@ -1440,6 +1458,7 @@
 % \testfile*
 %   Splitting a vertical box in two.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} {#2} { (#3) } }
 \cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3
   { \tex_setbox:D #1 \tex_vsplit:D #2 to \__dim_eval:w #3 \__dim_eval_end: }
 %    \end{macrocode}

Modified: trunk/l3kernel/l3candidates.dtx
===================================================================
--- trunk/l3kernel/l3candidates.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3candidates.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -973,6 +973,7 @@
 %   Trimming from the left- and right-hand edges of the box is easy: kern the
 %   appropriate parts off each side.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } {#3} { (#4) } {#5} }
 \cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5
   {
     \hbox_set:Nn \l_@@_internal_box
@@ -1002,7 +1003,7 @@
       {
         \hbox_set:Nn \l_@@_internal_box
           {
-            \box_move_down:nn { #3 - \box_dp:N #1 }
+            \box_move_down:nn { (#3) - \box_dp:N #1 }
               { \box_use:N \l_@@_internal_box }
           }
         \box_set_dp:Nn \l_@@_internal_box \c_zero_dim
@@ -1023,7 +1024,7 @@
       {
         \hbox_set:Nn \l_@@_internal_box
           {
-            \box_move_up:nn { #5 - \box_ht:N \l_@@_internal_box }
+            \box_move_up:nn { (#5) - \box_ht:N \l_@@_internal_box }
               { \box_use:N \l_@@_internal_box }
           }
         \box_set_ht:Nn \l_@@_internal_box \c_zero_dim
@@ -1039,6 +1040,7 @@
 %   dimensions. As a result, there are some things to watch out for in the
 %   vertical direction.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } {#3} { (#4) } {#5} }
 \cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5
   {
     \hbox_set:Nn \l_@@_internal_box
@@ -1070,7 +1072,7 @@
           }
         \box_set_ht:Nn \l_@@_internal_box
           {
-            #5
+            (#5)
             \dim_compare:nNnT {#3} > \c_zero_dim
               { - (#3) }
           }
@@ -1402,6 +1404,7 @@
 %   Shifting the corners and poles of a coffin means subtracting the
 %   appropriate values from the $x$- and $y$-components. For
 %   the poles, this means that the direction vector is unchanged.
+%   When debugging wrap expressions in parentheses.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_shift_corner:Nnnn #1#2#3#4
   {
@@ -1574,7 +1577,7 @@
   {
     \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } {#2}
       {
-        { \dim_eval:n #3 + \box_wd:N #1 } {#4}
+        { \dim_eval:n { #3 + \box_wd:N #1 } } {#4}
         {#5} {#6}
       }
   }
@@ -1733,6 +1736,7 @@
 %    \begin{macrocode}
 \cs_if_exist:NTF \pdftex_uniformdeviate:D
   {
+    \__debug_patch_args:nNw { { (#1) } { (#2) } }
     \cs_new:Npn \int_rand:nn #1#2
       {
         \exp_after:wN \@@_rand:ww
@@ -2107,6 +2111,7 @@
 % \begin{macro}{\sys_gset_rand_seed:n}
 %   The primitive always assigns the seed globally.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new_protected:Npn \sys_gset_rand_seed:n #1
   { \pdftex_setrandomseed:D \__int_eval:w #1 \__int_eval_end: }
 %    \end{macrocode}

Modified: trunk/l3kernel/l3file.dtx
===================================================================
--- trunk/l3kernel/l3file.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3file.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1205,10 +1205,10 @@
   { 1 }
   {
     \cs_if_exist:NTF \normalend
-      { \tex_count:D 38 \scan_stop: }
+      { \tex_count:D 38 ~ }
       {
-        \tex_count:D 16 \scan_stop:
-          \cs_if_exist:NT \loccount { - 1 }
+        \tex_count:D 16 ~ %
+        \cs_if_exist:NT \loccount { - 1 }
       }
   }
   {
@@ -1548,10 +1548,10 @@
   { 1 }
   {
     \cs_if_exist:NTF \normalend
-      { \tex_count:D 39 \scan_stop: }
+      { \tex_count:D 39 ~ }
       {
-        \tex_count:D 17 \scan_stop:
-          \cs_if_exist:NT \loccount { - 1 }
+        \tex_count:D 17 ~
+        \cs_if_exist:NT \loccount { - 1 }
       }
   }
   {

Modified: trunk/l3kernel/l3fp-convert.dtx
===================================================================
--- trunk/l3kernel/l3fp-convert.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3fp-convert.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -390,6 +390,7 @@
 %   performed by \cs{@@_mul_npos_o:Nww}, and cancelled by
 %   \cs{prg_do_nothing:} here.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \dim_to_fp:n #1
   {
     \exp_after:wN \@@_from_dim_test:ww

Modified: trunk/l3kernel/l3int.dtx
===================================================================
--- trunk/l3kernel/l3int.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3int.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1008,7 +1008,9 @@
 % \begin{macro}{\int_eval:n}
 %   Wrapper for \cs{@@_eval:w}: can be used in an integer expression
 %   or directly in the input stream.
+%   When debugging, use parentheses to catch early termination.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \int_eval:n #1
   { \@@_value:w \@@_eval:w #1 \@@_eval_end: }
 %    \end{macrocode}
@@ -1026,6 +1028,7 @@
 %   evaluation.  The absolute value is obtained by removing a leading
 %   sign if any.  All three functions expand in two steps.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \int_abs:n #1
   {
     \@@_value:w \exp_after:wN \@@_abs:N
@@ -1034,6 +1037,7 @@
   }
 \cs_new:Npn \@@_abs:N #1
   { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_set:Npn \int_max:nn #1#2
   {
     \@@_value:w \exp_after:wN \@@_maxmin:wwN
@@ -1042,6 +1046,7 @@
       >
     \exp_stop_f:
   }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_set:Npn \int_min:nn #1#2
   {
     \@@_value:w \exp_after:wN \@@_maxmin:wwN
@@ -1086,6 +1091,7 @@
 %   truncating behaviour that we want. The details are thanks to Heiko
 %   Oberdiek: getting things right in all cases is not so easy.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new:Npn \int_div_truncate:nn #1#2
   {
     \@@_value:w \@@_eval:w
@@ -1115,6 +1121,7 @@
 %    \end{macrocode}
 %   Finally there's the modulus operation.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new:Npn \int_mod:nn #1#2
   {
     \@@_value:w \@@_eval:w \exp_after:wN \@@_mod:ww
@@ -1177,7 +1184,7 @@
           {
             \__chk_if_free_cs:N #1
             \tex_global:D \@@_constdef:Nw #1 =
-              \@@_eval:w #2 \@@_eval_end:
+              \@@_eval:w (#2) \@@_eval_end:
           }
       }
   }
@@ -1267,8 +1274,10 @@
 % \UnitTested
 %    Adding and subtracting to and from a counter \ldots
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \int_add:Nn #1#2
   { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \int_sub:Nn #1#2
   { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: }
 \cs_new_protected:Npn \int_gadd:Nn
@@ -1322,6 +1331,7 @@
 %   if they are not defined. Thus there is no need for the checking
 %   code seen with token list variables.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \int_set:Nn #1#2
   { #1 ~ \@@_eval:w #2 \@@_eval_end: }
 \cs_new_protected:Npn \int_gset:Nn { \tex_global:D \int_set:Nn }
@@ -1526,6 +1536,7 @@
 % \UnitTested
 % More efficient but less natural in typing.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) \@@_eval_end: } {#2} { (#3) } }
 \prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF }
   {
     \if_int_compare:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end:
@@ -1584,6 +1595,7 @@
 % \UnitTested
 %   A predicate function.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF}
   {
     \if_int_odd:w \@@_eval:w #1 \@@_eval_end:
@@ -1592,6 +1604,7 @@
       \prg_return_false:
     \fi:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF}
   {
     \if_int_odd:w \@@_eval:w #1 \@@_eval_end:
@@ -1707,6 +1720,7 @@
 %   step size of zero before checking the sign, but we optimize for the
 %   most frequent case (positive step).
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } { (#3) } }
 \cs_new:Npn \int_step_function:nnnN #1#2#3
   {
     \exp_after:wN \@@_step:wwwN

Modified: trunk/l3kernel/l3prg.dtx
===================================================================
--- trunk/l3kernel/l3prg.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3prg.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1510,6 +1510,7 @@
 %   pool. Also, it is considerably slower than what we use here so the
 %   few extra csnames are well spent I would say.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \prg_replicate:nn #1
   {
     \exp:w

Modified: trunk/l3kernel/l3skip.dtx
===================================================================
--- trunk/l3kernel/l3skip.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3skip.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1110,6 +1110,7 @@
 % \begin{macro}{\dim_gset:Nn, \dim_gset:cn}
 %   Setting dimensions is easy enough.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \dim_set:Nn #1#2
   { #1 ~ \@@_eval:w #2 \@@_eval_end: }
 \cs_new_protected:Npn \dim_gset:Nn { \tex_global:D \dim_set:Nn }
@@ -1140,11 +1141,13 @@
 % \begin{macro}{\dim_gsub:Nn, \dim_gsub:cn}
 %   Using |by| here deals with the (incorrect) case |\dimen123|.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \dim_add:Nn #1#2
   { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: }
 \cs_new_protected:Npn \dim_gadd:Nn { \tex_global:D \dim_add:Nn }
 \cs_generate_variant:Nn \dim_add:Nn  { c }
 \cs_generate_variant:Nn \dim_gadd:Nn { c }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \dim_sub:Nn #1#2
   { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: }
 \cs_new_protected:Npn \dim_gsub:Nn { \tex_global:D \dim_sub:Nn }
@@ -1169,6 +1172,7 @@
 %   Functions for $\min$, $\max$, and absolute value with only one evaluation.
 %   The absolute value is evaluated by removing a leading~|-| if present.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \dim_abs:n #1
   {
     \exp_after:wN \@@_abs:N
@@ -1176,6 +1180,7 @@
   }
 \cs_new:Npn \@@_abs:N #1
   { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new:Npn \dim_max:nn #1#2
   {
     \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN
@@ -1184,6 +1189,7 @@
       >
     \@@_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new:Npn \dim_min:nn #1#2
   {
     \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN
@@ -1227,6 +1233,7 @@
 % \begin{macro}[pTF, EXP]{\dim_compare:nNn}
 %   Simple comparison.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) \@@_eval_end: } {#2} { (#3) } }
 \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF }
   {
     \if_dim:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end:
@@ -1426,6 +1433,7 @@
 % \begin{macro}{\dim_eval:n}
 %   Evaluating a dimension expression expandably.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \dim_eval:n #1
   { \dim_use:N \@@_eval:w #1 \@@_eval_end: }
 %    \end{macrocode}
@@ -1447,15 +1455,16 @@
 % \begin{macro}[EXP, aux]{\@@_to_decimal:w}
 %   A function which comes up often enough to deserve a place in the
 %   kernel.  Evaluate the dimension expression~|#1| then remove the
-%   trailing \texttt{pt}.  The argument is put in parentheses as this
-%   prevents the dimension expression from terminating early and leaving
-%   extra tokens lying around.  This is used a lot by low-level
-%   manipulations.
+%   trailing \texttt{pt}.  When debugging is enabled, the argument is
+%   put in parentheses as this prevents the dimension expression from
+%   terminating early and leaving extra tokens lying around.  This is
+%   used a lot by low-level manipulations.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \dim_to_decimal:n #1
   {
     \exp_after:wN
-      \@@_to_decimal:w \dim_use:N \@@_eval:w (#1) \@@_eval_end:
+      \@@_to_decimal:w \dim_use:N \@@_eval:w #1 \@@_eval_end:
   }
 \use:x
   {
@@ -1486,6 +1495,7 @@
 %   Another hard-coded conversion: this one is necessary to avoid things going
 %   off-scale.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \dim_to_decimal_in_sp:n #1
   { \int_eval:n { \@@_eval:w #1 \@@_eval_end: } }
 %    \end{macrocode}
@@ -1635,6 +1645,7 @@
 % \begin{macro}{\skip_gset:Nn, \skip_gset:cn}
 %   Much the same as for dimensions.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \skip_set:Nn #1#2
   { #1 ~ \etex_glueexpr:D #2 \scan_stop: }
 \cs_new_protected:Npn \skip_gset:Nn { \tex_global:D \skip_set:Nn }
@@ -1666,11 +1677,13 @@
 % \begin{macro}{\skip_gsub:Nn, \skip_gsub:cn}
 %   Using |by| here deals with the (incorrect) case |\skip123|.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \skip_add:Nn #1#2
   { \tex_advance:D #1 by \etex_glueexpr:D #2 \scan_stop: }
 \cs_new_protected:Npn \skip_gadd:Nn { \tex_global:D \skip_add:Nn }
 \cs_generate_variant:Nn \skip_add:Nn  { c }
 \cs_generate_variant:Nn \skip_gadd:Nn { c }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \skip_sub:Nn #1#2
   { \tex_advance:D #1 by - \etex_glueexpr:D #2 \scan_stop: }
 \cs_new_protected:Npn \skip_gsub:Nn { \tex_global:D \skip_sub:Nn }
@@ -1713,6 +1726,7 @@
 %    \begin{macrocode}
 \cs_set_protected:Npn \__cs_tmp:w #1
   {
+    \__debug_patch_args:nNw { { (##1) } }
     \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF }
       {
         \exp_after:wN \__skip_if_finite:wwNw
@@ -1731,6 +1745,7 @@
 % \begin{macro}{\skip_eval:n}
 %   Evaluating a skip expression expandably.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \skip_eval:n #1
   { \skip_use:N \etex_glueexpr:D #1 \scan_stop: }
 %    \end{macrocode}
@@ -1752,9 +1767,11 @@
 %    Inserting skips.
 %    \begin{macrocode}
 \cs_new_eq:NN  \skip_horizontal:N \tex_hskip:D
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \skip_horizontal:n #1
   { \skip_horizontal:N \etex_glueexpr:D #1 \scan_stop: }
 \cs_new_eq:NN  \skip_vertical:N \tex_vskip:D
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \skip_vertical:n #1
   { \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: }
 \cs_generate_variant:Nn \skip_horizontal:N { c }
@@ -1892,6 +1909,7 @@
 % \begin{macro}{\muskip_gset:Nn, \muskip_gset:cn}
 %   This should be pretty familiar.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \muskip_set:Nn #1#2
   { #1 ~ \etex_muexpr:D #2 \scan_stop: }
 \cs_new_protected:Npn \muskip_gset:Nn { \tex_global:D \muskip_set:Nn }
@@ -1929,11 +1947,13 @@
 % \begin{macro}{\muskip_gsub:Nn, \muskip_gsub:cn}
 %   Using |by| here deals with the (incorrect) case |\muskip123|.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \muskip_add:Nn #1#2
   { \tex_advance:D #1 by \etex_muexpr:D #2 \scan_stop: }
 \cs_new_protected:Npn \muskip_gadd:Nn { \tex_global:D \muskip_add:Nn }
 \cs_generate_variant:Nn \muskip_add:Nn  { c }
 \cs_generate_variant:Nn \muskip_gadd:Nn { c }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new_protected:Npn \muskip_sub:Nn #1#2
   { \tex_advance:D #1 by - \etex_muexpr:D #2 \scan_stop: }
 \cs_new_protected:Npn \muskip_gsub:Nn { \tex_global:D \muskip_sub:Nn }
@@ -1950,6 +1970,7 @@
 % \begin{macro}{\muskip_eval:n}
 %   Evaluating a muskip expression expandably.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \muskip_eval:n #1
   { \muskip_use:N \etex_muexpr:D #1 \scan_stop: }
 %    \end{macrocode}

Modified: trunk/l3kernel/l3str.dtx
===================================================================
--- trunk/l3kernel/l3str.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3str.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1049,6 +1049,7 @@
   }
 \cs_new:Npn \str_item_ignore_spaces:nn #1
   { \exp_args:No \@@_item:nn { \tl_to_str:n {#1} } }
+\__debug_patch_args:nNw { {#1} { (#2) } }
 \cs_new:Npn \@@_item:nn #1#2
   {
     \exp_after:wN \@@_item:w
@@ -1145,6 +1146,7 @@
   }
 \cs_new:Npn \str_range_ignore_spaces:nnn #1
   { \exp_args:No \@@_range:nnn { \tl_to_str:n {#1} } }
+\__debug_patch_args:nNw { {#1} { (#2) } { (#3) } }
 \cs_new:Npn \@@_range:nnn #1#2#3
   {
     \exp_after:wN \@@_range:w

Modified: trunk/l3kernel/l3token.dtx
===================================================================
--- trunk/l3kernel/l3token.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/l3token.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1131,13 +1131,15 @@
 % \begin{macro}{\char_show_value_catcode:n}
 %   Simple wrappers around the primitives.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new_protected:Npn \char_set_catcode:nn #1#2
   {
     \tex_catcode:D \__int_eval:w #1 \__int_eval_end:
       = \__int_eval:w #2 \__int_eval_end:
-   }
+  }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \char_value_catcode:n #1
-  { \tex_the:D \tex_catcode:D \__int_eval:w #1\__int_eval_end: }
+  { \tex_the:D \tex_catcode:D \__int_eval:w #1 \__int_eval_end: }
 \cs_new_protected:Npn \char_show_value_catcode:n #1
   { \__msg_show_wrap:n { > ~ \char_value_catcode:n {#1} } }
 %    \end{macrocode}
@@ -1269,40 +1271,48 @@
 % \begin{macro}{\char_show_value_sfcode:n}
 %   Pretty repetitive, but necessary!
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new_protected:Npn \char_set_mathcode:nn #1#2
   {
     \tex_mathcode:D \__int_eval:w #1 \__int_eval_end:
     = \__int_eval:w #2 \__int_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \char_value_mathcode:n #1
-  { \tex_the:D \tex_mathcode:D \__int_eval:w #1\__int_eval_end: }
+  { \tex_the:D \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: }
 \cs_new_protected:Npn \char_show_value_mathcode:n #1
   { \__msg_show_wrap:n { > ~ \char_value_mathcode:n {#1} } }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new_protected:Npn \char_set_lccode:nn #1#2
   {
     \tex_lccode:D \__int_eval:w #1 \__int_eval_end:
     = \__int_eval:w #2 \__int_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \char_value_lccode:n #1
-  { \tex_the:D \tex_lccode:D \__int_eval:w #1\__int_eval_end: }
+  { \tex_the:D \tex_lccode:D \__int_eval:w #1 \__int_eval_end: }
 \cs_new_protected:Npn \char_show_value_lccode:n #1
   { \__msg_show_wrap:n { > ~ \char_value_lccode:n {#1} } }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new_protected:Npn \char_set_uccode:nn #1#2
   {
     \tex_uccode:D \__int_eval:w #1 \__int_eval_end:
     = \__int_eval:w #2 \__int_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \char_value_uccode:n #1
-  { \tex_the:D \tex_uccode:D \__int_eval:w #1\__int_eval_end: }
+  { \tex_the:D \tex_uccode:D \__int_eval:w #1 \__int_eval_end: }
 \cs_new_protected:Npn \char_show_value_uccode:n #1
   { \__msg_show_wrap:n { > ~ \char_value_uccode:n {#1} } }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new_protected:Npn \char_set_sfcode:nn #1#2
   {
     \tex_sfcode:D \__int_eval:w #1 \__int_eval_end:
     = \__int_eval:w #2 \__int_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \char_value_sfcode:n #1
-  { \tex_the:D \tex_sfcode:D \__int_eval:w #1\__int_eval_end: }
+  { \tex_the:D \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: }
 \cs_new_protected:Npn \char_show_value_sfcode:n #1
   { \__msg_show_wrap:n { > ~ \char_value_sfcode:n {#1} } }
 %    \end{macrocode}
@@ -1385,6 +1395,7 @@
 %   the interface layer, turn the two arguments into integers up-front so
 %   this is only done once.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new:Npn \char_generate:nn #1#2
   {
     \exp:w \exp_after:wN \@@_generate_aux:w

Modified: trunk/l3kernel/testfiles/m3compare001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3compare001.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3compare001.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -195,7 +195,7 @@
 I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 ! Missing number, treated as zero.
 <to be read again> 
-                   \__int_eval_end: 
+                   )
 l. ...  }
 A number should have been here; I inserted `0'.
 (If you can't figure out why I needed to see a number,

Modified: trunk/l3kernel/testfiles/m3int001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.luatex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int001.luatex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -108,7 +108,7 @@
 24
 -30
 ! Arithmetic overflow.
-\int_set:Nn ...1 \__int_eval:w #2\__int_eval_end: 
+\int_set:Nn ...\__int_eval:w (#2)\__int_eval_end: 
 l. ...  }
 I can't evaluate this expression,
 since the result is out of range.

Modified: trunk/l3kernel/testfiles/m3int001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.ptex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int001.ptex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -127,7 +127,7 @@
 24
 -30
 ! Arithmetic overflow.
-\int_set:Nn ...1 \__int_eval:w #2\__int_eval_end: 
+\int_set:Nn ...\__int_eval:w (#2)\__int_eval_end: 
 l. ...  }
 I can't evaluate this expression,
 since the result is out of range.

Modified: trunk/l3kernel/testfiles/m3int001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int001.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -127,7 +127,7 @@
 24
 -30
 ! Arithmetic overflow.
-\int_set:Nn ...1 \__int_eval:w #2\__int_eval_end: 
+\int_set:Nn ...\__int_eval:w (#2)\__int_eval_end: 
 l. ...  }
 I can't evaluate this expression,
 since the result is out of range.

Modified: trunk/l3kernel/testfiles/m3int001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.uptex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int001.uptex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -108,7 +108,7 @@
 24
 -30
 ! Arithmetic overflow.
-\int_set:Nn ...1 \__int_eval:w #2\__int_eval_end: 
+\int_set:Nn ...\__int_eval:w (#2)\__int_eval_end: 
 l. ...  }
 I can't evaluate this expression,
 since the result is out of range.

Modified: trunk/l3kernel/testfiles/m3int001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.xetex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int001.xetex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -108,7 +108,7 @@
 24
 -30
 ! Arithmetic overflow.
-\int_set:Nn ...1 \__int_eval:w #2\__int_eval_end: 
+\int_set:Nn ...\__int_eval:w (#2)\__int_eval_end: 
 l. ...  }
 I can't evaluate this expression,
 since the result is out of range.

Modified: trunk/l3kernel/testfiles/m3int002.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.luatex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int002.luatex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -513,11 +513,16 @@
 A number should have been here; I inserted `0'.
 (If you can't figure out why I needed to see a number,
 look up `weird error' in the index to The TeXbook.)
+! Missing ) inserted for expression.
+<to be read again> 
+a
+l. ...}
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 0
 2
 12
 3
-[0a\__int_eval_end: ]
+[0a)\__int_eval_end: ]
 ============================================================
 ============================================================
 TEST 36: Integer conversion to alph

Modified: trunk/l3kernel/testfiles/m3int002.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.ptex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int002.ptex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -513,11 +513,16 @@
 A number should have been here; I inserted `0'.
 (If you can't figure out why I needed to see a number,
 look up `weird error' in the index to The TeXbook.)
+! Missing ) inserted for expression.
+<to be read again> 
+                   a
+l. ...}
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 0
 2
 12
 3
-[0a\__int_eval_end: ]
+[0a)\__int_eval_end: ]
 ============================================================
 ============================================================
 TEST 36: Integer conversion to alph

Modified: trunk/l3kernel/testfiles/m3int002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int002.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -513,11 +513,16 @@
 A number should have been here; I inserted `0'.
 (If you can't figure out why I needed to see a number,
 look up `weird error' in the index to The TeXbook.)
+! Missing ) inserted for expression.
+<to be read again> 
+                   a
+l. ...}
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 0
 2
 12
 3
-[0a\__int_eval_end: ]
+[0a)\__int_eval_end: ]
 ============================================================
 ============================================================
 TEST 36: Integer conversion to alph

Modified: trunk/l3kernel/testfiles/m3int002.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.uptex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int002.uptex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -513,11 +513,16 @@
 A number should have been here; I inserted `0'.
 (If you can't figure out why I needed to see a number,
 look up `weird error' in the index to The TeXbook.)
+! Missing ) inserted for expression.
+<to be read again> 
+                   a
+l. ...}
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 0
 2
 12
 3
-[0a\__int_eval_end: ]
+[0a)\__int_eval_end: ]
 ============================================================
 ============================================================
 TEST 36: Integer conversion to alph

Modified: trunk/l3kernel/testfiles/m3int002.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.xetex.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3int002.xetex.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -513,11 +513,16 @@
 A number should have been here; I inserted `0'.
 (If you can't figure out why I needed to see a number,
 look up `weird error' in the index to The TeXbook.)
+! Missing ) inserted for expression.
+<to be read again> 
+                   a
+l. ...}
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 0
 2
 12
 3
-[0a\__int_eval_end: ]
+[0a)\__int_eval_end: ]
 ============================================================
 ============================================================
 TEST 36: Integer conversion to alph

Modified: trunk/l3kernel/testfiles/m3skip001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3skip001.tlg	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3kernel/testfiles/m3skip001.tlg	2017-07-15 14:59:01 UTC (rev 7371)
@@ -154,7 +154,7 @@
 Continue and I'll use the largest value I can.
 ! Dimension too large.
 <to be read again> 
-                   \scan_stop: 
+                   )
 l. ...}
 I can't work with sizes bigger than about 19 feet.
 Continue and I'll use the largest value I can.
@@ -181,7 +181,7 @@
 Continue and I'll use the largest value I can.
 ! Dimension too large.
 <to be read again> 
-                   \scan_stop: 
+                   )
 l. ...}
 I can't work with sizes bigger than about 19 feet.
 Continue and I'll use the largest value I can.
@@ -196,7 +196,7 @@
 -32767.00003pt (overflow by 1pt)
 ! Dimension too large.
 <to be read again> 
-                   \__dim_eval_end: 
+                   )
 l. ...}
 I can't work with sizes bigger than about 19 feet.
 Continue and I'll use the largest value I can.
@@ -211,7 +211,7 @@
 32767.00003pt (overflow by 1pt)
 ! Dimension too large.
 <to be read again> 
-                   \__dim_eval_end: 
+                   )
 l. ...}
 I can't work with sizes bigger than about 19 feet.
 Continue and I'll use the largest value I can.

Modified: trunk/l3trial/l3auxdata/l3auxdata.dtx
===================================================================
--- trunk/l3trial/l3auxdata/l3auxdata.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3trial/l3auxdata/l3auxdata.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -728,13 +728,14 @@
 \prop_new:N \l_@@_catcodes_prop
 \cs_new:Nn \@@_catcodes_pushing:
   {
+    \__debug_patch_args:nNw { {##1} { (##2) } }
     \cs_set_protected:Npn \char_set_catcode:nn ##1 ##2
       {
         \prop_put:Nxx \l_@@_catcodes_prop
           { \int_eval:n {##1} }
-          { \tex_the:D \tex_catcode:D ##1 }
+          { \tex_the:D \tex_catcode:D \int_eval:n {##1} }
 
-        \tex_catcode:D ##1 = \__int_eval:w ##2 \__int_eval_end:
+        \tex_catcode:D \int_eval:n {##1} = \__int_eval:w ##2 \__int_eval_end:
       }
   }
 %    \end{macrocode}
@@ -742,9 +743,10 @@
 %    \begin{macrocode}
 \cs_new:Nn \@@_catcodes_pop:
   {
+    \__debug_patch_args:nNw { {##1} { (##2) } }
     \cs_set_protected:Npn \char_set_catcode:nn ##1 ##2
       {
-        \tex_catcode:D ##1 = \__int_eval:w ##2 \__int_eval_end:
+        \tex_catcode:D \int_eval:n {##1} = \__int_eval:w ##2 \__int_eval_end:
       }
     \prop_map_inline:Nn \l_@@_catcodes_prop
       { \char_set_catcode:nn {##1} {##2} }

Modified: trunk/l3trial/l3check/l3check.dtx
===================================================================
--- trunk/l3trial/l3check/l3check.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3trial/l3check/l3check.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -1679,7 +1679,7 @@
         { \@@_error:nn { internal } { Cannot~patch~\__cs_generate_variant_loop_end:nwwwNNnn } }
       \cs_set_protected:Npn \check_tmp:w #1#2#3#4#5
         {
-          \tex_catcode:D `#1 = \__int_eval:w #2 \__int_eval_end:
+          \tex_catcode:D `#1 = \__int_eval:w (#2) \__int_eval_end:
           #3 { \tex_catcode:D `#1 / 2 } = { 6 }
             {
               \group_begin: \exp_args:NNc \group_end:
@@ -1690,7 +1690,7 @@
         {
           \cs_gset_protected:Npn \__char_set_catcode:NnNNN #1#2#3#4#5
             {
-              \tex_catcode:D `#1 = \__int_eval:w #2 \__int_eval_end:
+              \tex_catcode:D `#1 = \__int_eval:w (#2) \__int_eval_end:
               #3 { \tex_catcode:D `#1 / 2 } = { 6 }
                 {
                   \group_begin: \exp_after:wN \group_end:

Modified: trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx
===================================================================
--- trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -932,6 +932,7 @@
 %   \texttt{sp}, we must define |#1| to be the integer expression to be
 %   multiplied, and |#2| to be the (real) scaling factor.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} }
 \cs_new:Npn \int_mul_truncate:nn #1 #2
   {
     \__int_value:w
@@ -1164,6 +1165,7 @@
 %   overall \meta{skipexpr} is closed by \cs{scan_stop:} inserted by our
 %   auxiliary.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \skip_abs:n #1
   {
     \skip_use:N \etex_glueexpr:D
@@ -1195,11 +1197,13 @@
 %   that the arguments of \cs{if_dim:w} are entirely found before the
 %   expansion hits \cs{prg_return_true:}.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \skip_compare_main:nNn #1#2#3 { p , T , F , TF }
   {
     \if_dim:w \etex_glueexpr:D #1 #2 \etex_glueexpr:D #3 \scan_stop:
       \prg_return_true: \else: \prg_return_false: \fi:
   }
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \skip_compare_stretch:nNn #1#2#3 { p , T , F , TF }
   {
     \exp_after:wN \skip_compare_component_aux:wwNNN
@@ -1209,6 +1213,7 @@
       \etex_gluestretchorder:D
       \etex_gluestretch:D
   }
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \skip_compare_shrink:nNn #1#2#3 { p , T , F , TF }
   {
     \exp_after:wN \skip_compare_component_aux:wwNNN
@@ -1248,6 +1253,7 @@
 %   if $a=a'$, $b=b'$ and $c=c'$.  The first is less than the second if
 %   and only if $a<a'$, $|b|<|b'|$, and $|c'|<|c|$.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \skip_compare:nNn #1#2#3 { p , T , F , TF }
   {
     \exp_after:wN \__skip_compare:wwN
@@ -1288,6 +1294,7 @@
 %   This relies on the same auxiliary as \cs{skip_abs:n}.  See this
 %   function for an explanation of the code.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new:Npn \muskip_abs:n #1
   {
     \muskip_use:N \etex_muexpr:D
@@ -1309,6 +1316,7 @@
 %   \texttt{skip} counterparts, but mu expressions must be converted to
 %   glue using the \eTeX{} primitive \tn{mutoglue}.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \muskip_compare_main:nNn #1#2#3 { p , T , F , TF }
   {
     \if_dim:w \etex_mutoglue:D \etex_muexpr:D #1
@@ -1318,6 +1326,7 @@
       \prg_return_false:
     \fi:
   }
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \muskip_compare_stretch:nNn #1#2#3 { p , T , F , TF }
   {
     \exp_after:wN \skip_compare_component_aux:wwNNN
@@ -1327,6 +1336,7 @@
       \etex_gluestretchorder:D
       \etex_gluestretch:D
   }
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \muskip_compare_shrink:nNn #1#2#3 { p , T , F , TF }
   {
     \exp_after:wN \skip_compare_component_aux:wwNNN
@@ -1343,6 +1353,7 @@
 %   This function uses the same auxiliaries as \cs{skip_compare:nNn},
 %   first converting the mu units to points.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } {#2} { (#3) } }
 \prg_new_conditional:Npnn \muskip_compare:nNn #1#2#3 { p , T , F , TF }
   {
     \exp_after:wN \__skip_compare:wwN

Modified: trunk/l3trial/xbox/xbox.dtx
===================================================================
--- trunk/l3trial/xbox/xbox.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3trial/xbox/xbox.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -728,11 +728,13 @@
 %   As we want skips and kerns to have similar behaviour, we try to get similar
 %   results.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new_protected:Npn \kern_horizontal:n #1
   {
     \mode_leave_vertical:
     \tex_kern:D \__dim_eval:w #1 \__dim_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new_protected:Npn \kern_vertical:n #1
   {
     \mode_if_vertical:F
@@ -749,6 +751,7 @@
 %   dimension expression support. The non-expanding rule is set up in
 %   horizontal mode as that is usually the best plan.
 %    \begin{macrocode}
+\__debug_patch_args:nNw { { (#1) } { (#2) } { (#3) } }
 \cs_new_protected:Npn \rule:nnn #1#2#3
   {
     \hbox:n
@@ -759,12 +762,14 @@
           width  \__dim_eval:w #3 \__dim_eval_end:
       }
   }
+\__debug_patch_args:nNw { { (#1) } { (#2) } }
 \cs_new_protected:Npn \rule_horizontal:nn #1#2
   {
     \tex_hrule:D
       height \__dim_eval:w #1 \__dim_eval_end:
       depth  \__dim_eval:w #2 \__dim_eval_end:
   }
+\__debug_patch_args:nNw { { (#1) } }
 \cs_new_protected:Npn \rule_vertical:n #1
   { \tex_vrule:D width \__dim_eval:w #1 \__dim_eval_end: }
 %    \end{macrocode}

Modified: trunk/l3trial/xfont/xfss.dtx
===================================================================
--- trunk/l3trial/xfont/xfss.dtx	2017-07-15 13:51:54 UTC (rev 7370)
+++ trunk/l3trial/xfont/xfss.dtx	2017-07-15 14:59:01 UTC (rev 7371)
@@ -205,7 +205,7 @@
 %    \begin{macrocode}
 \cs_new_eq:NN \mathgroup_use:N \tex_fam:D
 \cs_new:Npn \mathgroup_use:n #1
-  { \tex_fam:D \__int_eval:w #1 \__int_eval_end: }
+  { \tex_fam:D \__int_eval:w (#1) \__int_eval_end: }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -505,7 +505,7 @@
 \cs_new:Npn \xfss_dim_strip_pt:n #1
   {
     \exp_after:wN \xfss_dim_strip_pt:w
-    \dim_use:N \__dim_eval:w #1 pt \__dim_eval_end: \q_stop
+    \dim_use:N \__dim_eval:w (#1 pt) \__dim_eval_end: \q_stop
   }
 \use:x
   {
@@ -2178,7 +2178,7 @@
 %   of the current font.
 %    \begin{macrocode}
 \DeclareDocumentCommand \symbol {m}
-  { \tex_char:D \__int_eval:w #1 \__int_eval_end: }
+  { \tex_char:D \__int_eval:w (#1) \__int_eval_end: }
 %    \end{macrocode}
 % \end{macro}
 %



More information about the latex3-commits mailing list