texlive[67083] Master: starray (12may23)
commits+karl at tug.org
commits+karl at tug.org
Fri May 12 22:29:04 CEST 2023
Revision: 67083
http://tug.org/svn/texlive?view=revision&revision=67083
Author: karl
Date: 2023-05-12 22:29:04 +0200 (Fri, 12 May 2023)
Log Message:
-----------
starray (12may23)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/libexec/ctan2tds
trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/starray/
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/
trunk/Master/texmf-dist/tex/latex/starray/starray.sty
trunk/Master/tlpkg/tlpsrc/starray.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/starray/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/starray/README.md 2023-05-12 20:29:04 UTC (rev 67083)
@@ -0,0 +1,77 @@
+starray
+==========
+
+This is a structured (properties) array (hash) package based on expl3.
+
+For more details, see the documentation,
+[starray.pdf](http://mirrors.ctan.org/macros/latex/contrib/starray/doc/starray.pdf)
+
+--------------
+
+## Requirements
+* none besides a fairly recent LaTeX distribution as recent as 2022/06/01
+(with the new in kernel *\ProcessKeyOptions* and *\NewDocumentCommand*)
+
+## Installation
+The stable version is available at [CTAN](https://ctan.org/pkg/starray).
+
+## Usage
+### Stable version
+Just place
+```latex
+ \usepackage{starray}
+```
+
+in the preamble and compile away.
+
+
+Be aware that options might change between versions, so you have to check them manually.
+
+## More Information and documentation
+More Information can be found in the documentation; you can find a "bleeding edge" version
+at [the github page](http://github.com/alceu-frigeri/starray)
+
+## Contacting Author
+
+For bug reports and enhacement suggestions, the preferred way is to use
+[the project's issue page](https://github.com/alceu-frigeri/starray/issues).
+Please be ready to provide an example code showing the bug, if any.
+
+Please do not use the issue page for generic help on how to use the package.
+
+* git: https://github.com/alceu-frigeri/starray
+
+-------------
+Copyright 2023 by Alceu Frigeri
+
+ This work may be distributed and/or modified under the
+ conditions of
+
+ * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), version 1.3c (or later), and/or
+ * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html), version 3 (or later)
+
+This work has the LPPL maintenance status *maintained*.
+
+The Current Maintainer of this work is Alceu Frigeri
+
+-------------
+## This work consists of the files
+
+* starray.sty
+ - The Package itself
+
+* README.md (this file)
+ - quick introduction
+
+* starray.tex
+ - package documentation
+
+* starray.pdf
+ - documentation in PDF format
+
+-------------
+
+## Changelog
+
+* Version 1.0
+ - Initial release by CTAN.
Property changes on: trunk/Master/texmf-dist/doc/latex/starray/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/starray.pdf 2023-05-12 20:27:50 UTC (rev 67082)
+++ trunk/Master/texmf-dist/doc/latex/starray/starray.pdf 2023-05-12 20:29:04 UTC (rev 67083)
Property changes on: trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/starray/starray.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/starray.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/starray/starray.tex 2023-05-12 20:29:04 UTC (rev 67083)
@@ -0,0 +1,566 @@
+%%%==============================================================================
+%% Copyright 2023 by Alceu Frigeri
+%%
+%% This work may be distributed and/or modified under the conditions of
+%%
+%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+%% version 1.3c (or later), and/or
+%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
+%% version 3 (or later)
+%%
+%% This work has the LPPL maintenance status *maintained*.
+%%
+%% The Current Maintainer of this work is Alceu Frigeri
+%%
+%% This is version 1.0 (2023/05/11)
+%%
+%% The list of files that compose this work can be found in the README.md file at
+%% https://ctan.org/pkg/starray
+%%
+%%%==============================================================================
+% !TEX program = pdflatex
+% !TEX ext = --interaction=nonstopmode --enable-etex
+% !BIB program = none
+\documentclass[10pt]{article}
+\RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={40mm,20mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
+%\RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={45mm,25mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
+\usepackage{codedescribe}
+\usepackage{codelisting}
+\usepackage{starray}
+\RequirePackage[inline]{enumitem}
+\SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex}
+
+
+\begin{document}
+\tstitle{
+ author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/starray}}},
+ date={2023/05/11},
+ title={The starray Package\break Version \PkgInfo{starray}{version}}
+ }
+
+\begin{typesetabstract}
+
+This package implements vector like 'structures', like in 'C' and other programming languages.
+It's based on \tsobj[pkg]{expl3} and aimed at 'package writers', and not end users. The provided 'functions' are similar the ones provided for property (or sequence, or token) lists. For most of the provided functions there is a companion 'branching version'.
+
+\end{typesetabstract}
+
+\tableofcontents
+
+\section{Introduction}
+The main idea is to have an array like syntax when setting/recovering structured information, e.g. \tsmacro{\starray_get_prop:nn} {student[2].work[3].reviewer[4] , name} where ''student'' is the starray root, ''work'' is a sub-structure (an array in itself), ''reviewer'' is a sub-structure of ''work'' and so on, \tsobj[marg]{name} being a property of ''reviewer''. Moreover one can iterate over the structure, for instance \tsmacro{\starray_get_prop:nn}{student.work.reviewer,name} is also a possible reference in which one is using ''student's'', ''work's'' and ''reviewer's'' iterators.
+
+Internally, a \tsobj[pkg]{starray} is stored as a collection of property lists. Each \tsobj[pkg]{starray} can contain a list of property pairs (key/value as in any \tsobj[pkg]{expl3} property lists) and a list of sub-structures. Each sub-structure, at it's turn, can also contain a list of property pairs and a list of sub-structures.
+
+The construction/definition of a \tsobj[pkg]{starray} can be done piecewise (a property/sub-structure a time) or with a keyval interface or both, either way, one has to first ''create a root starray'' (\tsmacro{\starray_new:n}{}), define it's elements (properties and sub-structures), then instantiate them ''as needed''. An instance of a \tsobj[pkg]{starray} (or one of it's sub-structures) is referred, in this text, as a ''term''.
+
+Finally, almost all defined functions have a branching version, as per \tsobj[pkg]{expl3}: \tsobj[code]{_p,T,F,TF}. For simplicity, in the text bellow only the \underline{\textsl{TF}} variant is described, as in \tsobj[code]{\starray_new:nTF}, keep in mind that all 4 variants do exist, e.g. \tsobj[code]{\starray_new_p:n,\starray_new:nT,\starray_new_p:nF,\starray_new_p:nTF}. As usual, the \tsobj[code]{_p} version denotes, is the predicate one (which can be used in boolena expressions).
+
+\begin{tsremark}[N.B.:]
+ Could it be implemented with a single property list? It sure could, but at a cost:
+\begin{enumerate*} \item complexity; \item access time. \end{enumerate*}
+The current implementation, albeit also complex, tries to reach a balance between inherent structure complexity, number of used/defined auxiliary property lists and access time.
+\end{tsremark}
+
+\section{Class Options}\label{pack:options}
+The package options (\tsobj[key]{key}\,=\tsobj[value]{value}) are:
+\begin{describelist}{option}
+\describe{prefix}{(default: \tsobj[value]{\detokenize{l__starray_}} ). Set the \tsobj[key]{prefix} used when declaring the property lists associated with any \tsobj[pkg]{starray}.}
+
+\describe{msg-err}{
+By default, the \tsobj[pkg]{starray} package only generates ''warnings'', with \tsobj[option]{msg-err} one can choose which cases will generate ''package error'' messages. There are 3 message classes: 1. \tsobj[value]{strict} relates to \tsmacro{\starray_new:n}{} cases (\tsobj[pkg]{starray} creation); 2. \tsobj[value]{syntax} relates to ''term syntax'' errors (student.work.reviewer in the above examples); finally 3. \tsobj[value]{reference} relates to cases whereas the syntax is correct but referring to non-existent terms/properties. }
+
+\begin{describelist*}{value}
+\describe{none}{ (default) no package message will raise an error.}
+\describe{strict}{ will raise an error on \tsobj[value]{strict} case alone.}
+\describe{syntax}{ will raise an error on \tsobj[value]{strict} and \tsobj[value]{syntax} cases.}
+\describe{reference}{ will raise an error on \tsobj[value]{strict}, \tsobj[value]{syntax} and \tsobj[value]{reference} cases.}
+\describe{all}{ will raise an error on all cases.}
+\end{describelist*}
+
+\describe{msg-suppress}{ ditto, to suppress classes of messages:}
+\begin{describelist*}{value}
+\describe{none}{ (default) no package message will be suppressed.}
+\describe{reference}{ only \tsobj[value]{reference} level messages will be suppressed.}
+\describe{syntax}{ \tsobj[value]{reference} and \tsobj[value]{syntax} level messages will be suppressed.}
+\describe{strict}{ \tsobj[value]{reference}, \tsobj[value]{syntax} and \tsobj[value]{strict} level messages will be suppressed.}
+\describe{all}{ all messages will be suppressed.}
+\end{describelist*}
+\end{describelist}
+
+\section{Creating a starray}\label{pack:new}
+\begin{codedescribe}{\starray_new:n,\starray_new:nTF}
+\begin{codesyntax}%
+\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}.
+\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}
+
+\section{Defining and initialising a starray structure}\label{pack:def}
+
+\begin{codedescribe}{\starray_def_prop:nnn,\starray_def_prop:nnnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_def_prop:nnn}{starray-ref,prop-key,initial-value}
+\tsmacro{\starray_def_prop:nnnTF}{starray-ref,prop-key,initial-value,if-true,if-false}
+\end{codesyntax}
+Adds an entry, \tsobj[marg]{prop-key}, to the \tsobj[marg]{starray-ref} (see \ref{pack:ref}) definition and set its initial value. If \tsobj[marg]{prop-key} is already present its initial value is updated. Both \tsobj[marg]{prop-key} and \tsobj[marg]{initial-value} may contain any \tsobj[marg]{balanced text}. \tsobj[marg]{prop-key} is an (\tsobj[pkg]{expl3}) property list \tsobj[marg]{key} meaning that category codes are ignored.
+
+The definition/assignment of a \tsobj[marg]{prop-key} to a \tsobj[marg]{starray-ref} is global.
+\end{codedescribe}
+
+\begin{tsremark}
+A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax/reference error. The branching version doesn't raise any warning.
+\end{tsremark}
+
+\begin{codedescribe}{\starray_def_structure:nn,\starray_def_structure:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_def_struct:nn}{starray-ref,struct-name}
+\tsmacro{\starray_def_struct:nnTF}{starray-ref,struct-name,if-true,if-false}
+\end{codesyntax}
+Adds a sub-structure (a \tsobj[pkg]{starray} in itself) to \tsobj[marg]{starray-ref} (see \ref{pack:ref}). If \tsobj[marg]{struct-name} is already present nothing happens. The definition/assignment of a \tsobj[marg]{struct-name} to a \tsobj[marg]{starray-ref} is global.
+\end{codedescribe}
+
+
+\begin{tsremark}
+Do not use a dot when defining a (sub-)structure name, it might seems to work but it will breaks further down (see \ref{pack:ref}).
+\end{tsremark}
+
+
+\begin{tsremark}[Note 2:]
+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}{\starray_def_from_keyval:nn,\starray_def_from_keyval:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_def_from_keyval:nn}{starray-ref,keyval-lst}
+\tsmacro{\starray_def_from_keyval:nnTF}{starray-ref,keyval-lst,if-true,if-false}
+\end{codesyntax}
+
+Adds a set of \tsobj[marg]{keys} / \tsobj[marg]{values} and/or \tsobj[marg]{structures} to \tsobj[marg]{starray-ref} (see \ref{pack:ref}). The \tsobj[marg]{keyval-lst} is pretty straightforward,
+the construction \tsobj[key]{\tsobj[marg]{key} . struct} denotes a nested structure :
+\end{codedescribe}
+
+\begin{codestore}[keyval.demo]
+\starray_def_from_keyval:nn {root.substructure}
+ {
+ keyA = valA ,
+ keyB = valB ,
+ subZ . struct =
+ {
+ keyZA = valZA ,
+ keyZB = valZB ,
+ }
+ subY . struct =
+ {
+ keyYA = valYA ,
+ keyYB = valYB ,
+ subYYY . struct =
+ {
+ keyYYYa = valYYYa ,
+ keyYYYb = valYYYb
+ }
+ }
+ }
+\end{codestore}
+
+\tscode*[codeprefix=~]{keyval.demo}
+
+The definitions/assignments to \tsobj[marg]{starray-ref} are all global.
+
+
+The non-branching version raises a warning (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. Please note that, syntax errors on the \tsobj[marg]{keyval-lst} might raise low level (\TeX) errors.
+
+\subsection{Fixing an ill-instantiated starray}\label{pack:def-fix}
+
+When instantiating (see \ref{pack:instantiate}) a \tsobj[pkg]{starray}, the associated structured will be constructed based on it's ''current definition'' (see \ref{pack:def}). A problem that migh arise, when one extends the definition of an already instantiated \tsobj[pkg]{starray} (better said, if one adds a sub-structure), is a \textsl{quark loop} (from \tsobj[pkg]{l3quark}). To avoid a \textsl{quark loop} it is necessary to ''fix'' the structure of already instantiated terms.
+
+\begin{codedescribe}{\starray_fix_terms:n}
+\begin{codesyntax}%
+\tsmacro{\starray_fix_terms:n}{starray-ref}
+\end{codesyntax}
+\end{codedescribe}
+The sole purpose of this function is to ''fix'' the already instantiated terms of a \tsobj[pkg]{starray}. Note, this can be an expensive operation depending on the number of terms (it has to craw over all the terms of an instantiated \tsobj[pkg]{starray} adding any missing sub-structure references), but one doesn't need to run it ''right away'' it is possible to add a bunch of sub-structures and than run this just once.
+
+
+\section{Instantiating starray terms}\label{pack:instantiate}
+
+\begin{codedescribe}{\starray_new_term:n,\starray_new_term:nn,\starray_new_term:nTF,\starray_new_term:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_new_term:n}{starray-ref}
+\tsmacro{\starray_new_term:nn}{starray-ref,hash}
+\tsmacro{\starray_new_term:nTF}{starray-ref,if-true,if-false}
+\tsmacro{\starray_new_term:nnTF}{starray-ref,hash,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+This create a new \textsl{term} (in fact a property list) of the (sub-)struture referenced by \tsobj[marg]{starray-ref}. Note that the newly created \textsl{term} will have all properties (key/values) as defined by the associated \tsmacro{\starray_prop_def:nn}{starray-ref}, with the respective ''initial values''. For instance, given the following
+
+\begin{codestore}[store-env=keyval.demo2]
+\starray_new:n {st-root}
+
+\starray_def_from_keyval:nn {st-root}
+ {
+ keyA = valA ,
+ keyB = valB ,
+ subZ . struct =
+ {
+ keyZA = valZA ,
+ keyZB = valZB ,
+ }
+ subY . struct =
+ {
+ keyYA = valYA ,
+ keyYB = valYB ,
+ subYYY . struct =
+ {
+ keyYYYa = valYYYa ,
+ keyYYYb = valYYYb
+ }
+ }
+ }
+
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:nn {st-root}{hash-A}
+\starray_new_term:n {st-root.subZ}
+\end{codestore}
+
+\tscode*[codeprefix=~]{keyval.demo2}
+
+One will have created 6 \textsl{terms}:
+\begin{enumerate}[miditemsep]
+\item 2 \tsobj[marg]{st-root} \textsl{terms}
+ \begin{enumerate}[miditemsep]
+ \item the first one with index 1 and
+ \begin{enumerate}[miditemsep]
+ \item 2 sub-structures \tsobj[marg]{subZ} (indexes 1 and 2)
+ \item 1 sub-structure \tsobj[marg]{subY} (index 1)
+ \end{enumerate}
+ \item the second one with indexes 2 and ''hash-A'' and
+ \begin{enumerate}[miditemsep]
+ \item 1 sub-structure \tsobj[marg]{subZ} (index 1)
+ \end{enumerate}
+ \end{enumerate}
+\end{enumerate}
+
+Note that, in the above example, it was used the ''implicit'' indexing (aka. iterator, see \ref{pack:ref}). Also note that no \textsl{term} of kind \tsobj[marg]{subYYY} was created.
+
+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.
+
+
+\subsection{referencing terms}\label{pack:ref}
+
+When typing a \tsobj[marg]{starray-ref} there are 3 cases to consider:
+\begin{enumerate}[miditemsep]
+ \item structure definition
+ \item term instantiation
+ \item getting/setting a property
+\end{enumerate}
+
+The first case is the simplest one, in which, one (starting by \tsobj[marg]{starray-root} will use a construct like \tsobj[marg]{starray-root}.\tsobj[marg]{sub-struct}.\tsobj[marg]{sub-struct}\ldots
+For example, an equivalent construct to the one shown in \ref{pack:instantiate} :
+
+\begin{codestore}[store-env=demo3]
+\starray_new:n {st-root}
+
+\starray_def_struct:nn {st-root}{subZ}
+
+\starray_def_prop:nnn {st-root}{keyA}{valA}
+\starray_def_prop:nnn {st-root}{keyB}{valB}
+
+\starray_def_prop:nnn {st-root.subZ}{keyZA}{valZA}
+\starray_def_prop:nnn {st-root.subZ}{keyZB}{valZB}
+
+\starray_def_struct:nn {st-root}{subY}
+\starray_def_prop:nnn {st-root.subY}{keyYA}{valYA}
+\starray_def_prop:nnn {st-root.subY}{keyYB}{valYB}
+
+\starray_def_struct:nn {st-root.subY}{subYYY}
+\starray_def_prop:nnn {st-root.subY.subYYY}{keyYYYA}{valYYYA}
+\starray_def_prop:nnn {st-root.subY.subYYY}{keyYYYB}{valYYYB}
+
+\end{codestore}
+
+\tscode*[codeprefix=~]{demo3}
+
+Note that, all it's needed in order to be able to use \tsobj[marg]{starray-root}.\tsobj[marg]{sub-A} is that \tsobj[marg]{sub-A} is an already declared sub-structure of \tsobj[marg]{starray-root}. The property definitions can be made in any order.
+
+In all other cases, term instantiation, getting/setting a property, one has to address/reference a specific instance/term, implicitly (using iterators) or explicitly using indexes.
+The general form, of a \tsobj[marg]{starray-ref}, is: \par
+\tsobj[marg]{starray-root}\tsobj[oarg]{idx}.\tsobj[marg]{sub-A}\tsobj[oarg]{idxA}.\tsobj[marg]{sub-B}\tsobj[oarg]{idxB} \par
+In the case of term instantiation the last \tsobj[marg]{sub-} cannot be indexed, after all one is creating a new term/index. Moreover, all \tsobj[oarg]{idx} are optional like:\par
+\tsobj[marg]{starray-root}.\tsobj[marg]{sub-A}\tsobj[oarg]{idxA}.\tsobj[marg]{sub-B} \par
+in which case, one is using the ''iterator'' of \tsobj[marg]{starray-root} and \tsobj[marg]{sub-B} (more later, but keep in mind the \tsobj[marg]{sub-B} iterator is the \tsobj[marg]{sub-B} associated with the \tsobj[marg]{sub-A}\tsobj[oarg]{idxA}).
+
+Since one has to explicitly instantiate all (sub)terms of a starray, one can end with a highly asymmetric structure. Starting at the \tsobj[marg]{starray-root} one has a first counter (representing, indexing the root structure terms), then for all sub-strutures of \tsobj[marg]{starray-root} one will have an additional counter for every term of \tsobj[marg]{starray-root} !
+
+So, for example:
+\begin{codestore}[store-env=demo4]
+\starray_new:n {st-root}
+\starray_def_struct:nn {st-root}{subZ}
+\starray_def_struct:nn {st-root}{subY}
+\starray_def_struct:nn {st-root.subY}{subYYY}
+
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY}
+
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subY}
+\end{codestore}
+
+\tscode*[codeprefix=~]{demo4}
+
+One has a single \tsobj[marg]{st-root} iterator (pointing to one of the 3 \tsobj[marg]{st-root} terms), then 3 ''\tsobj[marg]{subZ} iterators'', in fact, one \tsobj[marg]{subZ} iterator for each \tsobj[marg]{st-root} term.
+Likewise there are 3 ''\tsobj[marg]{subY} iterators'' and 4 (four) ''\tsobj[marg]{subYYY} iterators'' one for each instance of \tsobj[marg]{subY}.
+
+Every time a new term is created/instantiated, the corresponding iterator will points to it, which allows the notation used in this last example, keep in mind that one could instead, using explicit indexes:
+
+\begin{codestore}[store-env=demo5]
+\starray_new:n {st-root}
+\starray_def_struct:nn {st-root}{subZ}
+\starray_def_struct:nn {st-root}{subY}
+\starray_def_struct:nn {st-root.subY}{subYYY}
+
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root[1].subZ}
+\starray_new_term:n {st-root[1].subZ}
+\starray_new_term:n {st-root[1].subY}
+\starray_new_term:n {st-root[1].subY}
+\starray_new_term:n {st-root[1].subY[2].subYYY}
+\starray_new_term:n {st-root[1].subY}
+
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root[2].subZ}
+\starray_new_term:n {st-root[2].subZ}
+\starray_new_term:n {st-root[2].subY}
+\end{codestore}
+
+\tscode*[codeprefix=~]{demo5}
+
+Finally, observe that, when creating a new term, one has the option to assign a ''hash'' to it, in which case that term can be referred to using an iterator, the explicit index or the hash:
+
+\begin{codestore}[store-env=demo6]
+\starray_new:n {st-root}
+\starray_def_struct:nn {st-root}{subZ}
+\starray_def_struct:nn {st-root}{subY}
+\starray_def_struct:nn {st-root.subY}{subYYY}
+
+\starray_new_term:nn {st-root}{hash-A}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root[1].subZ}
+\starray_new_term:n {st-root[hash-A].subZ}
+\end{codestore}
+\tscode*[codeprefix=~]{demo6}
+
+Will create 3 \tsobj[marg]{subZ} terms associated with the first (index = 1) \tsobj[marg]{st-root}.
+
+
+\subsection{iterators}\label{pack:iter}
+
+\begin{codedescribe}{\starray_set_iter:nn,\starray_set_iter:nnTF,\starray_reset_iter:nn,\starray_reset_iter:nnTF,\starray_next_iter:nn,\starray_next_iter:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_set_iter:nn}{starray-ref,int-val}
+\tsmacro{\starray_set_iter:nTF}{starray-ref,int-val,if-true,if-false}
+\tsmacro{\starray_reset_iter:nn}{starray-ref}
+\tsmacro{\starray_reset_iter:nTF}{starray-ref,if-true,if-false}
+\tsmacro{\starray_next_iter:nn}{starray-ref}
+\tsmacro{\starray_next_iter:nTF}{starray-ref,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+Those functions allows to \tsmacro{set}{} an iterator to a given \tsobj[marg]{int-val}, \tsmacro{reset}{} it (i.e. assign 1 to the iterator), or increase the iterator by one. An iterator might have a value between 1 and the number of instantiated terms (if the given (sub-)structure was already instantiated). If the (sub-)structure hasn't been instantiated yet, the iterator will always end being set to 0. The branching versions allows to catch those cases, like trying to set a value past its maximum, or a value smaller than one.
+
+\begin{tsremark}[Important:]
+Please observe that, when setting/resetting/incrementing the iterator of a (sub-)structure, all ''descending'' iterators will be also be reset.
+\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{codestore}[store-env=demo7]
+\starray_new:n {st-root}
+\starray_def_struct:nn {st-root}{subZ}
+\starray_def_struct:nn {st-root}{subY}
+\starray_def_struct:nn {st-root.subY}{subYYY}
+
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subZ}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY}
+\starray_new_term:n {st-root.subY.subYYY}
+\starray_new_term:n {st-root.subY.subYYY}
+
+\starray_set_prop:nnn {st-root.subY.subYYY}{key}{val}
+\starray_set_prop:nnn {st-root[2].subY[2].subYYY[2]}{key}{val}
+
+\starray_reset_iter:n {st-root[2].subY}
+
+\starray_set_prop:nnn {st-root.subY.subYYY}{key}{val}
+\starray_set_prop:nnn {st-root[2].subY[1].subYYY[1]}{key}{val}
+\end{codestore}
+
+\tscode*[codeprefix=~]{demo7}
+
+Before the reset \tsobj[marg]{st-root.subY.subYYY} was equivalent to \tsobj[marg]{st-root[2].subY[2]. subYYY[2]}, given that each iterator was pointing to the ''last term'', since the reset was of the \tsobj[marg]{subY} iterator, only it and the descending ones (in this example just \tsobj[marg]{subYYY}) where reseted, and therefore \tsobj[marg]{st-root.subY.subYYY} was then equivalent to \tsobj[marg]{st-root[2].subY[1].subYYY[1]}
+
+
+
+\begin{codedescribe}{\starray_get_iter:n,\starray_get_iter:nN,\starray_get_iter:nNTF}
+\begin{codesyntax}%
+\tsmacro{\starray_get_iter:n}{starray-ref}
+\tsmacro{\starray_get_iter:nN}{starray-ref,int-var}
+\tsmacro{\starray_get_iter:nNTF}{starray-ref,int-var,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+\tsmacro{\starray_get_iter:n}{starray-ref} will type in the current value of a given iterator, whilst the other two functions will save it's value in a integer variable (\tsobj[pkg]{expl3}).
+\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}{\starray_get_cnt:n,\starray_get_cnt:nN,\starray_get_cnt:nNTF}
+\begin{codesyntax}%
+\tsmacro{\starray_get_cnt:n}{starray-ref}
+\tsmacro{\starray_get_cnt:nN}{starray-ref,integer}
+\tsmacro{\starray_get_cnt:nNTF}{starray-ref,integer,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+\tsmacro{\starray_get_cnt:n}{starray-ref} will type in the current number of terms of a given (sub-)structure, whilst the other two functions will save it's value in a integer variable (\tsobj[pkg]{expl3}).
+\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}
+
+\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}
+\begin{codesyntax}%
+\tsmacro{\starray_set_prop:nnn}{starray-ref,prop-key,value}
+\tsmacro{\starray_set_prop:nnV}{starray-ref,prop-key,value}
+\tsmacro{\starray_set_prop:nnnTF}{starray-ref,prop-key,value,if-true,if-false}
+\tsmacro{\starray_set_prop:nnVTF}{starray-ref,prop-key,value,if-true,if-false}
+\tsmacro{\starray_gset_prop:nnn}{starray-ref,prop-key,value}
+\tsmacro{\starray_gset_prop:nnV}{starray-ref,prop-key,value}
+\tsmacro{\starray_gset_prop:nnnTF}{starray-ref,prop-key,value,if-true,if-false}
+\tsmacro{\starray_gset_prop:nnVTF}{starray-ref,prop-key,value,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+Those are the functions that allow to (g)set (change) the value of a term's property. If the \tsobj[marg]{prop-key} isn't already present it will be added just for that term \tsobj[marg]{starray-ref}. The \tsobj[parg]{nnV} variants allow to save any variable like a token list, property list, etc...
+\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}{\starray_set_from_keyval:nn,\starray_set_from_keyval:nnTF,\starray_gset_from_keyval:nn,\starray_gset_from_keyval:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_set_from_keyval:nnn}{starray-ref,keyval-lst}
+\tsmacro{\starray_set_from_keyval:nnnTF}{starray-ref,keyval-lst,if-true,if-false}
+\tsmacro{\starray_gset_from_keyval:nnn}{starray-ref,keyval-lst}
+\tsmacro{\starray_gset_from_keyval:nnnTF}{starray-ref,keyval-lst,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+
+it is possible to set a collection of properties using a key/val syntax, similar to the one used to define a \tsobj[pkg]{starray} from keyvals (see \ref{pack:def}), with a few distinctions:
+\begin{enumerate}
+ \item when referring a (sub-)structure one can either explicitly use an index, or
+ \item implicitly use it's iterator
+ \item if a given key isn't already presented it will be added only to the given term
+\end{enumerate}
+
+ Note that, in the following example, TWO iterators are being used, the one for \tsobj[marg]{st-root} and then \tsobj[marg]{subY}.
+
+\begin{codestore}[store-env=keyval.demo8]
+\starray_set_from_keyval:nn {st-root}
+ {
+ keyA = valA ,
+ keyB = valB ,
+ subZ[2] =
+ {
+ keyZA = valZA ,
+ keyZB = valZB ,
+ }
+ subY =
+ {
+ keyYA = valYA ,
+ keyYB = valYB ,
+ subYYY[1] =
+ {
+ keyYYYa = valYYYa ,
+ keyYYYb = valYYYb
+ }
+ }
+ }
+\end{codestore}
+
+\tscode*[codeprefix=~]{keyval.demo8}
+
+Also note that the above example is fully equivalent to:
+
+\begin{codestore}[store-env=keyval.demo9]
+\starray_set_prop:nnn {st-root} {keyA} {valA}
+\starray_set_prop:nnn {st-root} {keyB} {valB}
+\starray_set_prop:nnn {st-root.subZ[2]} {keyZA} {valZA}
+\starray_set_prop:nnn {st-root.subZ[2]} {keyZB} {valZB}
+\starray_set_prop:nnn {st-root.subY} {keyYA} {valYA}
+\starray_set_prop:nnn {st-root.subY} {keyYB} {valYB}
+\starray_set_prop:nnn {st-root.subY.subYYY[1} {keyYYYa} {valYYYa}
+\starray_set_prop:nnn {st-root.subY.subYYY[1} {keyYYYb} {valYYYb}
+\end{codestore}
+
+\tscode*[codeprefix=~]{keyval.demo9}
+
+
+\section{Additional Conditionals}\label{pack:extra}
+
+\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}
+\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.
+
+
+\section{Showing (debugging) starrays }\label{pack:show}
+
+\begin{codedescribe}{\starray_show_def:n,\starray_show_def_in_text:n}
+\begin{codesyntax}%
+\tsmacro{\starray_show_def:n}{starray-ref}
+\tsmacro{\starray_show_def_in_text:n}{starray-ref}
+\end{codesyntax}
+\end{codedescribe}
+Displays the \tsobj[marg]{starray} structure definition and initial property values in the terminal or directly in text.
+
+\begin{codedescribe}{\starray_show_terms:n,\starray_show_terms_in_text:n}
+\begin{codesyntax}%
+\tsmacro{\starray_show_terms:n}{starray-ref}
+\tsmacro{\starray_show_terms_in_text:n}{starray-ref}
+\end{codesyntax}
+\end{codedescribe}
+Displays the \tsobj[marg]{starray} instantiated terms and current property values in the terminal or directly in text.
+
+
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/starray/starray.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/starray/starray.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/starray/starray.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/starray/starray.sty 2023-05-12 20:29:04 UTC (rev 67083)
@@ -0,0 +1,2073 @@
+%%%==============================================================================
+%% Copyright 2023 by Alceu Frigeri
+%%
+%% This work may be distributed and/or modified under the conditions of
+%%
+%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+%% version 1.3c (or later), and/or
+%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
+%% version 3 (or later)
+%%
+%% This work has the LPPL maintenance status *maintained*.
+%%
+%% The Current Maintainer of this work is Alceu Frigeri
+%%
+%% This is version 1.0 (2023/05/11)
+%%
+%% The list of files that compose this work can be found in the README.md file at
+%% https://ctan.org/pkg/starray
+%%
+%%%==============================================================================
+\NeedsTeXFormat{LaTeX2e}[2022/06/01]
+\RequirePackage{ expl3 }
+\ProvidesExplPackage
+ {starray}
+ {2023/05/11}
+ {1.0}
+ {A structured array/hash of properties}
+
+\prop_if_exist:NTF \g__codedesc_pkg_prop
+ {}
+ { \prop_new:N \g__codedesc_pkg_prop }
+
+\prop_put_from_keyval:Nn \g__codedesc_pkg_prop
+ {
+ starray . name = starrayr ,
+ starray . prefix = starray ,
+ starray . date = 2023/05/01 ,
+ starray . version = 1.0 ,
+ starray . description = A structured array/hash of properties
+ }
+
+\cs_gset:Npn \__codedesc_pkg_info:nn #1#2
+ {
+ \prop_item:Nn \g__codedesc_pkg_prop {#1.#2}
+ }
+
+\cs_if_exist:NTF \PkgInfo
+ {}
+ {
+ \NewDocumentCommand \PkgInfo {mm} { \prop_item:Nn \g__codedesc_pkg_prop {#1.#2} }
+ }
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%%
+%%%% New package
+%%%%
+%%%%%%%%%%%%%%%%%%%
+
+\tl_new:N \l__starray_prefix_tl
+%\tl_gset:Nn \l__starray_prefix_tl {l__starray_}
+
+
+\keys_define:nn { starray }
+{
+ prefix .tl_set:N = \l__starray_prefix_tl ,
+ prefix .value_required:n = true ,
+ prefix .initial:n = l__starray_ ,
+ prefix .usage:n = load ,
+
+ msg-err .choice: ,
+ msg-err / none .code:n = {
+ % \msg_redirect_module:nnn { starray } { warning } { none }
+ },
+ msg-err / default .code:n = {} ,
+ msg-err / strict .code:n = {
+ \msg_redirect_module:nnn { starray / strict } { warning } { error }
+ },
+ msg-err / syntax .code:n = {
+ \msg_redirect_module:nnn { starray / strict } { warning } { error }
+ \msg_redirect_module:nnn { starray / syntax } { warning } { error }
+ } ,
+ msg-err / reference .code:n = {
+ \msg_redirect_module:nnn { starray / strict } { warning } { error }
+ \msg_redirect_module:nnn { starray / syntax } { warning } { error }
+ \msg_redirect_module:nnn { starray / reference } { warning } { error }
+ } ,
+ msg-err / all .code:n = \msg_redirect_module:nnn { starray } { warning } { error } ,
+ msg-err . usage:n = load ,
+
+ msg-supress .choice: ,
+ msg-supress / none .code:n = {} ,
+ msg-supress / reference .code:n = {
+ \msg_redirect_module:nnn { starray / reference } { warning } { none }
+ },
+ msg-supress / syntax .code:n = {
+ \msg_redirect_module:nnn { starray / strict } { warning } { none }
+ \msg_redirect_module:nnn { starray / syntax } { warning } { none }
+ } ,
+ msg-supress / strict .code:n = {
+ \msg_redirect_module:nnn { starray / strict } { warning } { none }
+ \msg_redirect_module:nnn { starray / syntax } { warning } { none }
+ \msg_redirect_module:nnn { starray / reference } { warning } { none }
+ } ,
+ msg-supress / all .code:n = \msg_redirect_module:nnn { starray } { warning } { none } ,
+ msg-supress . usage:n = load ,
+
+
+}
+
+\ProcessKeyOptions [ starray ]
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% New variants of core expl3 primitives
+%%%% expansion handling
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\cs_generate_variant:Nn \prop_item:Nn { ce , Ne }
+\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 \seq_put_right:Nn {ce}
+\cs_generate_variant:Nn \seq_gput_right:Nn {ce}
+
+\cs_generate_variant:Nn \int_to_Alph:n {e}
+
+\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}
+
+\prg_generate_conditional_variant:Nnn \prop_get:NnN {Nnc , cnc , Nec , cec} { 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}
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% Package error/warning messages
+%%%% #1 'ID' (code identifier)
+%%%% #2 / #3 / #4 further fields (as needed)
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\msg_new:nnnn {starray} {strict / (re)define}
+ {
+ (ID:#1)~'#2'~already~defined!
+ }
+ {
+ You~tried~to~(re)define~'#2'.
+ ~Error~Code~ ID:<#1>.
+ }
+
+
+\msg_new:nnnn {starray} {syntax / ref-syntax-err}
+ {
+ (ID:#1)~term~reference~'#2'~--~'#3'.
+ }
+ {
+ Your~term~'#2'~contains~a~syntax~error:~'#3'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {syntax / keyval-term}
+ {
+ (ID:#1)~term~reference~'#2'~error~'#3'.
+ }
+ {
+ Your~term~'#2'~contains~a~syntax~error:~'#3'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {syntax / term}
+ {
+ (ID:#1)~'#2'~isn't~a~valid~term~ref.
+ }
+ {
+ Invalid~term~reference:~'#2'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {syntax / structure-ref}
+ {
+ (ID:#1)~'#3'~isn't~a~sub-structure~of~'#2'.
+ }
+ {
+ '#2' ~doesn't~have~a~sub-structure~named:~'#3'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {syntax / iter}
+ {
+ (ID:#1)~cannot~set~iter. ~invalid~'#2'.
+ }
+ {
+ cannot~set~iter.~ invalid '#2'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+
+\msg_new:nnnn {starray} {syntax / prop}
+ {
+ (ID:#1)~cannot~get/set~property~from~'#2'.
+ }
+ {
+ You~have~referenced~an~invalid~structur~'#2'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+
+\msg_new:nnnn {starray} {reference / invalid-starray} %%%$$
+ {
+ (ID:#1)~'#2'~invalid~starray.
+ \tl_if_blank:nTF {#3}
+ {~#3}
+ {}
+ }
+ {
+ '#2'~isn't~a~starray.
+ \tl_if_blank:nTF {#3}
+ {~#3}
+ {}
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {reference / iter}
+ {
+ (ID:#1)~invalid~iter~(#3)~from~'#2'
+ \str_if_empty:nTF {#4}
+ {}
+ {#4}
+ .
+ }
+ {
+ Invalid~iter~(#3)~from~ '#2'.~You~might~have~tried~to~use/set/reset~an~iter~of
+ ~an~ill~instantiated~structured.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {reference / prop} %%%$$
+ {
+ (ID:#1)~cannot~get/set~property~'#3'~from~'#2'.
+ }
+ {
+ '#3'~isn't~a~property~of~'#2'.
+ ~Error~ Code~ ID:<#1>.
+ }
+
+\msg_new:nnnn {starray} {info / show}
+ {
+ \iow_newline:(ID:#1)\iow_newline:~ #2 \iow_newline:
+
+ #3
+
+ \iow_newline:
+ definition's~end.
+ }
+ {
+ \iow_newline:(ID:#1)\iow_newline:~ #2 \iow_newline:
+
+ #3
+
+ \iow_newline:
+ definition's~end.
+ }
+
+
+
+
+
+\cs_new:Npn \__starray_msg:nnnnn #1#2#3#4#5
+ {
+ \bool_gset_false:N \l__starray_rtn_bool
+
+ \seq_gput_right:Nn \l__starray_msg_seq
+ {
+ \msg_warning:nnnnnn
+ {starray}{ #1 } { #2 }{ #3 }{ #4 }{ #5 }
+ }
+ }
+
+\cs_generate_variant:Nn \__starray_msg:nnnnn { nneee , neeee }
+
+\cs_new:Npn \__starray_msg_dispatch:
+ {
+ \seq_map_tokens:Nn \l__starray_msg_seq { }
+ \seq_clear:N \l__starray_msg_seq
+ }
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% Package Variables declaration
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+% TODO variables declaration
+
+\prop_new:N \l__starray_tmpA_prop
+
+%%%%
+%%%% 'general' (internal) returning bool
+%%%%
+\bool_new:N \l__starray_rtn_bool
+
+%%%%
+%%%% sequence of 'error mensages' (stacked).
+%%%%
+\seq_new:N \l__starray_msg_seq
+
+%%%%
+%%%% recursive/reentrant aware tmp variables.
+%%%%
+
+\int_set:Nn \l_tmpa_int {7}
+\tl_clear:N \l_tmpa_tl
+\int_do_while:nNnn {\l_tmpa_int} > {0}
+ {
+ \tl_put_left:Nn \l_tmpa_tl {A}
+ \prop_new:c { l__starray_tmp \l_tmpa_tl _hash_prop }
+ \prop_new:c { l__starray_tmp \l_tmpa_tl _def_prop }
+ \prop_new:c { l__starray_tmp \l_tmpa_tl _idx_prop }
+ \int_new:c { l__starray_tmp \l_tmpa_tl _int }
+ \seq_new:c { l__starray_tmp \l_tmpa_tl _seq }
+ \tl_new:c { l__starray_tmp \l_tmpa_tl _tl }
+ \tl_new:c { l__starray_tmp \l_tmpa_tl :A_tl }
+ \tl_new:c { l__starray_tmp \l_tmpa_tl :B_tl }
+ \tl_new:c { l__starray_tmp \l_tmpa_tl _idx_tl }
+
+ \int_decr:N \l_tmpa_int
+ }
+
+\tl_new:N \l__starray_tmpa_tl
+\tl_new:N \l__starray_tmpb_tl
+
+\tl_new:N \l__starray_showcmd_tl
+
+%%%%
+%%%% (sub)structure returning tl.
+%%%%
+\tl_new:N \l__starray_tmpST_tl
+
+
+%%%%
+%%%% parser related ones
+%%%%
+\bool_const:Nn \c__starray_no_idx_ending_bool \c_true_bool
+\bool_const:Nn \c__starray_idx_ending_bool \c_false_bool
+
+
+%%%%
+%%%% parser returning variables
+%%%%
+\tl_new:N \l__starray_parsed_tl
+\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_parsing_term_tl
+
+%%%%
+%%%% parser 'internal' variables
+%%%%
+\bool_new:N \l__starray_parser_no_idx_ending_bool
+
+\tl_new:N \l__starray_parsed_term_tl
+\tl_new:N \l__starray_parsed_idx_tl
+
+\tl_new:N \l__starray_parser_aux_tl %% when constructing parser ref, 1st <nothing> then dot .
+
+\bool_new:N \l__starray_parser_OK_bool
+
+
+%% big one, (g)put !!
+%%%%
+%%%% (g)put :: IF the effect shall be local or global
+%%%%
+\tl_new:N \l__starray_put_tl
+
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% Package conditionals
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\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} {p, T, F, TF}
+
+\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} {p, T, F, TF}
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% starray \...._new declarations
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_base_new:nn #1#2
+ {
+ \int_new:c
+ { \l__starray_prefix_tl #2 _cnt_int }
+ \int_gzero:c
+ { \l__starray_prefix_tl #2 _cnt_int }
+
+ \int_new:c
+ { \l__starray_prefix_tl #2 _iter_int }
+ \int_gzero:c
+ { \l__starray_prefix_tl #2 _iter_int }
+
+ \prop_new:c { \l__starray_prefix_tl #2 _base_prop }
+
+ \prop_gset_from_keyval:cn
+ { \l__starray_prefix_tl #2 _base_prop }
+ {
+ def_ref = #1 ,
+ is_starray = \c_true_bool ,
+ }
+
+ \prop_gput:cno
+ { \l__starray_prefix_tl #2 _base_prop }
+ { cnt }
+ { \use:c { \l__starray_prefix_tl #2 _cnt_int } }
+
+ \prop_gput:cno
+ { \l__starray_prefix_tl #2 _base_prop }
+ { iter }
+ { \use:c {\l__starray_prefix_tl #2 _iter_int} }
+
+ \prop_gput:cnV
+ { \l__starray_prefix_tl #2 _base_prop }
+ { idx_hash }
+ \c_empty_prop
+ }
+
+\cs_generate_variant:Nn \__starray_base_new:nn { ee }
+
+
+\cs_new:Npn \__starray_sub_base_new:nnn #1#2#3
+ { \__starray_base_new:ee {#1.#3}{#2.#3} }
+
+
+\cs_new:Npn \__starray_new:n #1
+ {
+ \prop_new:c
+ { \l__starray_prefix_tl #1 _def_prop }
+
+ \prop_gset_from_keyval:cn
+ { \l__starray_prefix_tl #1 _def_prop }
+ {
+ is_starray = \c_true_bool ,
+ def_ref = #1
+ }
+
+ \prop_clear:N \l_tmpa_prop
+
+ \prop_gput:cnV { \l__starray_prefix_tl #1 _def_prop } {@st_seq} \c_empty_seq
+
+ \prop_gput:cnV
+ { \l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop
+
+ }
+
+\cs_generate_variant:Nn \__starray_new:n { e }
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_new
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_new:n #1
+ {
+ \__starray_if_free:nTF {\l__starray_prefix_tl #1 _def_prop}
+ {
+ \__starray_new:e {#1 }
+ \__starray_base_new:ee {#1}{#1} % TODO: might be incomplete !!!
+ }
+ {
+ \msg_warning:nnnn {starray} {strict / (re)define} {new:1} {#1}
+ }
+ }
+
+
+\prg_new_conditional:Npnn \starray_new:n #1 {p, T, F, TF}
+ {
+ \__starray_if_free:nTF {\l__starray_prefix_tl #1 _def_prop}
+ {
+ \__starray_new:e {#1 }
+ \__starray_base_new:ee {#1}{#1} % TODO: might be incomplete !!!
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% starray ref parser
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% get root reference (first term) assuming called as
+%%%% <st-ref> . \q_nil \q_stop
+%%%% so that even if {ref} (has no dot, no idx) it will return 'the root ref'
+%%%%
+%%%% e.g.: \tl_set:Ne \l__tmpb_tl {\__starray_get_root:w \l__starray_tmpa_tl . \q_nil \q_stop}
+%%%%
+%%%% It will return the 'root ref' assuming that the ref is of form root.name.name (no [idx])
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \__starray_get_root:w #1 . #2 \q_stop { #1 }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% adding property #3 (#4 being it's initial/default value)
+%%%% #1 prefix
+%%%% #2 starray
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_def_prop:nnn #1#2#3
+ {
+ \prop_get:cnN {\l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop
+ \prop_put:Nnn \l_tmpa_prop {#2} {#3}
+ \prop_gput:cnV {\l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop
+ }
+
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_def_prop
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_def_prop:nnn #1#2#3
+ {
+ \__starray_if_valid:nTF {\l__starray_prefix_tl #1 _def_prop}
+ { \__starray_def_prop:nnn {#1} {#2} {#3} }
+ {
+ \msg_warning:nnxxx {starray}{reference / invalid-starray}
+ {addprop:1} {#1} {cannot~add~property:#2}
+ }
+ }
+
+
+\prg_new_conditional:Npnn \starray_def_prop:nnn #1#2#3 {p, T, F, TF}
+ {
+ \__starray_if_valid:nTF {\l__starray_prefix_tl #1 _def_prop}
+ {
+ \__starray_def_prop:nnn {#1} {#2} {#3}
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% adding struct array #2 to a starray
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \__starray_def_struct:nn #1#2
+ {
+ \prop_get:cnN {\l__starray_prefix_tl #1 _def_prop} {@st_seq} \l_tmpa_seq
+ \seq_if_in:NnF \l_tmpa_seq {#2}
+ {
+ \seq_put_right:Nn \l_tmpa_seq {#2}
+
+ \prop_gput:cnV {\l__starray_prefix_tl #1 _def_prop} {@st_seq} \l_tmpa_seq
+
+ \__starray_new:e { #1 . #2}
+ }
+ }
+
+\cs_generate_variant:Nn \__starray_def_struct:nn {ne}
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% fixing struct _base for already instantiated terms
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%TODO: recurse over 'terms' to fix a 'late addtion' (after being instantiated?)
+
+\cs_new:Npn \__starray_fix_terms_seq_aux:nnnn #1#2#3#4
+ {
+ \__starray_if_valid:eTF {\l__starray_prefix_tl #2 _ #3 . #4 _base_prop}
+ {
+ \__starray_fix_terms:nn {#1.#4}{#2_#3.#4}
+ }
+ {
+ \__starray_base_new:ee {#1.#4}{#2_#3.#4}
+ }
+ }
+
+\cs_new:Npn \__starray_fix_terms_seq:nnnn #1#2#3#4
+ {
+ \prop_get:cnN
+ {\l__starray_prefix_tl #2 _base_prop}
+ {def_ref}
+ \l_tmpa_tl
+ \prop_get:cec
+ {\l__starray_prefix_tl \l_tmpa_tl _def_prop}
+ {@st_seq}
+ {l__starray_tmp A_seq}
+ \seq_map_tokens:cn
+ {l__starray_tmp A_seq}
+ {\__starray_fix_terms_seq_aux:nnnn {#1}{#2}{#4}}
+
+ }
+
+\cs_new:Npn \__starray_fix_terms:nn #1#2
+ {
+ \group_begin:
+ \prop_get:cnc
+ {\l__starray_prefix_tl #2 _base_prop}
+ {idx_hash}
+ {l__starray_tmp A_prop}
+ \prop_if_empty:cF {l__starray_tmp A_prop}
+ {
+ \prop_map_tokens:cn
+ {l__starray_tmp A_prop}
+ {\__starray_fix_terms_seq:nnnn {#1}{#2}}
+ }
+ \group_end:
+ }
+
+\cs_generate_variant:Nn \__starray_fix_terms:nn {ee}
+
+
+
+\cs_new:Npn \starray_fix_terms:n #1
+ {
+ \tl_set:Ne \l_tmpb_tl {\__starray_get_root:w #1 . \q_nil \q_stop}
+
+ \__starray_if_valid:nTF { \l__starray_prefix_tl \l_tmpb_tl _def_prop}
+ {
+ \__starray_fix_terms:ee {\l_tmpb_tl}{\l_tmpb_tl}
+ }
+ {
+ \msg_warning:nnxxx {starray}{reference / invalid-starray}
+ {fixterms:1} {#1} {}
+ }
+ }
+
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_def_struct
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_def_struct:nn #1#2
+ {
+ \__starray_if_valid:nTF { \l__starray_prefix_tl #1 _def_prop}
+ {
+ \__starray_def_struct:nn {#1} {#2}
+ }
+ {
+ \msg_warning:nnxxx {starray}{reference / invalid-starray}
+ {addstruct:1} {#1} {cannot~add~structure:#2}
+ }
+ }
+
+\prg_new_conditional:Npnn \starray_def_struct:nn #1#2 {p, T, F, TF}
+ {
+ \__starray_if_valid:nTF { \l__starray_prefix_tl #1 _def_prop}
+ {
+ \__starray_def_struct:nn {#1} {#2}
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% adding prop/struct from keyval
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\prg_new_conditional:Npnn \__starray_def_from_keyval_testdot_aux:w #1 . \q_nil { p, TF}
+ {
+ \str_compare:nNnTF {#1} = {struct}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+
+
+\prg_new_conditional:Npnn \__starray_def_from_keyval_testdot:w #1 . #2 \q_stop { TF}
+ {
+ \quark_if_nil:nTF {#2}
+ {
+ \prg_return_false:
+ } % no dot, OK
+ {
+ \__starray_def_from_keyval_testdot_aux:wTF #2
+ {
+ \tl_set:Ne \l__starray_tmpST_tl { #1 }
+ \prg_return_true:
+ } % dot struct, OK
+ {
+% \bool_gset_false:N \l__starray_rtn_bool
+ \prg_return_false:
+ } %% possible syntax ERR (dot, but no struct!)
+ }
+ }
+
+
+\cs_new:Npn \__starray_def_from_keyval_parse:nnn #1#2#3
+ {
+ \group_begin:
+ \__starray_def_from_keyval_testdot:wTF #2 . \q_nil \q_stop
+ {
+ \tl_set:ce {l__starray_tmp A _tl} {#1 . \l__starray_tmpST_tl}
+ \__starray_def_struct:ne {#1} {\l__starray_tmpST_tl}
+ \keyval_parse:nnn
+ {\__starray_def_from_keyval_parse:en {\tl_use:c {l__starray_tmp A _tl}}}
+ {\__starray_def_from_keyval_parse:enn {\tl_use:c {l__starray_tmp A _tl}}}
+ {#3}
+ }
+ {
+ \__starray_def_prop:nnn {#1} {#2} {#3}
+ }
+ \group_end:
+ }
+
+\cs_generate_variant:Nn \__starray_def_from_keyval_parse:nnn {enn}
+
+
+\cs_new:Npn \__starray_def_from_keyval_parse:nn #1#2
+ {
+ \__starray_def_prop:nnn {#1} {#2} {}
+ }
+
+\cs_generate_variant:Nn \__starray_def_from_keyval_parse:nn {en}
+
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_def_from_keyval
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_def_from_keyval:nn #1#2
+ {
+% \bool_set_true:N \l__starray_rtn_bool
+ \__starray_if_valid:nTF { \l__starray_prefix_tl #1 _def_prop}
+ {
+ \keyval_parse:nnn
+ {\__starray_def_from_keyval_parse:en {#1}}
+ {\__starray_def_from_keyval_parse:enn {#1}}
+ { #2 }
+ }
+ {
+ \msg_warning:nnxxx {starray}{reference / invalid-starray}
+ {addkeyval:1} {#1} {cannot~add:#2}
+ }
+ }
+
+\cs_generate_variant:Nn \starray_def_from_keyval:nn {ne , ee}
+
+
+\prg_new_conditional:Npnn \starray_def_from_keyval:nn #1#2 {p, T, F, TF}
+ {
+ \__starray_if_valid:nTF { \l__starray_prefix_tl #1 _def_prop}
+ {
+ \keyval_parse:nnn
+ {\__starray_def_from_keyval_parse:en {#1}}
+ {\__starray_def_from_keyval_parse:enn {#1}}
+ { #2 }
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% adding terms
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \__starray_new_term:nn #1#2
+ {
+ \int_gincr:N
+ {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} }
+
+ \int_gset_eq:NN
+ {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {iter} }
+ {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} }
+
+
+ % idx_hash Update.
+ \prop_get:cnN {\l__starray_prefix_tl #1 _base_prop} {idx_hash} \l_tmpa_prop
+
+ \prop_put:Nee \l_tmpa_prop
+ { \int_use:N \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} }
+ { \int_to_Alph:e { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } }
+
+ \tl_if_blank:nF {#2}
+ {
+ \prop_put:Nee \l_tmpa_prop
+ { #2 }
+ { \int_to_Alph:e { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } }
+ }
+
+ \prop_gput:cnV {\l__starray_prefix_tl #1 _base_prop} {idx_hash} \l_tmpa_prop
+
+ % creating the 'new property list' (aka. term)
+ \tl_set:Ne \l_tmpa_tl
+ { \int_to_Alph:e { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } }
+
+ \prop_new:c
+ { \l__starray_prefix_tl #1 _ \l_tmpa_tl _term_prop }
+
+ \prop_get:cnN {\l__starray_prefix_tl #1 _base_prop} {def_ref} \l_tmpb_tl
+
+ \prop_get:cnN {\l__starray_prefix_tl \l_tmpb_tl _def_prop} {def} \l_tmpa_prop
+
+ \prop_gset_eq:cN { \l__starray_prefix_tl #1 _ \l_tmpa_tl _term_prop } \l_tmpa_prop
+
+ \prop_get:cnN {\l__starray_prefix_tl \l_tmpb_tl _def_prop} {@st_seq} \l_tmpa_seq
+
+% map over 'all sub-starrays parts of def_ref -> st_seq (those starting with a dot, @st_seq)
+ \seq_map_tokens:Nn
+ \l_tmpa_seq
+ {
+ \__starray_sub_base_new:nnn
+ { \l_tmpb_tl }{ #1 _ \l_tmpa_tl }
+ }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_new_term
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_new_term:nn #1#2
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \__starray_new_term:nn
+ {\l__starray_parsed_ref_tl }
+ {#2}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray}{syntax / term}{addterm:2}{#1}
+ }
+ }
+
+\prg_new_conditional:Npnn \starray_new_term:nn #1#2 {p, T, F, TF}
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \__starray_new_term:nn
+ {\l__starray_parsed_ref_tl }
+ {#2}
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% changing iterator value (recursing sub-structures)
+%%%%
+%%%% NOTE: since iterator change 'can' be just local, 'temp vars' are recursive aware.
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \__starray_incr_iter:n #1
+ {
+ \int_compare:nNnTF
+ {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {iter}} <
+ {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt}}
+ {
+ \int_gincr:N { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {iter} }
+ }
+ {
+ % TODO: should it be a potential 'warning' ???
+ \bool_set_false:N \l__starray_rtn_bool
+ }
+ }
+
+\prg_new_conditional:Npnn \__starray_set_iter:nn #1#2 {p , T , F , TF}
+ {
+ \int_compare:nNnTF {#1} > {\prop_item:cn {\l__starray_prefix_tl #2 _base_prop} {cnt}}
+ {
+ \int_gset_eq:NN
+ { \prop_item:cn {\l__starray_prefix_tl #2 _base_prop} {iter} }
+ { \prop_item:cn {\l__starray_prefix_tl #2 _base_prop} {cnt} }
+ \prg_return_false:
+ }
+ {
+ \int_gset:Nn
+ { \prop_item:cn {\l__starray_prefix_tl #2 _base_prop} {iter} }
+ { #1 }
+ \prg_return_true:
+ }
+ }
+
+\prg_generate_conditional_variant:Nnn \__starray_set_iter:nn {ne} {p , T , F , TF}
+
+\cs_new:Npn \__starray_set_sub_iter:nnn #1#2#3
+ {
+ \prop_get:cnN {\l__starray_prefix_tl #2#3 _base_prop} {idx_hash} \l_tmpa_prop
+
+ \prop_get:NecT \l_tmpa_prop
+ { \int_use:N \prop_item:cn {\l__starray_prefix_tl #2#3 _base_prop} {iter} }
+ { l__starray_tmp #1 A_tl }
+ {
+ \prop_get:cnN
+ {\l__starray_prefix_tl #2#3 _base_prop}
+ {def_ref}
+ \l_tmpa_tl
+
+ \prop_get:cnc
+ { \l__starray_prefix_tl \l_tmpa_tl _def_prop }
+ { @st_seq }
+ {l__starray_tmp #1 A_seq }
+
+ \seq_if_empty:cF {l__starray_tmp #1 A_seq }
+ {
+ \seq_map_variable:cNn
+ { l__starray_tmp #1 A_seq }
+ \l_tmpb_tl
+ {
+ \__starray_set_iter:neTF
+ { 1 }
+ { #2#3 _ \tl_use:c {l__starray_tmp #1 A_tl} . \l_tmpb_tl }
+ {}
+ {}
+
+ \__starray_set_sub_iter:nne
+ { #1 A }
+ { #2#3 _ \tl_use:c {l__starray_tmp #1 A_tl} . }
+ { \l_tmpb_tl }
+ }
+ }
+ }
+ }
+
+\cs_generate_variant:Nn \__starray_set_sub_iter:nnn {nne}
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_set_iter
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_set_iter:nn #1#2
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_compare:nNnTF {#2} < {1}
+ {
+ \__starray_set_iter:nnTF {1}{\l__starray_parsed_ref_tl}
+ {} {}
+ }
+ {
+ \__starray_set_iter:nnTF {#2}{\l__starray_parsed_ref_tl}
+ {} {}
+ }
+ \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / iter} {iter:1} {#1}
+ } % returns nothing by default
+ }
+
+
+
+\prg_new_conditional:Npnn \starray_set_iter:nn #1#2 {p, T, F, TF}
+ {
+ \bool_set_true:N \l__starray_rtn_bool
+
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_compare:nNnTF {#2} < {1}
+ {
+ \bool_set_false:N \l__starray_rtn_bool
+ \__starray_set_iter:nnTF {1}{\l__starray_parsed_ref_tl}
+ {}
+ {}
+ }
+ {
+ \__starray_set_iter:nnTF {#2}{\l__starray_parsed_ref_tl}
+ {}
+ {\bool_set_false:N \l__starray_rtn_bool}
+ }
+ \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}
+ \bool_if:NTF \l__starray_rtn_bool
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_reset_iter
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_reset_iter:n #1
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \__starray_set_iter:nnTF {1}{\l__starray_parsed_ref_tl} {}{}
+ \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / iter} {iter:4} {#1}
+ } % returns nothing by default
+ }
+
+
+\prg_new_conditional:Npnn \starray_reset_iter:n #1 {p, T, F, TF}
+ {
+ \bool_set_true:N \l__starray_rtn_bool
+
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \__starray_set_iter:nnTF {1}{\l__starray_parsed_ref_tl} {}{\bool_set_false:N \l__starray_rtn_bool} %% TODO: verify logic !@!!
+ \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}
+ \bool_if:NTF \l__starray_rtn_bool
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ }
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_next_iter
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_next_iter:n #1
+ {
+% \bool_set_true:N \l__starray_rtn_bool
+ \seq_clear:N \l__starray_msg_seq
+
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \__starray_incr_iter:n {\l__starray_parsed_ref_tl}
+ \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}
+ }
+ {
+ \__starray_msg_dispatch:
+% \bool_set_false:N \l__starray_rtn_bool
+ \msg_warning:nnnn {starray} {syntax / iter} {iter:5} {#1}
+ } % returns nothing by default
+ }
+
+
+
+\prg_new_conditional:Npnn \starray_next_iter:n #1 {p, T, F, TF}
+ {
+ \bool_set_true:N \l__starray_rtn_bool
+ \seq_clear:N \l__starray_msg_seq
+
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \__starray_incr_iter:n {\l__starray_parsed_ref_tl}
+ \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}
+ \bool_if:NTF \l__starray_rtn_bool
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+ { \prg_return_false: }
+ }
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% set/get properties
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_get_prop:nn #1#2
+ {
+ \prop_item:cn {\l__starray_prefix_tl #1 _term_prop}{#2}
+ }
+
+\cs_generate_variant:Nn \__starray_get_prop:nn {ee}
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_get_prop
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_get_prop:nn #1#2
+ {
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \__starray_get_prop:ee {\l__starray_parsed_ref_tl}{#2}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop} {get:1} {#1}
+ } % returns nothing by default
+ }
+
+\cs_new:Npn \starray_get_prop:nnN #1#2#3
+ {
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \prop_get:cnNF
+ {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} {#2} #3
+ { \tl_set:Nn #3 {} }
+ }
+ {
+ \tl_set:Nn #3 {}
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {get:1} {#1}
+ } % returns nothing by default
+ }
+
+
+\prg_new_conditional:Npnn \starray_get_prop:nnN #1#2#3 {p, T, F, TF}
+ {
+ \__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
+ {
+ \prg_return_true:
+ }
+ {
+ \tl_set:Nn #3 {}
+ \prg_return_false:
+ }
+ }
+ {
+ \tl_set:Nn #3 {}
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ } % returns nothing by default
+ }
+
+
+\prg_new_conditional:Npnn \starray_if_in:nn #1#2 {p, T, F, TF}
+ {
+ \__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:
+ }
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ } % returns nothing by default
+ }
+
+
+\cs_new:Npn \starray_get_cnt:n #1
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_use:N
+ \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop } {cnt}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop} {get:XX} {#1}
+ } % returns nothing by default
+ }
+
+\cs_new:Npn \starray_get_cnt:nN #1#2
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_set_eq:NN
+ #2
+ \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop } {cnt}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {get:XX} {#1}
+ } % returns nothing by default
+ }
+
+\prg_new_conditional:Npnn \starray_get_cnt:nN #1#2 {p, T, F, TF}
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_set_eq:NN
+ #2
+ \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop } {cnt}
+ \prg_return_true:
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ } % returns nothing by default
+ }
+
+\cs_new:Npn \starray_get_iter:n #1
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_use:N
+ \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop } {iter}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {get:XX} {#1}
+ } % returns nothing by default
+ }
+
+
+\cs_new:Npn \starray_get_iter:nN #1#2
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_set_eq:NN
+ #2
+ \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop } {iter}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {get:XX} {#1}
+ } % returns nothing by default
+ }
+
+\prg_new_conditional:Npnn \starray_get_iter:nN #1#2 {p, T, F, TF}
+ {
+ \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+ {
+ \int_set_eq:NN
+ #2
+ \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop } {iter}
+ \prg_return_true:
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ } % returns nothing by default
+ }
+
+
+
+
+
+\cs_new:Npn \__starray_set_prop:nnn #1#2#3
+ {
+ \l__starray_put_tl {\l__starray_prefix_tl #1 _term_prop}{#2}{#3}
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_set_prop
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_set_prop:nnn #1#2#3
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_put:cnn
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \__starray_set_prop:nnn {\l__starray_parsed_ref_tl}{#2}{#3}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {set:1} {#1}
+ } % returns nothing by default
+ }
+
+\cs_generate_variant:Nn \starray_set_prop:nnn {nnV}
+
+\cs_new:Npn \starray_gset_prop:nnn #1#2#3
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_gput:cnn
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \__starray_set_prop:nnn {\l__starray_parsed_ref_tl}{#2}{#3}
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {set:1} {#1}
+ } % returns nothing by default
+ }
+
+\cs_generate_variant:Nn \starray_gset_prop:nnn {nnV}
+
+
+\prg_new_conditional:Npnn \starray_set_prop:nnn #1#2#3 {p, T, F, TF}
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_put:cnn
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \__starray_set_prop:nnn {\l__starray_parsed_ref_tl}{#2}{#3}
+ \prg_return_true:
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ }
+ }
+
+\prg_generate_conditional_variant:Nnn \starray_set_prop:nnn { nnV } { p , T, F , TF }
+
+\prg_new_conditional:Npnn \starray_gset_prop:nnn #1#2#3 {p, T, F, TF}
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_gput:cnn
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \__starray_set_prop:nnn {\l__starray_parsed_ref_tl}{#2}{#3}
+ \prg_return_true:
+ }
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ }
+ }
+
+
+\prg_generate_conditional_variant:Nnn \starray_gset_prop:nnn { nnV } { p , T, F , TF }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% set/get properties (keyval)
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\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
+ {
+ \tl_set:cn {l__starray_tmp #1 :A_tl} {#2}
+ \prg_return_true:
+ }
+ }
+
+
+\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:}
+ {\prg_return_false:}
+ }
+
+
+\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)
+ \tl_clear:c {l__starray_tmp #1 :A_tl}
+ \prg_return_true:
+ }
+ {
+ \tl_set:cn {l__starray_tmp #1 :B_tl}{#2}
+ \__starray_set_parse_aux:wTF {#1}#3 \q_stop
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+ }
+
+
+
+\cs_new:Npn \__starray_set_from_keyval_parse:nnnn #1#2#3#4
+ {
+ \__starray_set_prop:nnn {#3}{#4}{}
+ }
+
+\cs_generate_variant:Nn \__starray_set_from_keyval_parse:nnnn {nnen}
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% set from keyval
+%%%%
+%%%% NOTE: tmp variables are recursive aware.
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_set_from_keyval_parse:nnnnn #1#2#3#4#5
+ {
+ \tl_clear:c {l__starray_tmp #1 _tl}
+ \__starray_set_parse_begin:wTF {#1}#4 [ \q_nil \q_stop
+ {
+ \tl_if_blank:eTF {\tl_use:c{l__starray_tmp #1 :A_tl}}
+ {
+ \prop_get:cnc
+ {\l__starray_prefix_tl #2 _def_prop}
+ {@st_seq}
+ {l__starray_tmp #1 _seq}
+
+ \seq_if_in:cnTF {l__starray_tmp #1 _seq}{#4}
+ {
+ \prop_get:cnc
+ { \l__starray_prefix_tl #3 .#4 _base_prop }
+ { idx_hash }
+ { l__starray_tmp #1 _hash_prop }
+ \prop_get:cnc
+ { \l__starray_prefix_tl #3 .#4 _base_prop }
+ { iter }
+ { l__starray_tmp #1 _int }
+ \int_compare:nNnTF {\int_use:c {l__starray_tmp #1 _int}} < {1}
+ {
+ \__starray_msg:nnnnn {reference / iter}
+ {setkeyval:2}{#2.#4}{-0-}{~(not~instantiated)}
+ % invalid iter / not instantiated
+ }
+ {
+ \tl_set:ce
+ { l__starray_tmp #1 _tl }
+ { #3.#4 _ \int_to_Alph:e {\int_use:c {l__starray_tmp #1 _int}} }
+ \keyval_parse:nnn
+ {
+ \__starray_set_from_keyval_parse:nnen
+ { #1 A }
+ { #2.#4 }
+ { \tl_use:c { l__starray_tmp #1 _tl } }
+ }
+ {
+ \__starray_set_from_keyval_parse:nnenn
+ { #1 A }
+ { #2.#4 }
+ { \tl_use:c { l__starray_tmp #1 _tl } }
+ }
+ { #5 }
+
+ }
+ }
+ {
+ \__starray_set_prop:nnn {#3}{#4}{#5}
+ }
+ }
+ {
+ \prop_get:cnc
+ { \l__starray_prefix_tl #2 _def_prop }
+ { @st_seq }
+ { l__starray_tmp #1 _seq }
+
+ \seq_if_in:ceTF
+ { l__starray_tmp #1 _seq } { \tl_use:c{l__starray_tmp #1 :B_tl} }
+ {
+ \prop_get:cnc
+ { \l__starray_prefix_tl #3. \tl_use:c{l__starray_tmp #1 :B_tl} _base_prop }
+ { idx_hash }
+ { l__starray_tmp #1 _hash_prop }
+ \tl_set:ce
+ { l__starray_tmp #1 _idx_tl }
+ {
+ #3 . \tl_use:c{l__starray_tmp #1 :B_tl} _
+ \prop_item:ce
+ { l__starray_tmp #1 _hash_prop }
+ { \tl_use:c{ l__starray_tmp #1 :A_tl } }
+ }
+ \tl_put_left:cn { l__starray_tmp #1 :B_tl } { #2 . }
+ \prop_if_in:ceTF
+ { l__starray_tmp #1 _hash_prop }
+ { \tl_use:c{l__starray_tmp #1 :A_tl}}
+ {
+ \keyval_parse:nnn
+ {
+ \__starray_set_from_keyval_parse:nnen
+ { #1 A }
+ { \tl_use:c{l__starray_tmp #1 :B_tl} }
+ { \tl_use:c { l__starray_tmp #1 _idx_tl } }
+ }
+ {
+ \__starray_set_from_keyval_parse:nnenn
+ { #1 A }
+ { \tl_use:c{l__starray_tmp #1 :B_tl} }
+ { \tl_use:c { l__starray_tmp #1 _idx_tl } }
+ }
+ { #5 }
+
+ }
+ {
+ \__starray_msg:nneee {reference / iter}
+ {setkeyval:3} {#2.#4} {\tl_use:c{l__starray_tmp #1 :A_tl}} {}
+ % invalid hash
+ }
+ }
+ {
+ \__starray_msg:nneee {syntax / structure-ref}
+ {setkeyval:4} {#2.#4} {\tl_use:c{l__starray_tmp #1 :B_tl}} {}
+ % invalid ref / not a substructure
+ }
+ }
+ }
+ {
+ \__starray_msg:nnnnn {syntax / term}
+ {setkeyval:5}{#4}{}{}
+ % invalid ref/syntax
+ }
+ }
+
+\cs_generate_variant:Nn \__starray_set_from_keyval_parse:nnnnn {nnenn}
+
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_set_from_keyval
+%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_set_from_keyval:nn #1#2
+ {
+ \bool_set_true:N \l__starray_rtn_bool
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \keyval_parse:nnn
+ {\__starray_set_from_keyval_parse:nnen {A}{#1}{\l__starray_parsed_ref_tl}}
+ {\__starray_set_from_keyval_parse:nnenn {A}{#1}{\l__starray_parsed_ref_tl}}
+ { #2 }
+ \bool_if:NF \l__starray_rtn_bool
+ { \__starray_msg_dispatch: }
+ }
+ {
+ \__starray_msg_dispatch:
+ \msg_warning:nnnn {starray} {syntax / prop}
+ {setkeyval:1} {#1}
+ } % returns nothing by default
+ }
+
+
+\cs_new:Npn \starray_set_from_keyval:nn #1#2
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_put:cnn
+ \__starray_set_from_keyval:nn {#1}{#2}
+ }
+
+\cs_new:Npn \starray_gset_from_keyval:nn #1#2
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_gput:cnn
+ \__starray_set_from_keyval:nn {#1}{#2}
+ }
+
+
+\cs_new:Npn \__starray_set_from_keyvalTF:nn #1#2
+ {
+ \bool_set_true:N \l__starray_rtn_bool
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {
+ \keyval_parse:nnn
+ {\__starray_set_from_keyval_parse:nnen {A}{#1}{\l__starray_parsed_ref_tl}}
+ {\__starray_set_from_keyval_parse:nnenn {A}{#1}{\l__starray_parsed_ref_tl}}
+ { #2 }
+ \bool_if:NTF \l__starray_rtn_bool
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+ { \prg_return_false: }
+ }
+
+\prg_new_conditional:Npnn \starray_set_from_keyval:nn #1#2 {p, T, F, TF}
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_put:cnn
+ \__starray_set_from_keyvalTF:nn {#1}{#2}
+ }
+
+\prg_new_conditional:Npnn \starray_gset_from_keyval:nn #1#2 {p, T, F, TF}
+ {
+ \tl_set:Nn \l__starray_put_tl \prop_gput:cnn
+ \__starray_set_from_keyvalTF:nn {#1}{#2}
+ }
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% starray ref/address parser using quarks
+%%%% could be done with seq_split and regex but
+%%%% would have been even more cumbersome
+%%%%
+%%%% <starray_ref> := <array_ref> [ . <starray_ref> ]
+%%%% <array_ref> := <array_name> [ <term_ref> ]
+%%%% <term_ref> := \[ <number/hash> \]
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\prg_new_conditional:Npnn \__starray_term_parse_end:w #1 ] #2 \q_stop { TF}
+ {
+ \quark_if_nil:nTF {#2}
+ { \prg_return_false: } %% syntax ERR
+ {
+ \tl_set:Nn \l__starray_parsed_idx_tl {#1}
+ \prg_return_true:
+ }
+ }
+
+
+\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:}
+ {\prg_return_false:}
+ }
+
+
+\prg_new_conditional:Npnn \__starray_term_parse_begin:w #1 [ #2 \q_stop { TF}
+ {
+ \tl_set:Nn \l__starray_parsed_term_tl {#1}
+
+ \quark_if_nil:nTF {#2}
+ { % no 'term' ref, just array_name (current/iter term)
+ \tl_clear:N \l__starray_parsed_idx_tl
+ \prg_return_true:
+ }
+ {
+ \__starray_term_parse_aux:wTF #2 \q_stop
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+ }
+
+
+% verify #2 before going for #1 . . .
+% if #2 isn't empty test for it return true/false
+% if #2 is empty, test if #1 is valid, return true/false
+\prg_new_conditional:Npnn \__starray_if_valid_idx:nn #1#2 {p, T, F, TF}
+ {
+ \prop_get:cnN {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop} {idx_hash} \l_tmpa_prop
+
+ \tl_if_blank:nTF {#2}
+ {
+ \tl_put_right:Ne \l__starray_parsed_ref_tl
+ { _ \prop_item:Ne \l_tmpa_prop {#1} }
+ }
+ {
+ \tl_put_right:Ne \l__starray_parsed_ref_tl
+ { _ \prop_item:Ne \l_tmpa_prop {#2} }
+ }
+
+ \prop_if_exist:cTF { \l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop }
+ {\prg_return_true:}
+ {\prg_return_false:}
+ }
+
+\prg_generate_conditional_variant:Nnn \__starray_if_valid_idx:nn {ee} {p, T, F, TF}
+
+\cs_new:Npn \__starray_ref_parse:w #1 . #2 \q_stop
+ {
+ \tl_put_right:Ne \l__starray_parsed_tl {#1}
+
+ \__starray_term_parse_begin:wTF #1 [ \q_nil \q_stop
+ { % syntax ok so far.
+ % TODO: verify instance validity hash/index
+ % vars: \l__starray_parsed_term_tl
+ % \l__starray_parsed_idx_tl
+ \tl_put_right:Ne \l__starray_parsed_ref_tl
+ { \l__starray_parser_aux_tl \l__starray_parsed_term_tl }
+ \tl_put_right:Ne \l__starray_parsed_base_ref_tl
+ { \l__starray_parser_aux_tl \l__starray_parsed_term_tl }
+ \tl_set:Nn \l__starray_parser_aux_tl { . }
+
+ \__starray_if_valid:eTF
+ {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop}
+ {
+ \quark_if_nil:nTF {#2}
+ { % this is the last one
+ \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
+ { } % done. correct
+ {
+ \bool_set_false:N \l__starray_parser_OK_bool
+ \__starray_msg:nneee {syntax / ref-syntax-err} {parser:1}
+ {\l__starray_parsing_term_tl}
+ {invalid~index~\l__starray_parsed_idx_tl~(at~the~end)}
+ {}
+ } % err !
+ }
+ { % assuming it is to set/get a property
+ \__starray_if_valid_idx:eeTF
+ {
+ \int_use:N
+ \prop_item:cn
+ {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop}
+ {iter}
+ }
+ {
+ \l__starray_parsed_idx_tl
+ }
+ { } % done, finish, ok
+ {
+ \bool_set_false:N \l__starray_parser_OK_bool
+ \__starray_msg:nneee {syntax / ref-syntax-err} {parser:2}
+ {\l__starray_parsing_term_tl}
+ {invalid~index~\l__starray_parsed_idx_tl}
+ {}
+ }
+ }
+ }
+ {
+ \__starray_if_valid_idx:eeTF
+ {
+ \int_use:N
+ \prop_item:cn
+ {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop}
+ {iter}
+ }
+ {
+ \l__starray_parsed_idx_tl
+ }
+ {
+ \__starray_ref_parse:w #2 \q_stop
+ } % recurse next term
+ {
+ \bool_set_false:N \l__starray_parser_OK_bool
+ \__starray_msg:nneee {syntax / ref-syntax-err} {parser:3}
+ {\l__starray_parsing_term_tl}
+ {invalid~index~\l__starray_parsed_idx_tl}
+ {}
+ }
+ }
+ }
+ {
+ \bool_set_false:N \l__starray_parser_OK_bool
+ \__starray_msg:nneee {syntax / ref-syntax-err} {parser:4}
+ {\l__starray_parsing_term_tl}
+ {invalid~struct~\l__starray_parsed_ref_tl}
+ {}
+ } % invalid/ref err.
+ }
+ {
+ \bool_set_false:N \l__starray_parser_OK_bool
+ \__starray_msg:nneee {syntax / ref-syntax-err} {parser:5}
+ {\l__starray_parsing_term_tl}
+ {invalid~struct~#1~at~\l__starray_parsed_tl}
+ {}
+ } % syntax/ref err.
+ }
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% parser 'true' returns:
+%%%% \l__starray_parsed_ref_tl
+%%%% \l__starray_parsed_base_ref_tl
+%%%% \l__starray_parsed_root_ref_tl
+%%%% parser 'false' returns:
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+\prg_new_conditional:Npnn \__starray_parser:nn #1#2 {p, T, F, TF}
+ {
+ \bool_set_eq:NN \l__starray_parser_no_idx_ending_bool #1
+ \bool_set_true:N \l__starray_parser_OK_bool
+
+ \tl_clear:N \l__starray_parsed_tl
+ \tl_clear:N \l__starray_parsed_ref_tl
+ \tl_clear:N \l__starray_parsed_base_ref_tl
+ \tl_clear:N \l__starray_parsed_root_ref_tl
+
+ \tl_set:Nn \l__starray_parser_aux_tl {}
+
+ \tl_set:Nn \l__starray_parsing_term_tl {#2}
+
+ \__starray_ref_parse:w #2 .\q_nil\q_stop
+
+ \bool_if:NTF \l__starray_parser_OK_bool
+ {
+ \tl_set:Ne \l__starray_parsed_root_ref_tl
+ { \__starray_get_root:w \l__starray_parsed_base_ref_tl .\q_nil\q_stop }
+ \prg_return_true:
+ }
+ {
+ \prg_return_false:
+ }
+ }
+
+
+\prg_new_conditional:Npnn \starray_term_syntax:n #1 {p, T, F, TF}
+ {
+ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1}
+ {\prg_return_true:}
+ {
+ \seq_clear:N \l__starray_msg_seq
+ \prg_return_false:
+ }
+ }
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \..show_def commands
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% Note to self:
+%%%% \l__starray_showcmd_tl could be an extra param as well
+%%%% (more tokens jungling around...)
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_show_def_item:nnn #1#2#3
+ {
+ \tl_gput_right:Nn \l__starray_tmpa_tl
+ {
+ \l__starray_showcmd_tl > #1 \use:nnn { ~ } { ~ } { ~ }
+ \tl_to_str:n { {#2} }
+ \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ }
+ \tl_to_str:n { {#3} }
+ }
+ }
+
+\cs_new:Npn \__starray_show_def:nnn #1#2#3
+ {
+ \group_begin:
+ \tl_gput_right:Nn \l__starray_tmpa_tl
+ {
+ \l__starray_showcmd_tl > #1
+ \tl_to_str:n {{#3} ~ struct}
+ \use:nn { ~ } { ~ } =>
+ }
+
+ \prop_get:cnc
+ {\l__starray_prefix_tl #2#3 _def_prop}
+ {def}
+ {l__starray_tmp A _def_prop}
+
+ \prop_get:cnc
+ { \l__starray_prefix_tl #2#3 _def_prop }
+ { @st_seq }
+ {l__starray_tmp A _seq }
+
+ \prop_map_tokens:cn
+ {l__starray_tmp A _def_prop}
+ {\__starray_show_def_item:nnn {#1}}
+
+ \seq_if_empty:cF { l__starray_tmp A _seq }
+ {
+ \seq_map_tokens:cn
+ { l__starray_tmp A _seq }
+ { \__starray_show_def:nnn { #1 \use:nnn { ~ } { ~ } { ~ }} { #2#3. } }
+ }
+ \group_end:
+ }
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_show_def
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_show_def:n #1
+ {
+ \tl_clear:N \l__starray_tmpa_tl
+ \tl_set:Nn \l__starray_showcmd_tl \iow_newline:
+ \__starray_show_def:nnn {}{}{#1}
+
+ \msg_show:nnxxx {starray}{info / show}
+ { show~def }
+ { The~ starray~ <#1> ~is~defined~as~follow: }
+ { \tl_use:N \l__starray_tmpa_tl }
+ }
+
+\cs_new:Npn \starray_show_def_in_text:n #1
+ {
+ \tl_clear:N \l__starray_tmpa_tl
+ \tl_set:Nn \l__starray_showcmd_tl \par
+ \__starray_show_def:nnn {}{}{#1}
+
+ \tl_use:N \l__starray_tmpa_tl
+ }
+
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \..show_terms commands
+%%%%
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+%%%%
+%%%% Note to self:
+%%%% \l__starray_showcmd_tl could be an extra param as well
+%%%% (more tokens jungling around...)
+%%%%
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
+
+
+\cs_new:Npn \__starray_show_term_item:nnnnn #1#2#3#4#5
+ {
+ \group_begin:
+ \tl_gput_right:Nn \l__starray_tmpa_tl
+ {
+ \l__starray_showcmd_tl > #1
+ \tl_to_str:n { {#3[#4]} ~ (idx: ~ #5)}
+ \use:nn { ~ } { ~ } =>
+ }
+
+ \prop_map_tokens:cn
+ {\l__starray_prefix_tl #2 #3 _ #5 _term_prop}
+ {\__starray_show_def_item:nnn {#1 }}
+
+ \prop_get:cnN
+ { \l__starray_prefix_tl #2 #3 _base_prop }
+ { def_ref }
+ \l_tmpa_tl
+
+ \prop_get:cnc
+ { \l__starray_prefix_tl \l_tmpa_tl _def_prop }
+ { @st_seq }
+ {l__starray_tmp A _seq }
+
+ \seq_if_empty:cTF { l__starray_tmp A _seq }
+ {}
+ {
+ \seq_map_tokens:cn
+ { l__starray_tmp A _seq }
+ { \__starray_show_terms:nen { #1 \use:nnn { ~ } { ~ } { ~ }} { #2 #3_#5. } }
+ }
+ \group_end:
+ }
+
+
+
+\cs_new:Npn \__starray_show_terms:nnn #1#2#3
+ {
+ \group_begin:
+ \prop_get:cnc
+ {\l__starray_prefix_tl #2 #3 _base_prop}
+ {idx_hash}
+ {l__starray_tmp A _idx_prop}
+
+ \prop_map_tokens:cn
+ {l__starray_tmp A _idx_prop}
+ {\__starray_show_term_item:nnnnn {#1}{#2}{#3}}
+ \group_end:
+ }
+
+\cs_generate_variant:Nn \__starray_show_terms:nnn {nen}
+
+%%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_show_terms
+%%%%
+%%%%%%%%%%%%%%%
+
+\cs_new:Npn \starray_show_terms:n #1
+ {
+ \tl_clear:N \l__starray_tmpa_tl
+ \tl_set:Nn \l__starray_showcmd_tl \iow_newline:
+ \__starray_show_terms:nnn {}{}{#1}
+
+ \msg_show:nnxxx {starray}{info / show}
+ { show~terms }
+ { The~ starray~ <#1> ~has~the~following~terms: }
+ { \tl_use:N \l__starray_tmpa_tl }
+ }
+
+\cs_new:Npn \starray_show_terms_in_text:n #1
+ {
+ \tl_clear:N \l__starray_tmpa_tl
+ \tl_set:Nn \l__starray_showcmd_tl \par
+ \__starray_show_terms:nnn {}{}{#1}
+
+ \tl_use:N \l__starray_tmpa_tl
+ }
+
+
Property changes on: trunk/Master/texmf-dist/tex/latex/starray/starray.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2023-05-12 20:27:50 UTC (rev 67082)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2023-05-12 20:29:04 UTC (rev 67083)
@@ -765,7 +765,7 @@
spot spotcolor spreadtab spverbatim
sr-vorl srbook-mem srbtiks srcltx srdp-mathematik srcredact sseq sslides
stack stackengine stage standalone stanli starfont startex
- statex statex2 statistics statistik statmath staves
+ statex statex2 statistics statistik statmath staves starray
stdclsdv stdpage stealcaps steinmetz
stellenbosch step stepgreek stex
stickstoo stix stix2-otf stix2-type1 stmaryrd storebox storecmd
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2023-05-12 20:27:50 UTC (rev 67082)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2023-05-12 20:29:04 UTC (rev 67083)
@@ -1798,6 +1798,7 @@
'simple-thesis-dissertation' => '&POST_simple_rmFonts',
'splitindex' => '&POST_do_man',
'startex' => '&POST_otherformat',
+ 'starray' => '&POST_onelevel',
'stex', => '&POSTstex',
'sympycalc' => '&POST_onelevel',
'tangramtikz' => '&POST_onelevel',
Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc 2023-05-12 20:27:50 UTC (rev 67082)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc 2023-05-12 20:29:04 UTC (rev 67083)
@@ -1243,6 +1243,7 @@
depend stack
depend stackengine
depend standalone
+depend starray
depend stdclsdv
depend stdpage
depend stealcaps
Added: trunk/Master/tlpkg/tlpsrc/starray.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list.