diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md index 4248d4170f..d3c297a0b1 100644 --- a/l3kernel/CHANGELOG.md +++ b/l3kernel/CHANGELOG.md @@ -8,7 +8,7 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] ### Added -- `\keys_digiest:nnN` for conversion of keyvals to fast-to-apply token +- `\keys_precompile:Nnn` for conversion of keyvals to fast-to-apply token lists ## [2022-02-24] diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx index 932a421938..f48b9e9b5f 100644 --- a/l3kernel/l3keys.dtx +++ b/l3kernel/l3keys.dtx @@ -884,13 +884,13 @@ % % \section{Digesting keys} % -% \begin{function}[added = 2022-02-28]{\keys_digest:nnN} +% \begin{function}[added = 2022-03-04]{\keys_precompile:Nnn} % \begin{syntax} -% \cs{keys_digest:nnN} \Arg{module} \Arg{keyval list} \meta{tl} +% \cs{keys_precompile:Nnn} \meta{tl} \Arg{module} \Arg{keyval list} % \end{syntax} % Parses the \meta{keyval list} as for \cs{keys_set:nn}, placing the % resulting code for those which set variables or functions into the -% \meta{tl}. Thus this function \enquote{digests} the keyval list into +% \meta{tl}. Thus this function \enquote{precompiles} the keyval list into % a set of results which can be applied rapidly. % \end{function} % @@ -1673,11 +1673,11 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_digest_bool, \l_@@_digest_tl} +% \begin{variable}{\l_@@_precompile_bool, \l_@@_precompile_tl} % For digesting keys. % \begin{macrocode} -\bool_new:N \l_@@_digest_bool -\tl_new:N \l_@@_digest_tl +\bool_new:N \l_@@_precompile_bool +\tl_new:N \l_@@_precompile_tl % \end{macrocode} % \end{variable} % @@ -1983,8 +1983,8 @@ { \@@_cmd_set_direct:nn {#1} { - \bool_if:NTF \l_@@_digest_bool - { \tl_put_right:Nn \l_@@_digest_tl } + \bool_if:NTF \l_@@_precompile_bool + { \tl_put_right:Nn \l_@@_precompile_tl } { \use:n } {#2} } @@ -2004,8 +2004,8 @@ { \cs_set_protected:cpx { \c_@@_code_root_str \l_keys_path_str } ##1 { - \exp_not:N \bool_if:NTF \exp_not:N \l_@@_digest_bool - { \tl_put_right:Nn \exp_not:N \l_@@_digest_tl } + \exp_not:N \bool_if:NTF \exp_not:N \l_@@_precompile_bool + { \tl_put_right:Nn \exp_not:N \l_@@_precompile_tl } { \exp_not:N \use:n } { #1 \exp_not:N #2 \exp_not:n {#3} {##1} } } @@ -2937,16 +2937,16 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\keys_digest:nnN} +% \begin{macro}{\keys_precompile:Nnn} % A simple wrapper. % \begin{macrocode} -\cs_new_protected:Npn \keys_digest:nnN #1#2#3 +\cs_new_protected:Npn \keys_precompile:Nnn #1#2#3 { - \bool_set_true:N \l_@@_digest_bool - \tl_clear:N \l_@@_digest_tl - \keys_set:nn {#1} {#2} - \bool_set_false:N \l_@@_digest_bool - \tl_set_eq:NN #3 \l_@@_digest_tl + \bool_set_true:N \l_@@_precompile_bool + \tl_clear:N \l_@@_precompile_tl + \keys_set:nn {#2} {#3} + \bool_set_false:N \l_@@_precompile_bool + \tl_set_eq:NN #1 \l_@@_precompile_tl } % \end{macrocode} % \end{macro} diff --git a/l3kernel/testfiles/m3keys008.lvt b/l3kernel/testfiles/m3keys008.lvt index dbf1684f96..496cf95316 100644 --- a/l3kernel/testfiles/m3keys008.lvt +++ b/l3kernel/testfiles/m3keys008.lvt @@ -15,7 +15,7 @@ \AUTHOR{Joseph Wright} \ExplSyntaxOn -\TEST { Key~digestion~of~settings } +\TEST { Key~precompilation~of~settings } { \OMIT \keys_define:nn { test } @@ -34,7 +34,9 @@ key-twelve .tl_set_x:N = \l_tmpb_tl } \TIMO - \keys_digest:nnN { test } + \keys_precompile:Nnn + \l_tmpa_tl + { test } { key-one = true , key-two = { a , b } , @@ -49,11 +51,10 @@ key-eleven = footoo , key-twelve = \l_tmpa_tl } - \l_tmpa_tl \tl_show:N \l_tmpa_tl } -\TEST { Digesting~choices } +\TEST { Precompiling~choices } { \OMIT \keys_define:nn { test } @@ -73,17 +74,18 @@ {#1} } \TIMO - \keys_digest:nnN { test } + \keys_precompile:Nnn + \l_tmpa_tl + { test } { key-one = choice-one , key-one = choice-three , key-two = choice-one , key-two = choice-three , key-three = choice-one , key-three = choice-three } - \l_tmpa_tl \tl_show:N \l_tmpa_tl } -\TEST { Digesting~meta~keys } +\TEST { Precompiling~meta~keys } { \OMIT \keys_define:nn { test } @@ -92,11 +94,12 @@ key-two .meta:n = {key-one = "#1"} } \TIMO - \keys_digest:nnN { test } + \keys_precompile:Nnn + \l_tmpa_tl + { test } { key-one = AAA, key-two = BBB } - \l_tmpa_tl \tl_show:N \l_tmpa_tl } diff --git a/l3kernel/testfiles/m3keys008.tlg b/l3kernel/testfiles/m3keys008.tlg index 7e5ca10e0e..fc76f6098d 100644 --- a/l3kernel/testfiles/m3keys008.tlg +++ b/l3kernel/testfiles/m3keys008.tlg @@ -2,7 +2,7 @@ This is a generated file for the LaTeX (2e + expl3) validation system. Don't change this file in any respect. Author: Joseph Wright ============================================================ -TEST 1: Key digestion of settings +TEST 1: Key precompilation of settings ============================================================ > \l_tmpa_tl=\bool_set_false:N \l_tmpa_bool \clist_set:Nn \l_tmpa_clist {a,b}foo\cs_set:Npn \foo ##1##2{##1:##2}\dim_set:Nn \l_tmpa_dim @@ -14,7 +14,7 @@ TEST 1: Key digestion of settings l. ... } ============================================================ ============================================================ -TEST 2: Digesting choices +TEST 2: Precompiling choices ============================================================ > \l_tmpa_tl=AAAACCCCAAAACCCC\tl_set:Nn \l_keys_choice_tl {choice-one}\int_set:Nn \l_keys_choice_int {1}choice-one\tl_set:Nn @@ -24,7 +24,7 @@ TEST 2: Digesting choices l. ... } ============================================================ ============================================================ -TEST 3: Digesting meta keys +TEST 3: Precompiling meta keys ============================================================ > \l_tmpa_tl=AAA"BBB". }