aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-01-11 14:55:25 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-01-11 14:55:25 +0300
commitdfc5382c0d3630744aa68deedd916394cae273c8 (patch)
tree9b8e85ce28f9434f6bdf91fcc5da719e0e84878f
parentb8c9e836610cc7874d5c27d2a2276f9735220a36 (diff)
handle `for x (y) z`
-rw-r--r--internal/parse.zsh17
1 files changed, 10 insertions, 7 deletions
diff --git a/internal/parse.zsh b/internal/parse.zsh
index 472f5588..8eb1aee4 100644
--- a/internal/parse.zsh
+++ b/internal/parse.zsh
@@ -86,9 +86,16 @@ typeset -gA _p9k_term=(
'()' ''
)
+typeset -gA _p9k_skip_arg=(
+ ';;' '\)|esac'
+ ';&' '\)|esac'
+ ';|' '\)|esac'
+ '(' '\)'
+ '()' ''
+)
+
# False positives:
#
-# for x (y) z
# {} always {}
#
# Completely broken:
@@ -158,12 +165,8 @@ function _p9k_extract_commands() {
if [[ -n $skip ]]; then
if [[ $skip == '^' ]]; then
if (( $+_p9k_term[$token] )); then
- if [[ $token == '()' ]]; then
- skip=
- else
- _p9k_commands+=($commands)
- [[ $token == ';'[';&|'] ]] && skip='\)|esac' || skip=
- fi
+ skip=$_p9k_skip_arg[$token]
+ [[ $token == '()' ]] || _p9k_commands+=($commands)
commands=()
fi
elif [[ $token == $~skip ]]; then