diff options
author | Karl Berry <karl@freefriends.org> | 2023-05-20 20:19:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-05-20 20:19:04 +0000 |
commit | 06cccdee5db849d30c6de6e7981c6015b7772342 (patch) | |
tree | 22de2f7e4c6d584a0fe9603dfebe8ff4c22234ab /Master | |
parent | a43800967f1d2f3e26c6ee31e4d3be5ce4134930 (diff) |
starray (20may23)
git-svn-id: svn://tug.org/texlive/trunk@67173 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/starray/README.md | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/starray/starray.pdf | bin | 217076 -> 266666 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/starray/starray.tex | 101 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/starray/starray.sty | 176 |
4 files changed, 239 insertions, 43 deletions
diff --git a/Master/texmf-dist/doc/latex/starray/README.md b/Master/texmf-dist/doc/latex/starray/README.md index d783c91e1e0..3e5aec2fea8 100644 --- a/Master/texmf-dist/doc/latex/starray/README.md +++ b/Master/texmf-dist/doc/latex/starray/README.md @@ -73,6 +73,11 @@ The Current Maintainer of this work is Alceu Frigeri ## Changelog +* Version 1.2 (this) + - Issues #3 + - added expandable versions of some commands (see manual) + - documentation + * Version 1.1 - Issues #1/#2 - most/all commands are protected now diff --git a/Master/texmf-dist/doc/latex/starray/starray.pdf b/Master/texmf-dist/doc/latex/starray/starray.pdf Binary files differindex 01eb376434e..5fef74c7312 100644 --- a/Master/texmf-dist/doc/latex/starray/starray.pdf +++ b/Master/texmf-dist/doc/latex/starray/starray.pdf diff --git a/Master/texmf-dist/doc/latex/starray/starray.tex b/Master/texmf-dist/doc/latex/starray/starray.tex index a18117ac377..d52e6ec1014 100644 --- a/Master/texmf-dist/doc/latex/starray/starray.tex +++ b/Master/texmf-dist/doc/latex/starray/starray.tex @@ -15,7 +15,7 @@ %% %% The Current Maintainer of this work is Alceu Frigeri %% -%% This is version 1.1 (2023/05/16) +%% This is version 1.2 (2023/05/20) %% %% The list of files that compose this work can be found in the README.md file at %% https://ctan.org/pkg/starray @@ -29,7 +29,7 @@ \RequirePackage[inline]{enumitem} \SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex} - +\RequirePackage[hidelinks,hypertexnames=false]{hyperref} \begin{document} \tstitle{ author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/starray}}}, @@ -62,9 +62,8 @@ The current implementation, albeit also complex, tries to reach a balance betwee \end{tsremark} \begin{tsremark}[\color{red}Important:] - \textsl{Expandability}, unfortunately most/all defined functions are not ''fully expandable'', in particular, the conditional/branching functions aren't. This means, among other things, one can't have a 'predicated variant' of any conditional defined in this (for instance, to be used in a boolean expression). + \textsl{Expandability}, unfortunately most/all defined functions are not ''fully expandable'', in particular, most conditional/branching functions aren't, with just a few exceptions (marked with a star \ding{72}, as per \tsobj[pkg]{expl3} documentation convention). - For what it's worth, all user visible functions are 'protected'. \end{tsremark} @@ -100,12 +99,27 @@ By default, the \tsobj[pkg]{starray} package only generates ''warnings'', with \ \tsmacro{\starray_new:n}{starray} \tsmacro{\starray_new:nTF}{starray,if-true,if-false} \end{codesyntax} -\end{codedescribe} Creates a new \tsobj[marg]{starray} or raises a warning if the name is already taken. The declaration (and associated property lists) is global. The given name is referred (in this text) as the \tsobj[marg]{starray-root} or just \tsobj[marg]{root}. +\end{codedescribe} \begin{tsremark} A warning is raised (see \ref{pack:options}) if the name is already taken. The branching version doesn't raise any warning. \end{tsremark} +\subsection{Conditionals}\label{conditionals:exist} +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_if_exist_p:n,\starray_if_exist:nTF,\starray_if_valid_p:n,\starray_if_valid:nTF} +\begin{codesyntax}% +\tsmacro{\starray_if_exist_p:n}{starray} +\tsmacro{\starray_if_exist:nTF}{starray,if-true,if-false} +\tsmacro{\starray_if_valid_p:n}{starray} +\tsmacro{\starray_if_valid:nTF}{starray,if-true,if-false} +\end{codesyntax} +\tsobj{\starray_if_exist:nTF} only tests if \tsobj[marg]{starray} (the base property) is defined. It doesn't verifies if it really is a \tsobj[pkg]{starray}. +\tsobj{\starray_if_valid:nTF} further tests if an internal boolean (\tsobj[key]{is\_starray}) is also defined. This doesn't necessary mean it is a \tsobj[pkg]{starray} or if it's a really valid one (chances are that it is, but...), see \tsobj{\starray_term_syntax:nTF}, section \ref{conditionals:terms}, for a more reliable validity test. +\end{codedescribe} +\begin{tsremark} +The predicate versions, \tsobj{_p}, expand to either \tsobj{\prg_return_true:} or \tsobj{\prg_return_false:}. +\end{tsremark} + \section{Defining and initialising a starray structure}\label{pack:def} \begin{codedescribe}{\starray_def_prop:nnn,\starray_def_prop:nnnTF} @@ -448,6 +462,17 @@ Before the reset \tsobj[marg]{st-root.subY.subYYY} was equivalent to \tsobj[marg A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. \end{tsremark} +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_iter:} +\begin{codesyntax}% +\tsobj{\starray_parsed_get_iter:}{} +\end{codesyntax} +\tsobj{\starray_parsed_get_iter:} will place in the current iterator's value, using \tsobj{\int_use:N}, of the last parsed term in the input stream. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} + + \begin{codedescribe}{\starray_get_cnt:n,\starray_get_cnt:nN,\starray_get_cnt:nNTF} \begin{codesyntax}% \tsmacro{\starray_get_cnt:n}{starray-ref} @@ -460,6 +485,17 @@ A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-r A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. \end{tsremark} +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_cnt:} +\begin{codesyntax}% +\tsobj{\starray_parsed_get_cnt:}{} +\end{codesyntax} +\tsobj{\starray_parsed_get_cnt:} will place the current number of terms, using \tsobj{\int_use:N}, of the last parsed term, in the input stream. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} + + \section{Changing and recovering starray properties}\label{pack:get/set} \begin{codedescribe}{\starray_set_prop:nnn,\starray_set_prop:nnV,\starray_set_prop:nnnTF,\starray_set_prop:nnVTF,\starray_gset_prop:nnn,\starray_gset_prop:nnV,\starray_gset_prop:nnnTF,\starray_gset_prop:nnVTF} @@ -537,17 +573,68 @@ Also note that the above example is fully equivalent to: \tscode*[codeprefix=~]{keyval.demo9} +\begin{codedescribe}{\starray_get_prop:nn,\starray_get_prop:nnN,\starray_get_prop:nnNTF} +\begin{codesyntax}% +\tsmacro{\starray_get_prop:nn}{starray-ref,key} +\tsmacro{\starray_get_prop:nnN}{starray-ref,key,tl-var} +\tsmacro{\starray_get_prop:nnNTF}{starray-ref,key,tl-var,if-true,if-false} +\end{codesyntax} +\tsmacro{\starray_get_prop:nn}{starray-ref,key} places the value of \tsobj[marg]{key} in the input stream. +\tsmacro{\starray_get_prop:nnN}{starray-ref,key,tl-var} recovers the value of \tsobj[marg]{key} and places it in \tsobj[marg]{tl-var} (a token list variable), this is specially useful in conjunction with \tsobj{\starray_set_prop:nnV}, whilst the \tsobj{\starray_get_prop:nnNTF} version branches accordly. +\end{codedescribe} +\begin{tsremark} +In case of a syntax error, or \tsobj[marg]{key} doesn't exist, an empty value is left in the stream (or \tsobj[marg]{tl-var}). +\end{tsremark} +\begin{tsremark} +A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. +\end{tsremark} + + +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_prop:n} +\begin{codesyntax}% +\tsmacro{\starray_parsed_get_prop:nn}{key} +\end{codesyntax} +\tsmacro{\starray_parsed_get_prop:n}{key} places the value of \tsobj[marg]{key}, if it exists, from the last parsed term, in the input stream. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} + -\section{Additional Conditionals}\label{pack:extra} +\section{Additional Commands and Conditionals}\label{conditionals:terms} \begin{codedescribe}{\starray_if_in:nnTF,\starray_term_syntax:nTF} \begin{codesyntax}% \tsmacro{\starray_if_in:nnTF}{starray-ref,key,if-true,if-false} \tsmacro{\starray_term_syntax:nTF}{starray-ref,if-true,if-false} \end{codesyntax} +The \tsmacro{\starray_if_in:nnTF}{starray-ref,key,\ldots,\ldots} tests if a given \tsobj[marg]{key} is present, whilst \tsmacro{\starray_term_syntax:nTF}{starray-ref,if-true,if-false} just verifies if the \tsobj[marg]{starray-ref} syntax is valid or not, branching accordly. \end{codedescribe} -The \tsmacro{\starray_if_in:nnTF}{starray-ref,key,\ldots,\ldots} tests if a given \tsobj[marg]{key} is present, whilst \tsmacro{\starray_term_syntax:nTF}{starray-ref,\ldots,\ldots} just verifies if the \tsobj[marg]{starray-ref} syntax is valid or not, branching accordly. +\begin{codedescribe}{\starray_term_syntax:n} +\begin{codesyntax}% +\tsmacro{\starray_term_syntax:n}{starray-ref} +\end{codesyntax} +This will just parse a \tsobj[marg]{starray-ref} reference, and set interval variables so that commands like \tsobj{\starray_parsed_} can be used. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +The main idea is to allow some expandable commands, but be aware that all \tsobj{\starray_} commands that use a \tsobj[marg]{starray-ref} use the very same parser variables. +\end{tsremark} + + +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_if_in_p:n,\starray_parsed_if_in:nTF} +\begin{codesyntax}% +\tsmacro{\starray_parsed_if_in_p:nTF}{key} +\tsmacro{\starray_parsed_if_in:nTF}{key,if-true,if-false} +\end{codesyntax} +This will test if the given \tsobj[key]{key} is present in the "last parsed term". +\end{codedescribe} +\begin{tsremark} +The predicate version, \tsobj{_p}, expands to either \tsobj{\prg_return_true:} or \tsobj{\prg_return_false:}. +\end{tsremark} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} \section{Showing (debugging) starrays }\label{pack:show} diff --git a/Master/texmf-dist/tex/latex/starray/starray.sty b/Master/texmf-dist/tex/latex/starray/starray.sty index c94304d0b16..a475c3d0985 100644 --- a/Master/texmf-dist/tex/latex/starray/starray.sty +++ b/Master/texmf-dist/tex/latex/starray/starray.sty @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Alceu Frigeri %% -%% This is version 1.1 (2023/05/16) +%% This is version 1.2 (2023/05/20) %% %% The list of files that compose this work can be found in the README.md file at %% https://ctan.org/pkg/starray @@ -24,8 +24,8 @@ \ProvidesExplPackage {starray} - {2023/05/16} - {1.0} + {2023/05/20} + {1.2} {A structured array/hash of properties} %%%%%%% @@ -38,8 +38,8 @@ { name .code:n = starray , prefix .code:n = starray , - date .code:n = 2023/05/16 , - version .code:n = 1.1 , + date .code:n = 2023/05/20 , + version .code:n = 1.2 , description .code:n = A~structured~array/hash~of~properties } \cs_if_exist:NF \__codedesc_pkg_info:nn @@ -129,7 +129,7 @@ \cs_generate_variant:Nn \tl_put_right:Nn {Ne} \cs_generate_variant:Nn \tl_gput_right:Nn {Ne} \cs_generate_variant:Nn \tl_set:Nn {Ne , ce} -\cs_generate_variant:Nn \tl_gset:Nn {Ne , ce} +\cs_generate_variant:Nn \tl_gset:Nn {Ne , ce} \cs_generate_variant:Nn \seq_put_right:Nn {ce} \cs_generate_variant:Nn \seq_gput_right:Nn {ce} @@ -139,9 +139,9 @@ \cs_generate_variant:Nn \prop_put:Nnn {Nee , cee} \cs_generate_variant:Nn \prop_gput:Nnn {Nee , cee} -\cs_generate_variant:Nn \prop_get:NnN {Nnc , cnc , Nec , cec} +\cs_generate_variant:Nn \prop_get:NnN { cnc , cec } -\prg_generate_conditional_variant:Nnn \prop_get:NnN {Nnc , cnc , Nec , cec} { F , T , TF} +\prg_generate_conditional_variant:Nnn \prop_get:NnN { Nec } { F , T , TF} \prg_generate_conditional_variant:Nnn \seq_if_in:Nn {ce} {TF} \prg_generate_conditional_variant:Nnn \prop_if_in:Nn {ce} {TF} @@ -326,9 +326,11 @@ %%%% %%%% recursive/reentrant aware tmp variables. +%%%% this is clumsy and utterly ugly... +%%%% a set of variables for each recursing level... %%%% -\int_set:Nn \l_tmpa_int {7} +\int_set:Nn \l_tmpa_int {9} \tl_clear:N \l_tmpa_tl \int_do_while:nNnn {\l_tmpa_int} > {0} { @@ -371,6 +373,7 @@ \tl_new:N \l__starray_parsed_ref_tl \tl_new:N \l__starray_parsed_base_ref_tl \tl_new:N \l__starray_parsed_root_ref_tl +\tl_new:N \l__starray_parsed_ref_no_idx_ending_tl \tl_new:N \l__starray_parsing_term_tl @@ -404,25 +407,42 @@ %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% -% probably EXP -\prg_new_protected_conditional:Npnn \__starray_if_free:n #1 {T, F, TF} +% +% +\prg_new_conditional:Npnn \__starray_if_free:n #1 {p, T, F, TF} { \prop_if_exist:cTF {#1} { \prg_return_false: } { \prg_return_true: } } -\prg_generate_conditional_variant:Nnn \__starray_if_free:n {e} {T, F, TF} +\prg_generate_conditional_variant:Nnn \__starray_if_free:n {e} {p, T, F, TF} -% possible rEXP -\prg_new_protected_conditional:Npnn \__starray_if_valid:n #1 {T, F, TF} + +\prg_new_conditional:Npnn \starray_if_exist:n #1 {p, T, F, TF} + { + \__starray_if_free:nTF {\l__starray_prefix_tl #1 _def_prop} + { \prg_return_false: } + { \prg_return_true: } + } + + +\prg_new_conditional:Npnn \__starray_if_valid:n #1 {p, T, F, TF} { \bool_lazy_and:nnTF {\prop_if_exist_p:c {#1}} {\prop_item:cn {#1} {is_starray}} { \prg_return_true: } { \prg_return_false: } } -\prg_generate_conditional_variant:Nnn \__starray_if_valid:n {e} {T, F, TF} +\prg_generate_conditional_variant:Nnn \__starray_if_valid:n {e} {p, T, F, TF} + +\prg_new_conditional:Npnn \starray_if_valid:n #1 {p, T, F, TF} + { + \__starray_if_valid:nTF {\l__starray_prefix_tl #1 _def_prop} + { \prg_return_true: } + { \prg_return_false: } + } + %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% @@ -756,15 +776,17 @@ %%%%%%%%%%%%%%% -\prg_new_protected_conditional:Npnn \__starray_def_from_keyval_testdot_aux:w #1 . \q_nil { TF} +\prg_new_conditional:Npnn \__starray_def_from_keyval_testdot_aux:w #1 . \q_nil { TF} { \str_compare:nNnTF {#1} = {struct} { \prg_return_true: } { \prg_return_false: } } - -\prg_new_protected_conditional:Npnn \__starray_def_from_keyval_testdot:w #1 . #2 \q_stop { TF} +% +% This should be protected (\tl_set:Ne isn't expandable) but only the TF form matters. +% +\prg_new_conditional:Npnn \__starray_def_from_keyval_testdot:w #1 . #2 \q_stop { TF} { \quark_if_nil:nTF {#2} { @@ -777,7 +799,6 @@ \prg_return_true: } % dot struct, OK { -% \bool_gset_false:N \l__starray_rtn_bool \prg_return_false: } %% possible syntax ERR (dot, but no struct!) } @@ -1180,7 +1201,7 @@ %%%%%%%%%%%%%%% -\cs_new_protected:Npn \__starray_get_prop:nn #1#2 +\cs_new:Npn \__starray_get_prop:nn #1#2 { \prop_item:cn {\l__starray_prefix_tl #1 _term_prop}{#2} } @@ -1205,6 +1226,17 @@ \msg_warning:nnnn {starray} {syntax / prop} {get:1} {#1} } % returns nothing by default } + + +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This is uses the 'last parsed term'. +%%% +%%%%%%%%%%%%%%%% +\cs_new:Npn \starray_parsed_get_prop:n #1 + { + \__starray_get_prop:ee {\l__starray_parsed_ref_tl}{#1} + } \cs_new_protected:Npn \starray_get_prop:nnN #1#2#3 { @@ -1228,7 +1260,9 @@ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} { \prop_get:cnNTF - {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} {#2} #3 + {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} + {#2} + #3 { \prg_return_true: } @@ -1245,18 +1279,16 @@ } + \prg_new_protected_conditional:Npnn \starray_if_in:nn #1#2 {T, F, TF} { - \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} + \__starray_parser:nnTF {\c__starray_idx_ending_bool} {#1} { \prop_if_in:cnTF - {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} {#2} - { - \prg_return_true: - } - { - \prg_return_false: - } + { \l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop } + {#2} + { \prg_return_true: } + { \prg_return_false: } } { \seq_clear:N \l__starray_msg_seq @@ -1264,6 +1296,20 @@ } % returns nothing by default } +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This is uses the 'last parsed term'. +%%% +%%%%%%%%%%%%%%%% +\prg_new_conditional:Npnn \starray_parsed_if_in:n #1 {p, T, F, TF} + { + \prop_if_in:cnTF + { \l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop } + {#1} + { \prg_return_true: } + { \prg_return_false: } + } + \cs_new_protected:Npn \starray_get_cnt:n #1 { @@ -1278,6 +1324,19 @@ } % returns nothing by default } + +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This uses the 'last parsed term'. +%%% It will leave cnt directly in the input stream +%%%%%%%%%%%%%%%% +\cs_new:Npn \starray_parsed_get_cnt: + { + \int_use:N + \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_no_idx_ending_tl _base_prop } {cnt} + } + + \cs_new_protected:Npn \starray_get_cnt:nN #1#2 { \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1} @@ -1323,6 +1382,18 @@ } +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This uses the 'last parsed term'. +%%% It will leave current iter directly in the input stream +%%%%%%%%%%%%%%%% +\cs_new:Npn \starray_parsed_get_iter: + { + \int_use:N + \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_no_idx_ending_tl _base_prop } {iter} + } + + \cs_new_protected:Npn \starray_get_iter:nN #1#2 { \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1} @@ -1445,8 +1516,11 @@ %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% - -\prg_new_protected_conditional:Npnn \__starray_set_parse_end:w #1#2 ] #3 \q_stop { TF} +% +% Not expandable. DO NOT generate a predicate version! +% but, already a :w conditional anyway (internal) +% +\prg_new_conditional:Npnn \__starray_set_parse_end:w #1#2 ] #3 \q_stop { TF} { \quark_if_nil:nTF {#3} { \prg_return_false: } %% syntax ERR @@ -1457,7 +1531,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_set_parse_aux:w #1#2 [ \q_nil \q_stop { TF} +% +% Not expandable. DO NOT generate a predicate version! +% but, already a :w conditional anyway (internal) +% +\prg_new_conditional:Npnn \__starray_set_parse_aux:w #1#2 [ \q_nil \q_stop { TF} { \__starray_set_parse_end:wTF {#1}#2 ] \q_nil\q_stop {\prg_return_true:} @@ -1465,7 +1543,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_set_parse_begin:w #1#2 [ #3 \q_stop { TF} +% +% Not expandable. DO NOT generate a predicate version! +% but, already a :w conditional anyway (internal) +% +\prg_new_conditional:Npnn \__starray_set_parse_begin:w #1#2 [ #3 \q_stop { TF} { \quark_if_nil:nTF {#3} { % no 'term' ref, just array_name (current/iter term) @@ -1703,7 +1785,11 @@ %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% -\prg_new_protected_conditional:Npnn \__starray_term_parse_end:w #1 ] #2 \q_stop { TF} +%%% +%%% \tl_set: isn't expandable... but (internal) and only the TF variant is needed. +%%% :w macro anyway... +%%% +\prg_new_conditional:Npnn \__starray_term_parse_end:w #1 ] #2 \q_stop { TF} { \quark_if_nil:nTF {#2} { \prg_return_false: } %% syntax ERR @@ -1714,7 +1800,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_term_parse_aux:w #1 [ \q_nil \q_stop { TF} +%%% +%%% \tl_set: isn't expandable (see above)... but (internal) and only the TF variant is needed. +%%% :w macro anyway... +%%% +\prg_new_conditional:Npnn \__starray_term_parse_aux:w #1 [ \q_nil \q_stop { TF} { \__starray_term_parse_end:wTF #1 ] \q_nil\q_stop {\prg_return_true:} @@ -1722,7 +1812,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_term_parse_begin:w #1 [ #2 \q_stop { TF} +%%% +%%% \tl_set: isn't expandable (see above)... but (internal) and only the TF variant is needed. +%%% :w macro anyway... +%%% +\prg_new_conditional:Npnn \__starray_term_parse_begin:w #1 [ #2 \q_stop { TF} { \tl_set:Nn \l__starray_parsed_term_tl {#1} @@ -1787,6 +1881,9 @@ { \quark_if_nil:nTF {#2} { % this is the last one + \tl_set:Ne + \l__starray_parsed_ref_no_idx_ending_tl + {\l__starray_parsed_ref_tl} \bool_if:NTF \l__starray_parser_no_idx_ending_bool { % assuming it is to add a term... \tl_if_empty:NTF \l__starray_parsed_idx_tl @@ -1910,6 +2007,13 @@ \prg_return_false: } } + +\cs_new:Npn \starray_term_syntax:n #1 + { + \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} + {} + {} + } %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% |