@@ -153,9 +153,12 @@ _zsh_highlight_main_calculate_fallback() {
153153#
154154# If $2 is 0, do not consider aliases.
155155#
156+ # If $3 is 0, do not consider reserved words.
157+ #
156158# The result will be stored in REPLY.
157159_zsh_highlight_main__type () {
158160 integer -r aliases_allowed=${2-1}
161+ integer -r resword_allowed=${3-1}
159162 # We won't cache replies of anything that exists as an alias at all, to
160163 # ensure the cached value is correct regardless of $aliases_allowed.
161164 #
@@ -186,7 +189,7 @@ _zsh_highlight_main__type() {
186189 REPLY=alias
187190 elif [[ $1 == * .* && -n ${1% .* } ]] && (( $+ saliases[(e)${1##* .} ] )) ; then
188191 REPLY=' suffix alias'
189- elif (( $reswords [(Ie)$1 ] )) ; then
192+ elif (( resword_allowed )) && (( $reswords [(Ie)$1 ] )) ; then
190193 REPLY=reserved
191194 elif (( $+ functions[(e)$1 ] )) ; then
192195 REPLY=function
@@ -616,7 +619,7 @@ _zsh_highlight_main_highlighter_highlight_list()
616619 if [[ $this_word == * ' :start:' * ]] && ! (( in_redirection )) ; then
617620 # Expand aliases.
618621 # An alias is ineligible for expansion while it's being expanded (see #652/#653).
619- _zsh_highlight_main__type " $arg " " $(( ! ${+seen_alias[$arg]} )) "
622+ _zsh_highlight_main__type " $arg " " $(( ! ${+seen_alias[$arg]} )) " 1
620623 local res=" $REPLY "
621624 if [[ $res == " alias" ]]; then
622625 # Mark insane aliases as unknown-token (cf. #263).
@@ -648,7 +651,7 @@ _zsh_highlight_main_highlighter_highlight_list()
648651 continue
649652 else
650653 _zsh_highlight_main_highlighter_expand_path $arg
651- _zsh_highlight_main__type " $REPLY " 0
654+ _zsh_highlight_main__type " $REPLY " 0 0
652655 res=" $REPLY "
653656 fi
654657 fi
0 commit comments