main: Recognize more redirection and array assignment parse errors
() ) } are invalid as a redirection target. () } are invalid in an array assignment.
This commit is contained in:
		
							parent
							
								
									2f03b6d704
								
							
						
					
					
						commit
						dea05e44e6
					
				|  | @ -795,6 +795,8 @@ _zsh_highlight_main_highlighter_highlight_list() | ||||||
|                    style=assign |                    style=assign | ||||||
|                    in_array_assignment=false |                    in_array_assignment=false | ||||||
|                    next_word+=':start:' |                    next_word+=':start:' | ||||||
|  |                  elif (( in_redirection )); then | ||||||
|  |                    style=unknown-token | ||||||
|                  else |                  else | ||||||
|                    if _zsh_highlight_main__stack_pop 'S'; then |                    if _zsh_highlight_main__stack_pop 'S'; then | ||||||
|                      REPLY=$start_pos |                      REPLY=$start_pos | ||||||
|  | @ -804,11 +806,15 @@ _zsh_highlight_main_highlighter_highlight_list() | ||||||
|                    _zsh_highlight_main__stack_pop 'R' reserved-word |                    _zsh_highlight_main__stack_pop 'R' reserved-word | ||||||
|                  fi;; |                  fi;; | ||||||
|         $'\x28\x29') # possibly a function definition |         $'\x28\x29') # possibly a function definition | ||||||
|  |                  if (( in_redirection )) || $in_array_assignment; then | ||||||
|  |                    style=unknown-token | ||||||
|  |                  else | ||||||
|                    if [[ $zsyh_user_options[multifuncdef] == on ]] || false # TODO: or if the previous word was a command word |                    if [[ $zsyh_user_options[multifuncdef] == on ]] || false # TODO: or if the previous word was a command word | ||||||
|                    then |                    then | ||||||
|                      next_word+=':start:' |                      next_word+=':start:' | ||||||
|                    fi |                    fi | ||||||
|                    style=reserved-word |                    style=reserved-word | ||||||
|  |                  fi | ||||||
|                  ;; |                  ;; | ||||||
|         *)       if false; then |         *)       if false; then | ||||||
|                  elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then |                  elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then | ||||||
|  | @ -816,10 +822,14 @@ _zsh_highlight_main_highlighter_highlight_list() | ||||||
|                    # |                    # | ||||||
|                    #     Additionally, `tt(})' is recognized in any position if neither the |                    #     Additionally, `tt(})' is recognized in any position if neither the | ||||||
|                    #     tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set. |                    #     tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set. | ||||||
|  |                    if (( in_redirection )) || $in_array_assignment; then | ||||||
|  |                      style=unknown-token | ||||||
|  |                    else | ||||||
|                      _zsh_highlight_main__stack_pop 'Y' reserved-word |                      _zsh_highlight_main__stack_pop 'Y' reserved-word | ||||||
|                      if [[ $style == reserved-word ]]; then |                      if [[ $style == reserved-word ]]; then | ||||||
|                        next_word+=':always:' |                        next_word+=':always:' | ||||||
|                      fi |                      fi | ||||||
|  |                    fi | ||||||
|                  elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then |                  elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then | ||||||
|                    style=history-expansion |                    style=history-expansion | ||||||
|                  elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then |                  elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue