Hi! ----
The following test case... -- snip -- namespace xmlfragmentparser { typeset -T parser_t=( typeset -a data # "raw" data from .sh.match compound -a context # parsed tag data function build_context { typeset dummy typeset attrdata # data after "<tag" ... integer i for (( i=0 ; i < ${#_.data[@]} ; i++ )) ; do nameref currc=_.context[i] # current context dummy="${_.data[i]/~(El)<([:_[:alnum:]-]+)(.*)>/X}" currc.tagname="${.sh.match[1]}" attrdata="${.sh.match[2]}" if [[ "${attrdata}" != ~(Elr)[[:space:]]* ]] ; then dummy="${attrdata//~(Ex-p)(?: [[:space:]]+ ( # four different types of name=value syntax (?:([:_[:alnum:]-]+)=([^\"\'[:space:]]+?))| #x='foo=bar huz=123' (?:([:_[:alnum:]-]+)=\"([^\"]*?)\")| #x='foo="ba=r o" huz=123' (?:([:_[:alnum:]-]+)=\'([^\']*?)\')| #x="foox huz=123" (?:([:_[:alnum:]-]+)) #x="foox huz=123" ) )/D}" integer j k compound -a currc.attrs for (( j=0 ; j < ${#.sh.match[0][@]} ; j++ )) ; do if [[ -v .sh.match[2][j] && -v .sh.match[3][j] ]] ; then currc.attrs+=( name="${.sh.match[2][j]}" value="${.sh.match[3][j]}" ) fi ; if [[ -v .sh.match[4][j] && -v .sh.match[5][j] ]] ; then currc.attrs+=( name="${.sh.match[4][j]}" value="${.sh.match[5][j]}" ) fi ; if [[ -v .sh.match[6][j] && -v .sh.match[7][j] ]] ; then currc.attrs+=( name="${.sh.match[6][j]}" value="${.sh.match[7][j]}" ) fi done #print -u2 -v currc.attrs #print -u2 -v .sh.match fi done return 0 } ) } function main { .xmlfragmentparser.parser_t xd # xml document xd.data=( "<foo x='1' y='2' />" "<bar a='1' b='2' />" ) xd.build_context print -v xd.context return 0 } # main set -o nounset main #EOF. -- snip -- ... should AFAIK print this... -- snip -- ( typeset -a attrs=( [0]=( name=x value=1 ) [1]=( name=y value=2 ) ) tagname=foo ) ( typeset -a attrs=( [0]=( name=a value=1 ) [1]=( name=b value=2 ) ) tagname=bar ) -- snip -- ... but ast-ksh.2012-08-31 (ksh93v- alpha) prints this: -- snip -- ( ( ) ( ) ) -- snip -- BTW: Replacing the 'print -v xd.context' with 'print "${xd.context[*]}"' has no effect, e.g. both do not print the expected context. I've attached the testcase as "ksh93v_typeset_T_print_v_does_not_print_member_indexed_array.sh.gz", too... ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.ma...@nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;)
ksh93v_typeset_T_print_v_does_not_print_member_indexed_array.sh.gz
Description: GNU Zip compressed data
_______________________________________________ ast-developers mailing list ast-developers@research.att.com https://mailman.research.att.com/mailman/listinfo/ast-developers