#compdef -brace-parameter-

setopt localoptions extendedglob

local lp ls n q suf=''

if [[ "$SUFFIX" = *\}* ]]; then
  ISUFFIX="${SUFFIX#*\}}$ISUFFIX"
  SUFFIX="${SUFFIX%%\}*}"
else
  suf='} '
fi

lp="$LBUFFER[1,-${#PREFIX}-1]"
ls="$RBUFFER[${#SUFFIX}+1,-1]"
n=${(M)#ls##\"#}
q=${(M)lp%%\"#}

[[ n -gt 0 ]] && suf=''

_parameters -Qs "${q[1,-n-1]}" -S "$suf" -r '-:?#%+=[/'
