parent
bfd44f5c3f
commit
81267ca313
@ -732,6 +732,17 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then
|
if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then
|
||||||
# Missing closing square bracket(s)
|
# Missing closing square bracket(s)
|
||||||
style=unknown-token
|
style=unknown-token
|
||||||
|
elif $in_array_assignment; then
|
||||||
|
case $arg in
|
||||||
|
# Literal newlines are just fine.
|
||||||
|
($'\n') style=commandseparator;;
|
||||||
|
# Semicolons are parsed the same way as literal newlines. Nevertheless,
|
||||||
|
# highlight them as errors since they're probably unintended. Compare
|
||||||
|
# issue #691.
|
||||||
|
(';') style=unknown-token;;
|
||||||
|
# Other command separators aren't allowed.
|
||||||
|
(*) style=unknown-token;;
|
||||||
|
esac
|
||||||
elif [[ $this_word == *':regular:'* ]]; then
|
elif [[ $this_word == *':regular:'* ]]; then
|
||||||
# This highlights empty commands (semicolon follows nothing) as an error.
|
# This highlights empty commands (semicolon follows nothing) as an error.
|
||||||
# Zsh accepts them, though.
|
# Zsh accepts them, though.
|
||||||
@ -746,12 +757,7 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
next_word=':regular:'
|
next_word=':regular:'
|
||||||
elif [[ $arg == ';' ]] && $in_array_assignment; then
|
elif [[ $arg == ';' ]] && $in_array_assignment; then
|
||||||
# literal semicolon inside an array assignment
|
# literal semicolon inside an array assignment
|
||||||
#
|
|
||||||
# This is parsed the same way as a literal newline. Nevertheless,
|
|
||||||
# highlight it as an error since it's probably unintended. Compare
|
|
||||||
# issue #691.
|
|
||||||
next_word=':regular:'
|
next_word=':regular:'
|
||||||
style=unknown-token
|
|
||||||
else
|
else
|
||||||
next_word=':start:'
|
next_word=':start:'
|
||||||
highlight_glob=true
|
highlight_glob=true
|
||||||
|
@ -33,7 +33,7 @@ BUFFER=$'a=( foo | bar )'
|
|||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
'1 3 assign' # a=(
|
'1 3 assign' # a=(
|
||||||
'5 7 default' # foo
|
'5 7 default' # foo
|
||||||
'9 9 unknown-token "issue #651"' # |
|
'9 9 unknown-token' # |
|
||||||
'11 13 unknown-token' # bar
|
'11 13 unknown-token' # bar
|
||||||
'15 15 unknown-token' # )
|
'15 15 unknown-token' # )
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user