@@ -153,9 +153,12 @@ _zsh_highlight_main_calculate_fallback() {
153
153
#
154
154
# If $2 is 0, do not consider aliases.
155
155
#
156
+ # If $3 is 0, do not consider reserved words.
157
+ #
156
158
# The result will be stored in REPLY.
157
159
_zsh_highlight_main__type () {
158
160
integer -r aliases_allowed=${2-1}
161
+ integer -r resword_allowed=${3-1}
159
162
# We won't cache replies of anything that exists as an alias at all, to
160
163
# ensure the cached value is correct regardless of $aliases_allowed.
161
164
#
@@ -186,7 +189,7 @@ _zsh_highlight_main__type() {
186
189
REPLY=alias
187
190
elif [[ $1 == * .* && -n ${1% .* } ]] && (( $+ saliases[(e)${1##* .} ] )) ; then
188
191
REPLY=' suffix alias'
189
- elif (( $reswords [(Ie)$1 ] )) ; then
192
+ elif (( resword_allowed )) && (( $reswords [(Ie)$1 ] )) ; then
190
193
REPLY=reserved
191
194
elif (( $+ functions[(e)$1 ] )) ; then
192
195
REPLY=function
@@ -616,7 +619,7 @@ _zsh_highlight_main_highlighter_highlight_list()
616
619
if [[ $this_word == * ' :start:' * ]] && ! (( in_redirection )) ; then
617
620
# Expand aliases.
618
621
# 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
620
623
local res=" $REPLY "
621
624
if [[ $res == " alias" ]]; then
622
625
# Mark insane aliases as unknown-token (cf. #263).
@@ -648,7 +651,7 @@ _zsh_highlight_main_highlighter_highlight_list()
648
651
continue
649
652
else
650
653
_zsh_highlight_main_highlighter_expand_path $arg
651
- _zsh_highlight_main__type " $REPLY " 0
654
+ _zsh_highlight_main__type " $REPLY " 0 0
652
655
res=" $REPLY "
653
656
fi
654
657
fi
0 commit comments