Add support for the nil type and empty arrays

This commit is contained in:
Nicholas Chambers 2020-05-02 16:11:46 -05:00
parent 2b09cc2e58
commit 4db7643704
1 changed files with 16 additions and 3 deletions

View File

@ -42,12 +42,25 @@ parse_err() {
}
parse_bulk() {
bulk=1
if [[ $1 = \$-1 ]]; then
(( lines_left -= 1 ))
printf '(nil)\n'
else
bulk=1
fi
}
parse_arr() {
lines_left=${1:1}
arr=1
if [[ $1 = \*-1 ]]; then
(( 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() {