1*0a6a1f1dSLionel Sambuc# $Id: modword.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ 2*0a6a1f1dSLionel Sambuc# 3*0a6a1f1dSLionel Sambuc# Test behaviour of new :[] modifier 4*0a6a1f1dSLionel Sambuc 5*0a6a1f1dSLionel Sambucall: mod-squarebrackets mod-S-W mod-C-W mod-tW-tw 6*0a6a1f1dSLionel Sambuc 7*0a6a1f1dSLionel SambucLIST= one two three 8*0a6a1f1dSLionel SambucLIST+= four five six 9*0a6a1f1dSLionel SambucLONGLIST= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 10*0a6a1f1dSLionel Sambuc 11*0a6a1f1dSLionel SambucEMPTY= # the space should be ignored 12*0a6a1f1dSLionel SambucESCAPEDSPACE=\ # escaped space before the '#' 13*0a6a1f1dSLionel SambucREALLYSPACE:=${EMPTY:C/^/ /W} 14*0a6a1f1dSLionel SambucHASH= \# 15*0a6a1f1dSLionel SambucAT= @ 16*0a6a1f1dSLionel SambucSTAR= * 17*0a6a1f1dSLionel SambucZERO= 0 18*0a6a1f1dSLionel SambucONE= 1 19*0a6a1f1dSLionel SambucMINUSONE= -1 20*0a6a1f1dSLionel Sambuc 21*0a6a1f1dSLionel Sambucmod-squarebrackets: mod-squarebrackets-0-star-at \ 22*0a6a1f1dSLionel Sambuc mod-squarebrackets-hash \ 23*0a6a1f1dSLionel Sambuc mod-squarebrackets-n \ 24*0a6a1f1dSLionel Sambuc mod-squarebrackets-start-end \ 25*0a6a1f1dSLionel Sambuc mod-squarebrackets-nested 26*0a6a1f1dSLionel Sambuc 27*0a6a1f1dSLionel Sambucmod-squarebrackets-0-star-at: 28*0a6a1f1dSLionel Sambuc @echo 'LIST:[]="${LIST:[]}" is an error' 29*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]="${LIST:[0]}"' 30*0a6a1f1dSLionel Sambuc @echo 'LIST:[0x0]="${LIST:[0x0]}"' 31*0a6a1f1dSLionel Sambuc @echo 'LIST:[000]="${LIST:[000]}"' 32*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]="${LIST:[*]}"' 33*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]="${LIST:[@]}"' 34*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:C/ /,/="${LIST:[0]:C/ /,/}"' 35*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:C/ /,/g="${LIST:[0]:C/ /,/g}"' 36*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:C/ /,/1g="${LIST:[0]:C/ /,/1g}"' 37*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:C/ /,/="${LIST:[*]:C/ /,/}"' 38*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:C/ /,/g="${LIST:[*]:C/ /,/g}"' 39*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:C/ /,/1g="${LIST:[*]:C/ /,/1g}"' 40*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:C/ /,/="${LIST:[@]:C/ /,/}"' 41*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:C/ /,/g="${LIST:[@]:C/ /,/g}"' 42*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:C/ /,/1g="${LIST:[@]:C/ /,/1g}"' 43*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:[0]:C/ /,/="${LIST:[@]:[0]:C/ /,/}"' 44*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:[@]:C/ /,/="${LIST:[0]:[@]:C/ /,/}"' 45*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:[*]:C/ /,/="${LIST:[@]:[*]:C/ /,/}"' 46*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:[@]:C/ /,/="${LIST:[*]:[@]:C/ /,/}"' 47*0a6a1f1dSLionel Sambuc 48*0a6a1f1dSLionel Sambucmod-squarebrackets-hash: 49*0a6a1f1dSLionel Sambuc @echo 'EMPTY="${EMPTY}"' 50*0a6a1f1dSLionel Sambuc @echo 'EMPTY:[#]="${EMPTY:[#]}" == 1 ?' 51*0a6a1f1dSLionel Sambuc @echo 'ESCAPEDSPACE="${ESCAPEDSPACE}"' 52*0a6a1f1dSLionel Sambuc @echo 'ESCAPEDSPACE:[#]="${ESCAPEDSPACE:[#]}" == 1 ?' 53*0a6a1f1dSLionel Sambuc @echo 'REALLYSPACE="${REALLYSPACE}"' 54*0a6a1f1dSLionel Sambuc @echo 'REALLYSPACE:[#]="${REALLYSPACE:[#]}" == 1 ?' 55*0a6a1f1dSLionel Sambuc @echo 'LIST:[#]="${LIST:[#]}"' 56*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:[#]="${LIST:[0]:[#]}" == 1 ?' 57*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:[#]="${LIST:[*]:[#]}" == 1 ?' 58*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:[#]="${LIST:[@]:[#]}"' 59*0a6a1f1dSLionel Sambuc @echo 'LIST:[1]:[#]="${LIST:[1]:[#]}"' 60*0a6a1f1dSLionel Sambuc @echo 'LIST:[1..3]:[#]="${LIST:[1..3]:[#]}"' 61*0a6a1f1dSLionel Sambuc 62*0a6a1f1dSLionel Sambucmod-squarebrackets-n: 63*0a6a1f1dSLionel Sambuc @echo 'EMPTY:[1]="${EMPTY:[1]}"' 64*0a6a1f1dSLionel Sambuc @echo 'ESCAPEDSPACE="${ESCAPEDSPACE}"' 65*0a6a1f1dSLionel Sambuc @echo 'ESCAPEDSPACE:[1]="${ESCAPEDSPACE:[1]}"' 66*0a6a1f1dSLionel Sambuc @echo 'REALLYSPACE="${REALLYSPACE}"' 67*0a6a1f1dSLionel Sambuc @echo 'REALLYSPACE:[1]="${REALLYSPACE:[1]}" == "" ?' 68*0a6a1f1dSLionel Sambuc @echo 'REALLYSPACE:[*]:[1]="${REALLYSPACE:[*]:[1]}" == " " ?' 69*0a6a1f1dSLionel Sambuc @echo 'LIST:[1]="${LIST:[1]}"' 70*0a6a1f1dSLionel Sambuc @echo 'LIST:[1.]="${LIST:[1.]}" is an error' 71*0a6a1f1dSLionel Sambuc @echo 'LIST:[1].="${LIST:[1].}" is an error' 72*0a6a1f1dSLionel Sambuc @echo 'LIST:[2]="${LIST:[2]}"' 73*0a6a1f1dSLionel Sambuc @echo 'LIST:[6]="${LIST:[6]}"' 74*0a6a1f1dSLionel Sambuc @echo 'LIST:[7]="${LIST:[7]}"' 75*0a6a1f1dSLionel Sambuc @echo 'LIST:[999]="${LIST:[999]}"' 76*0a6a1f1dSLionel Sambuc @echo 'LIST:[-]="${LIST:[-]}" is an error' 77*0a6a1f1dSLionel Sambuc @echo 'LIST:[--]="${LIST:[--]}" is an error' 78*0a6a1f1dSLionel Sambuc @echo 'LIST:[-1]="${LIST:[-1]}"' 79*0a6a1f1dSLionel Sambuc @echo 'LIST:[-2]="${LIST:[-2]}"' 80*0a6a1f1dSLionel Sambuc @echo 'LIST:[-6]="${LIST:[-6]}"' 81*0a6a1f1dSLionel Sambuc @echo 'LIST:[-7]="${LIST:[-7]}"' 82*0a6a1f1dSLionel Sambuc @echo 'LIST:[-999]="${LIST:[-999]}"' 83*0a6a1f1dSLionel Sambuc @echo 'LONGLIST:[17]="${LONGLIST:[17]}"' 84*0a6a1f1dSLionel Sambuc @echo 'LONGLIST:[0x11]="${LONGLIST:[0x11]}"' 85*0a6a1f1dSLionel Sambuc @echo 'LONGLIST:[021]="${LONGLIST:[021]}"' 86*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:[1]="${LIST:[0]:[1]}"' 87*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:[1]="${LIST:[*]:[1]}"' 88*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:[1]="${LIST:[@]:[1]}"' 89*0a6a1f1dSLionel Sambuc @echo 'LIST:[0]:[2]="${LIST:[0]:[2]}"' 90*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:[2]="${LIST:[*]:[2]}"' 91*0a6a1f1dSLionel Sambuc @echo 'LIST:[@]:[2]="${LIST:[@]:[2]}"' 92*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:C/ /,/:[2]="${LIST:[*]:C/ /,/:[2]}"' 93*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:C/ /,/:[*]:[2]="${LIST:[*]:C/ /,/:[*]:[2]}"' 94*0a6a1f1dSLionel Sambuc @echo 'LIST:[*]:C/ /,/:[@]:[2]="${LIST:[*]:C/ /,/:[@]:[2]}"' 95*0a6a1f1dSLionel Sambuc 96*0a6a1f1dSLionel Sambucmod-squarebrackets-start-end: 97*0a6a1f1dSLionel Sambuc @echo 'LIST:[1.]="${LIST:[1.]}" is an error' 98*0a6a1f1dSLionel Sambuc @echo 'LIST:[1..]="${LIST:[1..]}" is an error' 99*0a6a1f1dSLionel Sambuc @echo 'LIST:[1..1]="${LIST:[1..1]}"' 100*0a6a1f1dSLionel Sambuc @echo 'LIST:[1..1.]="${LIST:[1..1.]}" is an error' 101*0a6a1f1dSLionel Sambuc @echo 'LIST:[1..2]="${LIST:[1..2]}"' 102*0a6a1f1dSLionel Sambuc @echo 'LIST:[2..1]="${LIST:[2..1]}"' 103*0a6a1f1dSLionel Sambuc @echo 'LIST:[3..-2]="${LIST:[3..-2]}"' 104*0a6a1f1dSLionel Sambuc @echo 'LIST:[-4..4]="${LIST:[-4..4]}"' 105*0a6a1f1dSLionel Sambuc @echo 'LIST:[0..1]="${LIST:[0..1]}" is an error' 106*0a6a1f1dSLionel Sambuc @echo 'LIST:[-1..0]="${LIST:[-1..0]}" is an error' 107*0a6a1f1dSLionel Sambuc @echo 'LIST:[-1..1]="${LIST:[-1..1]}"' 108*0a6a1f1dSLionel Sambuc @echo 'LIST:[0..0]="${LIST:[0..0]}"' 109*0a6a1f1dSLionel Sambuc @echo 'LIST:[3..99]="${LIST:[3..99]}"' 110*0a6a1f1dSLionel Sambuc @echo 'LIST:[-3..-99]="${LIST:[-3..-99]}"' 111*0a6a1f1dSLionel Sambuc @echo 'LIST:[-99..-3]="${LIST:[-99..-3]}"' 112*0a6a1f1dSLionel Sambuc 113*0a6a1f1dSLionel Sambucmod-squarebrackets-nested: 114*0a6a1f1dSLionel Sambuc @echo 'HASH="${HASH}" == "#" ?' 115*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${HASH}]="${LIST:[${HASH}]}"' 116*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${ZERO}]="${LIST:[${ZERO}]}"' 117*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${ZERO}x$${ONE}]="${LIST:[${ZERO}x${ONE}]}"' 118*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${ONE}]="${LIST:[${ONE}]}"' 119*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${MINUSONE}]="${LIST:[${MINUSONE}]}"' 120*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${STAR}]="${LIST:[${STAR}]}"' 121*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${AT}]="${LIST:[${AT}]}"' 122*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${EMPTY}]="${LIST:[${EMPTY}]}" is an error' 123*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${LONGLIST:[21]:S/2//}]="${LIST:[${LONGLIST:[21]:S/2//}]}"' 124*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${LIST:[#]}]="${LIST:[${LIST:[#]}]}"' 125*0a6a1f1dSLionel Sambuc @echo 'LIST:[$${LIST:[$${HASH}]}]="${LIST:[${LIST:[${HASH}]}]}"' 126*0a6a1f1dSLionel Sambuc 127*0a6a1f1dSLionel Sambucmod-C-W: 128*0a6a1f1dSLionel Sambuc @echo 'LIST:C/ /,/="${LIST:C/ /,/}"' 129*0a6a1f1dSLionel Sambuc @echo 'LIST:C/ /,/W="${LIST:C/ /,/W}"' 130*0a6a1f1dSLionel Sambuc @echo 'LIST:C/ /,/gW="${LIST:C/ /,/gW}"' 131*0a6a1f1dSLionel Sambuc @echo 'EMPTY:C/^/,/="${EMPTY:C/^/,/}"' 132*0a6a1f1dSLionel Sambuc @echo 'EMPTY:C/^/,/W="${EMPTY:C/^/,/W}"' 133*0a6a1f1dSLionel Sambuc 134*0a6a1f1dSLionel Sambucmod-S-W: 135*0a6a1f1dSLionel Sambuc @echo 'LIST:S/ /,/="${LIST:S/ /,/}"' 136*0a6a1f1dSLionel Sambuc @echo 'LIST:S/ /,/W="${LIST:S/ /,/W}"' 137*0a6a1f1dSLionel Sambuc @echo 'LIST:S/ /,/gW="${LIST:S/ /,/gW}"' 138*0a6a1f1dSLionel Sambuc @echo 'EMPTY:S/^/,/="${EMPTY:S/^/,/}"' 139*0a6a1f1dSLionel Sambuc @echo 'EMPTY:S/^/,/W="${EMPTY:S/^/,/W}"' 140*0a6a1f1dSLionel Sambuc 141*0a6a1f1dSLionel Sambucmod-tW-tw: 142*0a6a1f1dSLionel Sambuc @echo 'LIST:tW="${LIST:tW}"' 143*0a6a1f1dSLionel Sambuc @echo 'LIST:tw="${LIST:tw}"' 144*0a6a1f1dSLionel Sambuc @echo 'LIST:tW:C/ /,/="${LIST:tW:C/ /,/}"' 145*0a6a1f1dSLionel Sambuc @echo 'LIST:tW:C/ /,/g="${LIST:tW:C/ /,/g}"' 146*0a6a1f1dSLionel Sambuc @echo 'LIST:tW:C/ /,/1g="${LIST:tW:C/ /,/1g}"' 147*0a6a1f1dSLionel Sambuc @echo 'LIST:tw:C/ /,/="${LIST:tw:C/ /,/}"' 148*0a6a1f1dSLionel Sambuc @echo 'LIST:tw:C/ /,/g="${LIST:tw:C/ /,/g}"' 149*0a6a1f1dSLionel Sambuc @echo 'LIST:tw:C/ /,/1g="${LIST:tw:C/ /,/1g}"' 150*0a6a1f1dSLionel Sambuc @echo 'LIST:tw:tW:C/ /,/="${LIST:tw:tW:C/ /,/}"' 151*0a6a1f1dSLionel Sambuc @echo 'LIST:tW:tw:C/ /,/="${LIST:tW:tw:C/ /,/}"' 152