File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -732,6 +732,17 @@ _zsh_highlight_main_highlighter_highlight_list()
732
732
if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then
733
733
# Missing closing square bracket(s)
734
734
style=unknown-token
735
+ elif $in_array_assignment ; then
736
+ case $arg in
737
+ # Literal newlines are just fine.
738
+ ($' \n ' ) style=commandseparator;;
739
+ # Semicolons are parsed the same way as literal newlines. Nevertheless,
740
+ # highlight them as errors since they're probably unintended. Compare
741
+ # issue #691.
742
+ (' ;' ) style=unknown-token;;
743
+ # Other command separators aren't allowed.
744
+ (* ) style=unknown-token;;
745
+ esac
735
746
elif [[ $this_word == * ' :regular:' * ]]; then
736
747
# This highlights empty commands (semicolon follows nothing) as an error.
737
748
# Zsh accepts them, though.
@@ -746,12 +757,7 @@ _zsh_highlight_main_highlighter_highlight_list()
746
757
next_word=' :regular:'
747
758
elif [[ $arg == ' ;' ]] && $in_array_assignment ; then
748
759
# literal semicolon inside an array assignment
749
- #
750
- # This is parsed the same way as a literal newline. Nevertheless,
751
- # highlight it as an error since it's probably unintended. Compare
752
- # issue #691.
753
760
next_word=' :regular:'
754
- style=unknown-token
755
761
else
756
762
next_word=' :start:'
757
763
highlight_glob=true
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ BUFFER=$'a=( foo | bar )'
33
33
expected_region_highlight=(
34
34
' 1 3 assign' # a=(
35
35
' 5 7 default' # foo
36
- ' 9 9 unknown-token "issue #651" ' # |
36
+ ' 9 9 unknown-token' # |
37
37
' 11 13 unknown-token' # bar
38
38
' 15 15 unknown-token' # )
39
39
)
You can’t perform that action at this time.
0 commit comments