texlive[69002] Master/texmf-dist: starray (29nov23)
commits+karl at tug.org
commits+karl at tug.org
Wed Nov 29 22:24:46 CET 2023
Revision: 69002
https://tug.org/svn/texlive?view=revision&revision=69002
Author: karl
Date: 2023-11-29 22:24:46 +0100 (Wed, 29 Nov 2023)
Log Message:
-----------
starray (29nov23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/starray/README.md
trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
trunk/Master/texmf-dist/doc/latex/starray/starray.tex
trunk/Master/texmf-dist/tex/latex/starray/starray.sty
Modified: trunk/Master/texmf-dist/doc/latex/starray/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/README.md 2023-11-29 21:24:37 UTC (rev 69001)
+++ trunk/Master/texmf-dist/doc/latex/starray/README.md 2023-11-29 21:24:46 UTC (rev 69002)
@@ -72,8 +72,10 @@
-------------
## Changelog
+* Version 1.5 (this)
+ - added \starray_term_syntax:nNN variant and friends (\starray_parsed_ ... :NN ) the _parsed_ ones being expandable
-* Version 1.4 (this)
+* Version 1.4
- added a few functions _set_iter_from_hash:nn and _iterate_over:n.
* Version 1.3
Modified: trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/starray/starray.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/starray.tex 2023-11-29 21:24:37 UTC (rev 69001)
+++ trunk/Master/texmf-dist/doc/latex/starray/starray.tex 2023-11-29 21:24:46 UTC (rev 69002)
@@ -15,7 +15,7 @@
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
-%% This is version 1.4 (2023/11/18)
+%% This is version {1.5} {2023/11/28}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/starray
@@ -484,7 +484,17 @@
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}[code,EXP,new=2023/11/28]{\starray_parsed_get_iter:NN}
+\begin{codesyntax}%
+\tsmacro{\starray_parsed_get_iter:NN}{parsed-refA,parsed-refB}
+\end{codesyntax}
+\tsobj{\starray_parsed_get_iter:} will place in the current iterator's value associated with \tsobj[marg]{parsed-refA,parsed-refB}, using \tsobj{\int_use:N}, in the input stream.
+\end{codedescribe}
+\begin{tsremark}[\color{red}Warning:]
+\tsobj[marg]{parsed-refA,parsed-refB} are the values returned by \tsobj{\starray_term_syntax:nNN}.
+\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}
@@ -507,6 +517,17 @@
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}[code,EXP,new=2023/11/28]{\starray_parsed_get_cnt:NN}
+\begin{codesyntax}%
+\tsmacro{\starray_parsed_get_cnt:NN}{parsed-refA,parsed-refB}
+\end{codesyntax}
+\tsobj{\starray_parsed_get_cnt:} will place in the current number of terms associated with \tsobj[marg]{parsed-refA,parsed-refB}, using \tsobj{\int_use:N}, in the input stream.
+\end{codedescribe}
+\begin{tsremark}[\color{red}Warning:]
+\tsobj[marg]{parsed-refA,parsed-refB} are the values returned by \tsobj{\starray_term_syntax:nNN}.
+\end{tsremark}
+
+
\begin{codedescribe}[code,new=2023/11/04]{\starray_iterate_over:nn,\starray_iterate_over:nnTF}
\begin{codesyntax}%
\tsmacro{\starray_iterate_over:nn}{starray-ref,code}
@@ -619,7 +640,7 @@
\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_prop:n}
\begin{codesyntax}%
-\tsmacro{\starray_parsed_get_prop:nn}{key}
+\tsmacro{\starray_parsed_get_prop:n}{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}
@@ -628,27 +649,54 @@
\end{tsremark}
+\begin{codedescribe}[code,EXP,new=2023/11/28]{\starray_parsed_get_prop:NNn}
+\begin{codesyntax}%
+\tsmacro{\starray_parsed_get_prop:NNn}{parsed-refA,parsed-refB,key}
+\end{codesyntax}
+\tsobj{\starray_parsed_get_prop:NNn} places the value of \tsobj[marg]{key}, if it exists, associated with \tsobj[marg]{parsed-refA,parsed-refB}.
+\end{codedescribe}
+\begin{tsremark}[\color{red}Warning:]
+\tsobj[marg]{parsed-refA,parsed-refB} are the values returned by \tsobj{\starray_term_syntax:nNN}.
+\end{tsremark}
+
+
\section{Additional Commands and Conditionals}\label{conditionals:terms}
-\begin{codedescribe}{\starray_if_in:nnTF,\starray_term_syntax:nTF}
+\begin{codedescribe}{\starray_if_in:nnTF}
\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.
+The \tsmacro{\starray_if_in:nnTF}{starray-ref,key,\ldots,\ldots} tests if a given \tsobj[marg]{key} is present.
\end{codedescribe}
-\begin{codedescribe}[code,new=2023/05/20]{\starray_term_syntax:n}
+\begin{codedescribe}[code,new=2023/05/20]{\starray_term_syntax:n,\starray_term_syntax:nTF}
\begin{codesyntax}%
\tsmacro{\starray_term_syntax:n}{starray-ref}
+\tsmacro{\starray_term_syntax:nTF}{starray-ref,if-true,if-false}
\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.
+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. In case one needs are more permanent/resilient \tsobj[pkg]{starray} reference, one should use the \tsobj{\starray_term_syntax:nNN} variant.
\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,new=2023/11/28]{\starray_term_syntax:nNN,\starray_term_syntax:nNNTF}
+\begin{codesyntax}%
+\tsmacro{\starray_term_syntax:nNN}{starray-ref,parsed-refA,parsed-refB}
+\tsmacro{\starray_term_syntax:nNNTF}{starray-ref,parsed-refA,parsed-refB,if-true,if-false}
+\end{codesyntax}
+Similar to the ones above (\tsobj{\starray_term_syntax:n}). \tsobj[marg]{parsed-refA,parsed-refB} (assumed to be two token list vars, \tsobj[meta]{tl-var}) will receive two 'internal references' that can be used in commands like \tsobj{\starray_parsed_...:NN} which expects such 'references', without having to worry about not using other \tsobj{\starray_} commands.
+\end{codedescribe}
+\begin{tsremark}
+Once correctly parsed, \tsobj[marg]{parsed-refA,parsed-refB} can be used at 'any time' (by those few \tsobj{\starray_parsed_...:NN} associated commands).\end{tsremark}
+\begin{tsremark}
+A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error (in which case \tsobj[marg]{parsed-refA,parsed-refB} will not hold a valid value). The branching version doesn't raise any warning.
+\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}
@@ -663,6 +711,22 @@
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}
+
+\begin{codedescribe}[code,EXP,new=2023/11/28]{\starray_parsed_if_in_p:NNn,\starray_parsed_if_in:NNnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_parsed_if_in_p:nTF}{parsed-refA,parsed-refB,key}
+\tsmacro{\starray_parsed_if_in:nTF}{parsed-refA,parsed-refB,key,if-true,if-false}
+\end{codesyntax}
+This will test if the given \tsobj[key]{key} is present/associated with \tsobj[marg]{parsed-refA,parsed-refB}.
+\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:]
+\tsobj[marg]{parsed-refA,parsed-refB} are the values returned by \tsobj{\starray_term_syntax:nNN}.
+\end{tsremark}
+
+
\section{Showing (debugging) starrays }\label{pack:show}
\begin{codedescribe}{\starray_show_def:n,\starray_show_def_in_text:n}
Modified: trunk/Master/texmf-dist/tex/latex/starray/starray.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/starray/starray.sty 2023-11-29 21:24:37 UTC (rev 69001)
+++ trunk/Master/texmf-dist/tex/latex/starray/starray.sty 2023-11-29 21:24:46 UTC (rev 69002)
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
-%% This is version 1.4 (2023/11/18)
+%% This is version {1.5} {2023/11/28}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/starray
@@ -19,13 +19,13 @@
%%
%%%==============================================================================
\NeedsTeXFormat{LaTeX2e}[2022/06/01]
-\RequirePackage{ expl3 }
+
\ProvidesExplPackage
{starray}
- {2023/11/18}
- {1.4}
+ {2023/11/28}
+ {1.5}
{A structured array/hash of properties}
%%%%%%%
@@ -36,11 +36,11 @@
%%%%%%%
\keys_define:nn { starray / pkg info}
{
- name .code:n = starray ,
- prefix .code:n = starray ,
- date .code:n = 2023/11/18,
- version .code:n = 1.4 ,
- description .code:n = A~structured~array/hash~of~properties
+ name .code:n = {starray} ,
+ prefix .code:n = {starray} ,
+ date .code:n = {2023/11/28},
+ version .code:n = {1.5} ,
+ description .code:n = {A~structured~array/hash~of~properties}
}
\cs_if_exist:NF \__codedesc_pkg_info:nn
{
@@ -49,6 +49,13 @@
}
\cs_if_exist:NF \PkgInfo
{ \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} } }
+\cs_if_exist:NF \PkgDescription
+ {
+ \NewDocumentCommand \PkgDescription {m}
+ {
+ \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par
+ }
+ }
%%%%%%%
%%% End of cut-n-paste
%%%%%%%
@@ -1387,6 +1394,19 @@
\__starray_get_prop:ee {\l__starray_parsed_ref_tl}{#1}
}
+
+%%%%%%%%%%%%%%%%
+%%%
+%%% WARNING: #1 should be \l__starray_parsed_ref_tl
+%%% #2 should be \l__starray_parsed_ref_no_idx_ending_tl
+%%%
+%%%%%%%%%%%%%%%%
+\cs_new:Npn \starray_parsed_get_prop:NNn #1#2#3
+ {
+ \__starray_get_prop:ee {#1}{#3}
+ }
+
+
\cs_new_protected:Npn \starray_get_prop:nnN #1#2#3
{
\__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
@@ -1459,7 +1479,24 @@
{ \prg_return_false: }
}
+%%%%%%%%%%%%%%%%
+%%%
+%%% WARNING: #1 should be \l__starray_parsed_ref_tl
+%%% #2 should be \l__starray_parsed_ref_no_idx_ending_tl
+%%%
+%%%%%%%%%%%%%%%%
+\prg_new_conditional:Npnn \starray_parsed_if_in:NNn #1#2#3 {p, T, F, TF}
+ {
+ \prop_if_in:cnTF
+ { \l__starray_prefix_tl #1 _term_prop }
+ {#3}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+
+
+
\cs_new_protected:Npn \starray_get_cnt:n #1
{
\__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
@@ -1485,7 +1522,19 @@
\prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_no_idx_ending_tl _base_prop } {cnt}
}
+%%%%%%%%%%%%%%%%
+%%%
+%%% WARNING: #1 should be \l__starray_parsed_ref_tl
+%%% #2 should be \l__starray_parsed_ref_no_idx_ending_tl
+%%%
+%%%%%%%%%%%%%%%%
+\cs_new:Npn \starray_parsed_get_cnt:NN #1#2
+ {
+ \int_use:N
+ \prop_item:cn { \l__starray_prefix_tl #2 _base_prop } {cnt}
+ }
+
\cs_new_protected:Npn \starray_get_cnt:nN #1#2
{
\__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
@@ -1543,6 +1592,18 @@
}
+%%%%%%%%%%%%%%%%
+%%%
+%%% WARNING: #1 should be \l__starray_parsed_ref_tl
+%%% #2 should be \l__starray_parsed_ref_no_idx_ending_tl
+%%%
+%%%%%%%%%%%%%%%%
+\cs_new:Npn \starray_parsed_get_iter:NN #1#2
+ {
+ \int_use:N
+ \prop_item:cn { \l__starray_prefix_tl #2 _base_prop } {iter}
+ }
+
\cs_new_protected:Npn \starray_get_iter:nN #1#2
{
\__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
@@ -2194,13 +2255,47 @@
}
}
-\cs_new:Npn \starray_term_syntax:n #1
+\prg_new_protected_conditional:Npnn \starray_term_syntax:nNN #1#2#3 {T, F, TF}
{
\__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \tl_gset:Ne #2 {\l__starray_parsed_ref_tl}
+ \tl_gset:Ne #3 {\l__starray_parsed_ref_no_idx_ending_tl}
+ \prg_return_true:
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ }
+ }
+
+\cs_new_protected:Npn \starray_term_syntax:n #1
+ {
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
{}
- {}
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {setkeyval:1} {#1}
+ }
}
+\cs_new_protected:Npn \starray_term_syntax:nNN #1#2#3
+ {
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \tl_gset:Ne #2 {\l__starray_parsed_ref_tl}
+ \tl_gset:Ne #3 {\l__starray_parsed_ref_no_idx_ending_tl}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {setkeyval:1} {#1}
+ }
+ }
+
+
+
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
%%%%
More information about the tex-live-commits
mailing list.