diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3keys.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3keys.dtx | 166 |
1 files changed, 95 insertions, 71 deletions
diff --git a/macros/latex/contrib/l3kernel/l3keys.dtx b/macros/latex/contrib/l3kernel/l3keys.dtx index f00f95309c..b3630af0b1 100644 --- a/macros/latex/contrib/l3kernel/l3keys.dtx +++ b/macros/latex/contrib/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-05-05} +% \date{Released 2020-05-11} % % \maketitle % @@ -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,46 @@ % \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]{\@@_quark_if_nil:n} +% Branching quark conditional. +% \begin{macrocode} +\__kernel_quark_new_conditional:Nn \@@_quark_if_nil:n { TF } +\__kernel_quark_new_conditional:Nn \@@_quark_if_no_value:N { 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_new_test:N \@@_if_recursion_tail_stop:n +% \end{macrocode} +% \end{macro} +% % \subsection{The key defining mechanism} % % \begin{macro}{\keys_define:nn} @@ -1461,7 +1485,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 +1504,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 +1520,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 +1540,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 +1560,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 +1824,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 +2301,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 +2352,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 +2369,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 +2430,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 +2447,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 +2476,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 +2546,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 +2555,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 +2565,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} @@ -2722,12 +2746,12 @@ % When there is no relative path, things here are easy: just save the key % name and value. When we are working with a relative path, first we % need to turn it into a string: that can't happen earlier as we need -% to store \cs{q_no_value}. Then, use a standard delimited approach to fish +% to store \cs{q_@@_no_value}. Then, use a standard delimited approach to fish % out the partial path. % \begin{macrocode} \cs_new_protected:Npn \@@_store_unused: { - \quark_if_no_value:NTF \l_@@_relative_tl + \@@_quark_if_no_value:NTF \l_@@_relative_tl { \clist_put_right:Nx \l_@@_unused_clist { @@ -2758,7 +2782,7 @@ \cs_set_protected:Npn \@@_store_unused:w ####1 \l_@@_relative_tl / ####2 \l_@@_relative_tl / - ####3 \exp_not:N \q_stop + ####3 \s_@@_stop } { \tl_if_blank:nF {##1} @@ -2778,7 +2802,7 @@ { \@@_store_unused:w \l_keys_path_str \l_@@_relative_tl / \l_@@_relative_tl / - \exp_not:N \q_stop + \s_@@_stop } } \cs_new_protected:Npn \@@_store_unused:w { } @@ -2824,9 +2848,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 +2858,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 +2878,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} + \@@_quark_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 } |