runtime(sh): Update syntax, match KornShell compound arrays
closes: #17268 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
55f9e2bef9
commit
87947a9a76
20
runtime/syntax/testdir/dumps/sh_ksh_array_00.dump
Normal file
20
runtime/syntax/testdir/dumps/sh_ksh_array_00.dump
Normal file
@ -0,0 +1,20 @@
|
||||
>#+0#0000e05#ffffff0|!|/|b|i|n|/|k|s|h| +0#0000000&@64
|
||||
@75
|
||||
|f+0#00e0e07&|o@1|=+0#0000000&|(+0#e000e06&| +0#0000000&@69
|
||||
@2|(+0#e000e06&| |0+0#e000002&@1| +0#e000e06&|0+0#e000002&|1| +0#e000e06&|)| +0#0000000&@63
|
||||
@2|(+0#e000e06&| |1+0#e000002&|0| +0#e000e06&|1+0#e000002&@1| +0#e000e06&|)| +0#0000000&@63
|
||||
|)+0#e000e06&| +0#0000000&@73
|
||||
@75
|
||||
|b+0#00e0e07&|a|r|=+0#0000000&|(+0#e000e06&| +0#0000000&@69
|
||||
@2|[+0#e000e06&|0+0#e000002&|]+0#e000e06&|=+0#0000000&|(+0#e000e06&| +0#0000000&@67
|
||||
@4|[+0#e000e06&|0+0#e000002&|]+0#e000e06&|=+0#0000000&|0+0#e000002&@1| +0#0000000&@64
|
||||
@4|[+0#e000e06&|1+0#e000002&|]+0#e000e06&|=+0#0000000&|0+0#e000002&|1| +0#0000000&@64
|
||||
@2|)+0#e000e06&| +0#0000000&@71
|
||||
@2|[+0#e000e06&|1+0#e000002&|]+0#e000e06&|=+0#0000000&|(+0#e000e06&| +0#0000000&@67
|
||||
@4|[+0#e000e06&|0+0#e000002&|]+0#e000e06&|=+0#0000000&|1+0#e000002&|0| +0#0000000&@64
|
||||
@4|[+0#e000e06&|1+0#e000002&|]+0#e000e06&|=+0#0000000&|1+0#e000002&@1| +0#0000000&@64
|
||||
@2|)+0#e000e06&| +0#0000000&@71
|
||||
|)+0#e000e06&| +0#0000000&@73
|
||||
@75
|
||||
@75
|
||||
|i|s|_|k|o|r|n|s|h|e|l@1|:| |1|,| @40|1|,|1| @10|T|o|p|
|
||||
20
runtime/syntax/testdir/dumps/sh_ksh_array_01.dump
Normal file
20
runtime/syntax/testdir/dumps/sh_ksh_array_01.dump
Normal file
@ -0,0 +1,20 @@
|
||||
| +0&#ffffff0@3|[+0#e000e06&|0+0#e000002&|]+0#e000e06&|=+0#0000000&|1+0#e000002&|0| +0#0000000&@64
|
||||
@4|[+0#e000e06&|1+0#e000002&|]+0#e000e06&|=+0#0000000&|1+0#e000002&@1| +0#0000000&@64
|
||||
@2|)+0#e000e06&| +0#0000000&@71
|
||||
|)+0#e000e06&| +0#0000000&@73
|
||||
@75
|
||||
> @74
|
||||
|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|{|f|o@1|[|1+0#e000002&|]+0#e000e06&|[|1+0#e000002&|]+0#e000e06&|}| +0#e000002&|#+0#0000e05&| |=|>| |1@1| +0#0000000&@49
|
||||
|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|{|b|a|r|[|1+0#e000002&|]+0#e000e06&|[|1+0#e000002&|]+0#e000e06&|}| +0#e000002&|#+0#0000e05&| |=|>| |1@1| +0#0000000&@49
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|1|9|,|0|-|1| @7|B|o|t|
|
||||
21
runtime/syntax/testdir/input/sh_ksh_array.sh
Executable file
21
runtime/syntax/testdir/input/sh_ksh_array.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/ksh
|
||||
|
||||
foo=(
|
||||
( 00 01 )
|
||||
( 10 11 )
|
||||
)
|
||||
|
||||
bar=(
|
||||
[0]=(
|
||||
[0]=00
|
||||
[1]=01
|
||||
)
|
||||
[1]=(
|
||||
[0]=10
|
||||
[1]=11
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
echo ${foo[1][1]} # => 11
|
||||
echo ${bar[1][1]} # => 11
|
||||
Reference in New Issue
Block a user