zsh-workers
 help / color / mirror / code / Atom feed
0b1a8dd4a7fd7e60a24b69c79b352ff3c9f9670b blob 3234 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
 
# Test parameter expansion with namespace syntax
# (heavily borrowed from D04parameter.ztst)

%prep

%test

  .k02.foo='the first parameter'
  .k02.bar='the second parameter'
  print -l $.k02.foo ${.k02.bar}
0:Basic scalars with namespace
F:Braces are required
>$.k02.foo
>the second parameter

  typeset .k02.bar='the second parameter'
  print -l ${.k02.bar}
0:Scalar but with typeset
>the second parameter

  .k02.array1=(the first array)
  .k02.array2=(the second array)
  print -l $.k02.array1 ${.k02.array2}
0:Basic arrays with namespace
>$.k02.array1
>the
>second
>array

  typeset -a .k02.array2=(the second array)
  print -l ${.k02.array2}
0:Array but with typeset
>the
>second
>array

  setopt ksharrays
  print -l ${.k02.array2}
  unsetopt ksharrays
0:Basic ksharray with namespace
>the

  setopt shwordsplit
  print -l ${.k02.foo} ${==.k02.bar}
  unsetopt shwordsplit
0:Basic shwordsplit with namespace
>the
>first
>parameter
>the second parameter

  print ${+.k02.foo} ${+.k02.notappearinginthistest}
0:$+... and namespace
>1 0

  .k02.x=()
  print ${+.k02.x} ${+.k02.x[1]} ${+.k02.x[(r)foo]} ${+.k02.x[(r)bar]}
  .k02.x=(foo)
  print ${+.k02.x} ${+.k02.x[1]} ${+.k02.x[(r)foo]} ${+.k02.x[(r)bar]}
0:$+... with arrays and namespace
>1 0 0 0
>1 1 1 0

  # See D04 for complete explanation.
  # For K02 we're just testing that flag syntax works.
  .k02.foo='<five> {six} (seven) >eight< }nine{ |forty-two| $many$ )ten( more'
  .k02.array=(${(z).k02.foo})
  print -l ${(Q).k02.array}
0:${(z)...} and ${(Q)...} for some hard to parse cases
><
>five
>>
>{six}
>(
>seven
>)
>>
>eight
><
>}nine{
>|
>forty-two
>|
>$many$
>)
>ten( more

  .k02.array=(characters in an array)
  print ${(c)#.k02.array}
0:${(c)#...}
>22

  () {
    typeset -n .k02.ref=.k02.array
    emulate -L ksh
    print -l ${!.k02.ref} ${(!).k02.ref} ${.k02.ref}
  }
0:namerefs with namespaces
>.k02.array
>.k02.array
>characters

  k.=empty
  k.2=test
  print ${k.} ${k.2}
0:Parse without leading dot (future proofing)
>empty test

  .k=OK
  print ${.k}
0:Bare namespace is usable (ksh compatibility)
>OK

  .k.=empty
1:Namespace must precede an identifier, assignment
?(eval):1: not an identifier: .k.

  typeset .k.=empty
1:Namespace must precede an identifier, typeset
?(eval):typeset:1: not valid in this context: .k.

  print ${.k.}
1:Namespace must precede an identifier, reference
?(eval):1: bad substitution

  .2.b=not
1:Namespace identifier must not begin with a digit, assignment
?(eval):1: not an identifier: .2.b

  typeset .2.b=not
1:Namespace identifier must not begin with a digit, typeset
?(eval):typeset:1: not valid in this context: .2.b

  print ${.2.b}
1:Namespace identifier must not begin with a digit, reference
?(eval):1: bad substitution

  .not.2b=question
1:Identifier starting with a digit must be all digits, assignment
?(eval):1: not an identifier: .not.2b

  typeset .not.2b=question
1:Identifier starting with a digit must be all digits, typeset
?(eval):typeset:1: not valid in this context: .not.2b

  print ${.not.2b}
1:Identifier starting with a digit must be all digits, reference
?(eval):1: bad substitution

  integer .var.d=0
  float .var.f=.2
  print $((.var.x = ++.var.d - -.var.f))
0:Namespaces in math context
>1.2
debug log:

solving 0b1a8dd4a ...
found 0b1a8dd4a in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).