[latex3-commits] [l3svn] r6905 - Test existence before showing regexes and flags
noreply at latex-project.org
noreply at latex-project.org
Sun Feb 12 20:50:14 CET 2017
Author: bruno
Date: 2017-02-12 20:50:14 +0100 (Sun, 12 Feb 2017)
New Revision: 6905
Modified:
trunk/l3experimental/l3str/l3flag.dtx
trunk/l3experimental/l3str/l3regex.dtx
trunk/l3experimental/l3str/testfiles/m3flag001.lvt
trunk/l3experimental/l3str/testfiles/m3flag001.tlg
trunk/l3experimental/l3str/testfiles/m3regex007.lvt
trunk/l3experimental/l3str/testfiles/m3regex007.tlg
Log:
Test existence before showing regexes and flags
Modified: trunk/l3experimental/l3str/l3flag.dtx
===================================================================
--- trunk/l3experimental/l3str/l3flag.dtx 2017-02-12 17:23:10 UTC (rev 6904)
+++ trunk/l3experimental/l3str/l3flag.dtx 2017-02-12 19:50:14 UTC (rev 6905)
@@ -257,7 +257,10 @@
% auxiliaries.
% \begin{macrocode}
\cs_new_protected:Npn \flag_show:n #1
- { \__msg_show_wrap:n { > ~ flag ~ #1 ~ height = \flag_height:n {#1} } }
+ {
+ \exp_args:Nc \__msg_show_variable:NNNnn { flag~#1 } \cs_if_exist:NTF ? { }
+ { > ~ flag ~ #1 ~ height = \flag_height:n {#1} }
+ }
\cs_new_protected:Npn \flag_log:n
{ \__msg_log_next: \flag_show:n }
% \end{macrocode}
Modified: trunk/l3experimental/l3str/l3regex.dtx
===================================================================
--- trunk/l3experimental/l3str/l3regex.dtx 2017-02-12 17:23:10 UTC (rev 6904)
+++ trunk/l3experimental/l3str/l3regex.dtx 2017-02-12 19:50:14 UTC (rev 6905)
@@ -3077,12 +3077,12 @@
%
% \subsubsection{Showing regexes}
%
-% \begin{macro}[aux]{\@@_show:Nx}
+% \begin{macro}[aux]{\@@_show:Nn}
% Within a \cs{__tl_build:Nw} \ldots{} \cs{__tl_build_end:} group, we
% redefine all the function that can appear in a compiled regex, then
% run the regex. The result is then shown.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_show:Nx #1#2
+\cs_new_protected:Npn \@@_show:Nn #1#2
{
\__tl_build:Nw \l_@@_internal_a_tl
\cs_set_protected:Npn \@@_branch:n
@@ -3131,9 +3131,10 @@
\cs_set:cpn { @@_prop_.: } { \@@_show_one:n { any~token } }
\seq_clear:N \l_@@_show_prefix_seq
\@@_show_push:n { ~ }
- #1
+ \cs_if_exist_use:N #1
\__tl_build_end:
- \__msg_show_wrap:n { >~Compiled~regex~#2: \l_@@_internal_a_tl }
+ \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { }
+ { >~Compiled~regex~#2: \l_@@_internal_a_tl }
}
% \end{macrocode}
% \end{macro}
@@ -5225,11 +5226,11 @@
\cs_new_protected:Npn \regex_show:n #1
{
\@@_compile:n {#1}
- \@@_show:Nx \l_@@_internal_regex
+ \@@_show:Nn \l_@@_internal_regex
{ { \tl_to_str:n {#1} } }
}
\cs_new_protected:Npn \regex_show:N #1
- { \@@_show:Nx #1 { variable~\token_to_str:N #1 } }
+ { \@@_show:Nn #1 { variable~\token_to_str:N #1 } }
% \end{macrocode}
% \end{macro}
%
Modified: trunk/l3experimental/l3str/testfiles/m3flag001.lvt
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3flag001.lvt 2017-02-12 17:23:10 UTC (rev 6904)
+++ trunk/l3experimental/l3str/testfiles/m3flag001.lvt 2017-02-12 19:50:14 UTC (rev 6905)
@@ -71,6 +71,7 @@
\flag_raise:n {C}
\flag_raise:n {C}
\flag_log:n {C}
+ \flag_log:n { other }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modified: trunk/l3experimental/l3str/testfiles/m3flag001.tlg
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3flag001.tlg 2017-02-12 17:23:10 UTC (rev 6904)
+++ trunk/l3experimental/l3str/testfiles/m3flag001.tlg 2017-02-12 19:50:14 UTC (rev 6905)
@@ -54,6 +54,23 @@
<recently read> }
l. ... }
> flag C height=3.
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/variable-not-defined"
+!
+! Variable \flag other undefined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to show a variable \flag other, but this has not been
+| defined yet.
+|...............................................
============================================================
============================================================
TEST 5: set_trap
Modified: trunk/l3experimental/l3str/testfiles/m3regex007.lvt
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3regex007.lvt 2017-02-12 17:23:10 UTC (rev 6904)
+++ trunk/l3experimental/l3str/testfiles/m3regex007.lvt 2017-02-12 19:50:14 UTC (rev 6905)
@@ -27,6 +27,7 @@
\regex_show:n { a(?: bc (?| de | f ){2} g | hi ){3,4}? }
\regex_new:N \l_bar_regex
\regex_show:N \l_bar_regex
+ \regex_show:N \g_undefined_regex
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modified: trunk/l3experimental/l3str/testfiles/m3regex007.tlg
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3regex007.tlg 2017-02-12 17:23:10 UTC (rev 6904)
+++ trunk/l3experimental/l3str/testfiles/m3regex007.tlg 2017-02-12 19:50:14 UTC (rev 6905)
@@ -102,6 +102,23 @@
Fail.
<recently read> }
l. ... }
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/variable-not-defined"
+!
+! Variable \g_undefined_regex undefined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to show a variable \g_undefined_regex, but this has not
+| been defined yet.
+|...............................................
============================================================
============================================================
TEST 2: regex_show again
More information about the latex3-commits
mailing list