main: Consolidate TOKENS_COMMANDSEPARATOR handling
No functional change.
This commit is contained in:
parent
5bb5703b0d
commit
c6e3d216ec
@ -631,7 +631,21 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# The Great Fork: is this a command word? Is this a non-command word?
|
# The Great Fork: is this a command word? Is this a non-command word?
|
||||||
if false; then
|
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
|
||||||
|
if [[ $this_word == *':regular:'* ]]; then
|
||||||
|
# This highlights empty commands (semicolon follows nothing) as an error.
|
||||||
|
# Zsh accepts them, though.
|
||||||
|
style=commandseparator
|
||||||
|
else
|
||||||
|
style=unknown-token
|
||||||
|
fi
|
||||||
|
if [[ $arg == ';' ]] && $in_array_assignment; then
|
||||||
|
# literal newline inside an array assignment
|
||||||
|
next_word=':regular:'
|
||||||
|
else
|
||||||
|
next_word=':start:'
|
||||||
|
highlight_glob=true
|
||||||
|
fi
|
||||||
elif ! (( in_redirection)) && [[ $this_word == *':always:'* && $arg == 'always' ]]; then
|
elif ! (( in_redirection)) && [[ $this_word == *':always:'* && $arg == 'always' ]]; then
|
||||||
# try-always construct
|
# try-always construct
|
||||||
style=reserved-word # de facto a reserved word, although not de jure
|
style=reserved-word # de facto a reserved word, although not de jure
|
||||||
@ -737,14 +751,6 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
style=history-expansion
|
style=history-expansion
|
||||||
elif [[ $arg[0,1] == $histchars[2,2] ]]; then
|
elif [[ $arg[0,1] == $histchars[2,2] ]]; then
|
||||||
style=history-expansion
|
style=history-expansion
|
||||||
elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
|
|
||||||
if [[ $this_word == *':regular:'* ]]; then
|
|
||||||
# This highlights empty commands (semicolon follows nothing) as an error.
|
|
||||||
# Zsh accepts them, though.
|
|
||||||
style=commandseparator
|
|
||||||
else
|
|
||||||
style=unknown-token
|
|
||||||
fi
|
|
||||||
elif [[ $arg[1,2] == '((' ]]; then
|
elif [[ $arg[1,2] == '((' ]]; then
|
||||||
# Arithmetic evaluation.
|
# Arithmetic evaluation.
|
||||||
#
|
#
|
||||||
@ -835,12 +841,6 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
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
|
|
||||||
if [[ $this_word == *':regular:'* ]]; then
|
|
||||||
style=commandseparator
|
|
||||||
else
|
|
||||||
style=unknown-token
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
_zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 - in_redirection ))
|
_zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 - in_redirection ))
|
||||||
continue
|
continue
|
||||||
@ -849,15 +849,6 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
|
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
|
||||||
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
|
|
||||||
if [[ $arg == ';' ]] && $in_array_assignment; then
|
|
||||||
# literal newline inside an array assignment
|
|
||||||
next_word=':regular:'
|
|
||||||
else
|
|
||||||
next_word=':start:'
|
|
||||||
highlight_glob=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
REPLY=$(( end_pos - 1 ))
|
REPLY=$(( end_pos - 1 ))
|
||||||
reply=($list_highlights)
|
reply=($list_highlights)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user