[latex3-commits] [git/LaTeX3-latex3-latex3] scan-quark: Replace quarks by scan marks in l3keys (009ef1a81)
PhelypeOleinik
tex.phelype at gmail.com
Fri Mar 20 01:46:01 CET 2020
Repository : https://github.com/latex3/latex3
On branch : scan-quark
Link : https://github.com/latex3/latex3/commit/009ef1a8127b0963558e7e8b9aba7c7a148acb44
>---------------------------------------------------------------
commit 009ef1a8127b0963558e7e8b9aba7c7a148acb44
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date: Thu Mar 19 21:46:01 2020 -0300
Replace quarks by scan marks in l3keys
That's enough for today :-)
>---------------------------------------------------------------
009ef1a8127b0963558e7e8b9aba7c7a148acb44
l3kernel/l3keys.dtx | 165 ++++++++++++++++++++++----------------
l3kernel/testfiles/m3quark001.tlg | 12 +--
2 files changed, 100 insertions(+), 77 deletions(-)
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index ab068d578..96dfc1bdc 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -976,9 +976,7 @@
% argument.
% \begin{macrocode}
\cs_new:Npn \keyval_parse:NNn ##1 ##2 ##3
- {
- \@@_loop_active:NNw ##1 ##2 \s_@@_mark ##3 #1 \s_@@_tail #1
- }
+ { \@@_loop_active:NNw ##1 ##2 \s_@@_mark ##3 #1 \s_@@_tail #1 }
% \end{macrocode}
% \end{macro}
%
@@ -1043,16 +1041,14 @@
% control to \cs[no-index]{@@_key_val:nnN}.
% \begin{macrocode}
\cs_new:Npn \@@_split_active:w ##1 #2
+ { \@@_trim:nN { ##1 } \@@_split_active:nw \s_@@_mark }
+ \cs_new:Npn \@@_split_active:nw ##1 ##2 #2 ##3 \s_@@_stop
{
- \@@_trim:nN { ##1 } \@@_split_active:nw \s_@@_mark
+ \@@_if_empty:w \s_@@_mark ##3 \s_@@_stop
+ \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn
+ { \@@_misplaced_equal_error: \use_none:n }
+ { \@@_trim:nN { ##2 } \@@_key_val:nnN { ##1 } }
}
- \cs_new:Npn \@@_split_active:nw ##1 ##2 #2 ##3 \s_@@_stop
- {
- \@@_if_empty:w \s_@@_mark ##3 \s_@@_stop
- \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn
- { \@@_misplaced_equal_error: \use_none:n }
- { \@@_trim:nN { ##2 } \@@_key_val:nnN { ##1 } }
- }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1062,9 +1058,7 @@
% active equals sign and then runs the test for an empty argument.
% \begin{macrocode}
\cs_new:Npn \@@_if_has_equal_active:w ##1 #2
- {
- \@@_if_empty:w \s_@@_mark
- }
+ { \@@_if_empty:w \s_@@_mark }
% \end{macrocode}
% \end{macro}
%
@@ -1089,14 +1083,14 @@
\s_@@_mark \s_@@_tail
\@@_loop_other:NNw #1 , \s_@@_tail ,
\@@_loop_active:NNw #2 \s_@@_mark
- {}
+ { }
\cs_new:Npn \@@_end_loop_other:w
\s_@@_mark \s_@@_tail
\@@_if_has_equal_other:w #1 = \s_@@_stop
\@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn
#2
\@@_loop_other:NNw #3 \s_@@_mark
- {}
+ { }
% \end{macrocode}
% \end{macro}
%
@@ -1106,16 +1100,14 @@
% equals signs of category other.
% \begin{macrocode}
\cs_new:Npn \@@_split_other:w #1 =
+ { \@@_trim:nN { #1 } \@@_split_other:nw \s_@@_mark }
+\cs_new:Npn \@@_split_other:nw #1 #2 = #3 \s_@@_stop
{
- \@@_trim:nN { #1 } \@@_split_other:nw \s_@@_mark
+ \@@_if_empty:w \s_@@_mark #3 \s_@@_stop
+ \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn
+ { \@@_misplaced_equal_error: \use_none:n }
+ { \@@_trim:nN { #2 } \@@_key_val:nnN { #1 } }
}
- \cs_new:Npn \@@_split_other:nw #1 #2 = #3 \s_@@_stop
- {
- \@@_if_empty:w \s_@@_mark #3 \s_@@_stop
- \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn
- { \@@_misplaced_equal_error: \use_none:n }
- { \@@_trim:nN { #2 } \@@_key_val:nnN { #1 } }
- }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1126,9 +1118,7 @@
% them.
% \begin{macrocode}
\cs_new:Npn \@@_key:nN #1 #2
- {
- \exp_not:n { #2 { #1 } }
- }
+ { \exp_not:n { #2 { #1 } } }
% \end{macrocode}
% \end{macro}
%
@@ -1166,9 +1156,7 @@
\cs_new:Npn \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn #1 #2 { #2 }
\cs_new:Npn \@@_blank_true:w \s_@@_mark \s_@@_stop \use:n #1 {}
\cs_new:Npn \@@_empty_key:w \s_@@_mark \s_@@_stop \exp_not:n #1
- {
- \@@_misplaced_equal_error:
- }
+ { \@@_misplaced_equal_error: }
% \end{macrocode}
% \end{macro}
%
@@ -1176,9 +1164,7 @@
% Another test that works by gobbling tokens until a specific one is hit.
% \begin{macrocode}
\cs_new:Npn \@@_if_has_equal_other:w #1 =
- {
- \@@_if_empty:w \s_@@_mark
- }
+ { \@@_if_empty:w \s_@@_mark }
% \end{macrocode}
% \end{macro}
%
@@ -1189,9 +1175,7 @@
% doesn't have to be fast anyway.
% \begin{macrocode}
\cs_new:Npn \@@_misplaced_equal_error:
- {
- \__kernel_msg_expandable_error:nn { kernel } { misplaced-equals-sign }
- }
+ { \__kernel_msg_expandable_error:nn { kernel } { misplaced-equals-sign } }
% \end{macrocode}
% \end{macro}
%
@@ -1360,7 +1344,7 @@
% be explicitly no-value, it must be a token list.
% \begin{macrocode}
\tl_new:N \l_@@_relative_tl
-\tl_set:Nn \l_@@_relative_tl { \q_no_value }
+\tl_set:Nn \l_@@_relative_tl { \q_@@_no_value }
% \end{macrocode}
% \end{variable}
%
@@ -1412,6 +1396,49 @@
% \end{macrocode}
% \end{variable}
%
+% \subsubsection{Internal auxiliaries}
+%
+% \begin{variable}{\s_@@_stop}
+% Internal scan marks.
+% \begin{macrocode}
+\scan_new:N \s_@@_stop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\q_@@_nil,\q_@@_no_value}
+% Internal quarks.
+% \begin{macrocode}
+\quark_new:N \q_@@_nil
+\quark_new:N \q_@@_no_value
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[pTF]{\@@_if_nil:n}
+% Branching quark conditional.
+% \begin{macrocode}
+\__kernel_quark_conditional_generate:NNnn \@@_if_nil:n
+ \q_@@_nil { @@ } { TF }
+\__kernel_quark_conditional_generate:NNnn \@@_if_no_value:N
+ \q_@@_no_value { @@ } { TF }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\q_@@_recursion_tail,\q_@@_recursion_stop}
+% Internal recursion quarks.
+% \begin{macrocode}
+\quark_new:N \q_@@_recursion_tail
+\quark_new:N \q_@@_recursion_stop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[EXP]{\@@_if_recursion_tail_stop:n}
+% Functions to query recursion quarks.
+% \begin{macrocode}
+\__kernel_quark_test_generate:NNNn \@@_if_recursion_tail_stop:n
+ \q_@@_recursion_tail \q_@@_recursion_stop { @@ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{The key defining mechanism}
%
% \begin{macro}{\keys_define:nn}
@@ -1461,7 +1488,7 @@
\str_if_empty:NF \l_@@_property_str
{
\__kernel_msg_error:nnxx { kernel } { key-property-unknown }
- { \l_@@_property_str } { \l_keys_path_str }
+ { \l_@@_property_str } { \l_keys_path_str }
}
}
}
@@ -1480,9 +1507,9 @@
{
\str_set:Nx \l_@@_property_str { \@@_trim_spaces:n {#1} }
\exp_after:wN \@@_property_find:w \l_@@_property_str . .
- \q_stop {#1}
+ \s_@@_stop {#1}
}
-\cs_new_protected:Npn \@@_property_find:w #1 . #2 . #3 \q_stop #4
+\cs_new_protected:Npn \@@_property_find:w #1 . #2 . #3 \s_@@_stop #4
{
\tl_if_blank:nTF {#3}
{
@@ -1496,18 +1523,18 @@
{
\str_if_empty:NF \l_@@_module_str
{ \l_@@_module_str / }
- \tl_trim_spaces:n {#1}
+ \tl_trim_spaces:n {#1}
}
\str_set:Nn \l_@@_property_str { . #2 }
}
{
\str_set:Nx \l_keys_path_str { \l_@@_module_str / #1 . #2 }
- \@@_property_search:w #3 \q_stop
+ \@@_property_search:w #3 \s_@@_stop
}
\tl_set_eq:NN \l_keys_path_tl \l_keys_path_str
}
}
-\cs_new_protected:Npn \@@_property_search:w #1 . #2 \q_stop
+\cs_new_protected:Npn \@@_property_search:w #1 . #2 \s_@@_stop
{
\str_if_eq:nnTF {#2} { . }
{
@@ -1516,7 +1543,7 @@
}
{
\str_set:Nx \l_keys_path_str { \l_keys_path_str . #1 }
- \@@_property_search:w #2 \q_stop
+ \@@_property_search:w #2 \s_@@_stop
}
}
% \end{macrocode}
@@ -1536,18 +1563,18 @@
\bool_if:NTF \l_@@_no_value_bool
{
\exp_after:wN \@@_define_code:w
- \l_@@_property_str \q_stop
+ \l_@@_property_str \s_@@_stop
{ \use:c { \c_@@_props_root_str \l_@@_property_str } }
{
\__kernel_msg_error:nnxx { kernel }
{ key-property-requires-value } { \l_@@_property_str }
{ \l_keys_path_str }
- }
+ }
}
{ \use:c { \c_@@_props_root_str \l_@@_property_str } {#1} }
}
\exp_last_unbraced:NNNNo
- \cs_new:Npn \@@_define_code:w #1 \c_colon_str #2 \q_stop
+ \cs_new:Npn \@@_define_code:w #1 \c_colon_str #2 \s_@@_stop
{ \tl_if_empty:nTF {#2} }
% \end{macrocode}
% \end{macro}
@@ -1800,7 +1827,7 @@
\exp_after:wN \@@_find_key_module:NNw
\exp_after:wN \l_@@_tmpa_tl
\exp_after:wN \l_@@_tmpb_tl
- \l_keys_path_str / \q_stop
+ \l_keys_path_str / \s_@@_stop
\@@_cmd_set:nx { \l_keys_path_str }
{
\exp_not:c { prop_ #2 put:Nnn }
@@ -2277,7 +2304,7 @@
\bool_set_false:N \exp_not:N \l_@@_filtered_bool
\bool_set_false:N \exp_not:N \l_@@_selective_bool
\tl_set:Nn \exp_not:N \l_@@_relative_tl
- { \exp_not:N \q_no_value }
+ { \exp_not:N \q_@@_no_value }
\@@_set:nn \exp_not:n { {#1} {#2} }
\bool_if:NT \l_@@_only_known_bool
{ \bool_set_true:N \exp_not:N \l_@@_only_known_bool }
@@ -2328,7 +2355,7 @@
\cs_new_protected:Npn \keys_set_known:nnN #1#2#3
{
\exp_args:No \@@_set_known:nnnnN
- \l_@@_unused_clist { \q_no_value } {#1} {#2} #3
+ \l_@@_unused_clist { \q_@@_no_value } {#1} {#2} #3
}
\cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no }
\cs_new_protected:Npn \keys_set_known:nnnN #1#2#3#4
@@ -2345,7 +2372,7 @@
\tl_set:Nn \l_@@_unused_clist {#1}
}
\cs_new_protected:Npn \keys_set_known:nn #1#2
- { \@@_set_known:nnn { \q_no_value } {#1} {#2} }
+ { \@@_set_known:nnn { \q_@@_no_value } {#1} {#2} }
\cs_generate_variant:Nn \keys_set_known:nn { nV , nv , no }
\cs_new_protected:Npn \@@_set_known:nnn #1#2#3
{
@@ -2406,7 +2433,7 @@
{
\exp_args:No \@@_set_filter:nnnnnN
\l_@@_unused_clist
- { \q_no_value } {#1} {#2} {#3} #4
+ { \q_@@_no_value } {#1} {#2} {#3} #4
}
\cs_generate_variant:Nn \keys_set_filter:nnnN { nnV , nnv , nno }
\cs_new_protected:Npn \keys_set_filter:nnnnN #1#2#3#4#5
@@ -2423,7 +2450,7 @@
\tl_set:Nn \l_@@_unused_clist {#1}
}
\cs_new_protected:Npn \keys_set_filter:nnn #1#2#3
- {\@@_set_filter:nnnn { \q_no_value } {#1} {#2} {#3} }
+ {\@@_set_filter:nnnn { \q_@@_no_value } {#1} {#2} {#3} }
\cs_generate_variant:Nn \keys_set_filter:nnn { nnV , nnv , nno }
\cs_new_protected:Npn \@@_set_filter:nnnn #1#2#3#4
{
@@ -2452,7 +2479,7 @@
\bool_set_false:N \exp_not:N \l_@@_filtered_bool
\bool_set_true:N \exp_not:N \l_@@_selective_bool
\tl_set:Nn \exp_not:N \l_@@_relative_tl
- { \exp_not:N \q_no_value }
+ { \exp_not:N \q_@@_no_value }
\@@_set_selective:nnn \exp_not:n { {#1} {#2} {#3} }
\bool_if:NT \l_@@_only_known_bool
{ \bool_set_true:N \exp_not:N \l_@@_only_known_bool }
@@ -2522,7 +2549,7 @@
\exp_after:wN \@@_find_key_module:NNw
\exp_after:wN \l_@@_module_str
\exp_after:wN \l_keys_key_str
- \l_keys_path_str / \q_stop
+ \l_keys_path_str / \s_@@_stop
\tl_set_eq:NN \l_keys_key_tl \l_keys_key_str
\@@_value_or_default:n {#3}
\bool_if:NTF \l_@@_selective_bool
@@ -2531,7 +2558,7 @@
\str_set:Nn \l_@@_module_str {#1}
}
\cs_generate_variant:Nn \@@_set_keyval:nnn { o }
-\cs_new_protected:Npn \@@_find_key_module:NNw #1#2#3 / #4 \q_stop
+\cs_new_protected:Npn \@@_find_key_module:NNw #1#2#3 / #4 \s_@@_stop
{
\tl_if_blank:nTF {#4}
{ \str_set:Nn #2 {#3} }
@@ -2541,7 +2568,7 @@
\str_if_empty:NF #1 { / }
#3
}
- \@@_find_key_module:NNw #1#2 #4 \q_stop
+ \@@_find_key_module:NNw #1#2 #4 \s_@@_stop
}
}
% \end{macrocode}
@@ -2727,7 +2754,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_store_unused:
{
- \quark_if_no_value:NTF \l_@@_relative_tl
+ \@@_if_no_value:NTF \l_@@_relative_tl
{
\clist_put_right:Nx \l_@@_unused_clist
{
@@ -2758,7 +2785,7 @@
\cs_set_protected:Npn \@@_store_unused:w
####1 \l_@@_relative_tl /
####2 \l_@@_relative_tl /
- ####3 \exp_not:N \q_stop
+ ####3 \exp_not:N \s_@@_stop
}
{
\tl_if_blank:nF {##1}
@@ -2778,7 +2805,7 @@
{
\@@_store_unused:w \l_keys_path_str
\l_@@_relative_tl / \l_@@_relative_tl /
- \exp_not:N \q_stop
+ \exp_not:N \s_@@_stop
}
}
\cs_new_protected:Npn \@@_store_unused:w { }
@@ -2824,9 +2851,9 @@
% Used to strip off the ending part of the key path after the last~|/|.
% \begin{macrocode}
\cs_new:Npn \@@_parent:n #1
- { \@@_parent:w #1 / / \q_stop { } }
+ { \@@_parent:w #1 / / \s_@@_stop { } }
\cs_generate_variant:Nn \@@_parent:n { o }
-\cs_new:Npn \@@_parent:w #1 / #2 / #3 \q_stop #4
+\cs_new:Npn \@@_parent:w #1 / #2 / #3 \s_@@_stop #4
{
\tl_if_blank:nTF {#2}
{
@@ -2834,7 +2861,7 @@
{ \use_none:n #4 }
}
{
- \@@_parent:w #2 / #3 \q_stop { #4 / #1 }
+ \@@_parent:w #2 / #3 \s_@@_stop { #4 / #1 }
}
}
% \end{macrocode}
@@ -2854,22 +2881,22 @@
\cs_new:Npn \@@_trim_spaces:n #1
{
\exp_after:wN \@@_trim_spaces_auxi:w \tl_to_str:n {#1}
- / \q_nil \q_stop
+ / \q_@@_nil \s_@@_stop
}
-\cs_new:Npn \@@_trim_spaces_auxi:w #1 / #2 \q_stop
+\cs_new:Npn \@@_trim_spaces_auxi:w #1 / #2 \s_@@_stop
{
- \quark_if_nil:nTF {#2}
+ \@@_if_nil:nTF {#2}
{ \tl_trim_spaces:n {#1} }
{ \@@_trim_spaces_auxii:w #1 / #2 }
}
-\cs_new:Npn \@@_trim_spaces_auxii:w #1 / #2 / \q_nil
+\cs_new:Npn \@@_trim_spaces_auxii:w #1 / #2 / \q_@@_nil
{
\tl_trim_spaces:n {#1}
- \@@_trim_spaces_auxiii:w #2 / \q_recursion_tail / \q_recursion_stop
+ \@@_trim_spaces_auxiii:w #2 / \q_@@_recursion_tail / \q_@@_recursion_stop
}
\cs_set:Npn \@@_trim_spaces_auxiii:w #1 /
{
- \quark_if_recursion_tail_stop:n {#1}
+ \@@_if_recursion_tail_stop:n {#1}
/ \tl_trim_spaces:n { #1 }
\@@_trim_spaces_auxiii:w
}
diff --git a/l3kernel/testfiles/m3quark001.tlg b/l3kernel/testfiles/m3quark001.tlg
index 959538c69..3c524f736 100644
--- a/l3kernel/testfiles/m3quark001.tlg
+++ b/l3kernel/testfiles/m3quark001.tlg
@@ -80,14 +80,10 @@ l. ...}
This is a coding error.
LaTeX has been asked to create a new scan mark '\s__foo' but this name has
already been used for a scan mark.
-> \g__scan_marks_tl=\s_stop \s__tl_nil \s__tl_mark \s__tl_stop \s__str_mark
-\s__str_stop \s__seq \s__seq_mark \s__seq_stop \s__int_mark \s__int_stop
-\s__clist_mark \s__clist_stop \s__char_stop \s__token_stop \s__peek_mark
-\s__peek_stop \s__prop \s__prop_mark \s__prop_stop \s__msg_mark \s__msg_stop
-\s__iow_mark \s__iow_stop \s__file_stop \s__dim_mark \s__dim_stop
-\s__skip_stop \s__keyval_nil \s__keyval_mark \s__keyval_stop \s__keyval_tail
-\s__fp \s__fp_mark \s__fp_stop \s__fp_invalid \s__fp_underflow \s__fp_overflow
-\s__fp_division \s__fp_exact \s__fp_tuple \s__tl \s__foo .
+> \g__scan_marks_tl=\s_stop \s__seq \s__prop \s__keyval_nil \s__keyval_mark
+\s__keyval_stop \s__keyval_tail \s__fp \s__fp_mark \s__fp_stop \s__fp_invalid
+\s__fp_underflow \s__fp_overflow \s__fp_division \s__fp_exact \s__fp_tuple
+\s__tl \s__foo .
============================================================
============================================================
TEST 14: Use none until s__stop (expect nothing)
More information about the latex3-commits
mailing list.