Add support for the nil type and empty arrays
This commit is contained in:
parent
2b09cc2e58
commit
4db7643704
19
lib/serv.sh
19
lib/serv.sh
|
@ -42,12 +42,25 @@ parse_err() {
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_bulk() {
|
parse_bulk() {
|
||||||
bulk=1
|
if [[ $1 = \$-1 ]]; then
|
||||||
|
(( lines_left -= 1 ))
|
||||||
|
printf '(nil)\n'
|
||||||
|
else
|
||||||
|
bulk=1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_arr() {
|
parse_arr() {
|
||||||
lines_left=${1:1}
|
if [[ $1 = \*-1 ]]; then
|
||||||
arr=1
|
(( lines_left -= 1 ))
|
||||||
|
printf '(nil)\n'
|
||||||
|
elif [[ $1 = \*0 ]]; then
|
||||||
|
(( lines_left -= 1 ))
|
||||||
|
printf '(empty array)\n'
|
||||||
|
else
|
||||||
|
lines_left=${1:1}
|
||||||
|
arr=1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_other() {
|
parse_other() {
|
||||||
|
|
Loading…
Reference in New Issue