mirror of
https://github.com/zsh-users/zsh-syntax-highlighting
synced 2024-12-11 22:15:23 +00:00
main: Recognize repeat with the other reserved words
This commit is contained in:
parent
3ddb974a3d
commit
df431eeee8
@ -701,6 +701,17 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
('end')
|
('end')
|
||||||
_zsh_highlight_main__stack_pop '$' reserved-word
|
_zsh_highlight_main__stack_pop '$' reserved-word
|
||||||
;;
|
;;
|
||||||
|
('repeat')
|
||||||
|
# skip the repeat-count word
|
||||||
|
in_redirection=2
|
||||||
|
# The redirection mechanism assumes $this_word describes the word
|
||||||
|
# following the redirection. Make it so.
|
||||||
|
#
|
||||||
|
# That word can be a command word with shortloops (`repeat 2 ls`)
|
||||||
|
# or a command separator (`repeat 2; ls` or `repeat 2; do ls; done`).
|
||||||
|
#
|
||||||
|
# The repeat-count word will be handled like a redirection target.
|
||||||
|
this_word=':start::regular:'
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
'suffix alias') style=suffix-alias;;
|
'suffix alias') style=suffix-alias;;
|
||||||
@ -853,17 +864,6 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
elif
|
elif
|
||||||
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:#"$arg"} && $this_word == *':start:'* ]]; then
|
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:#"$arg"} && $this_word == *':start:'* ]]; then
|
||||||
next_word=':start:'
|
next_word=':start:'
|
||||||
elif [[ $arg == "repeat" && $this_word == *':start:'* ]]; then
|
|
||||||
# skip the repeat-count word
|
|
||||||
in_redirection=2
|
|
||||||
# The redirection mechanism assumes $this_word describes the word
|
|
||||||
# following the redirection. Make it so.
|
|
||||||
#
|
|
||||||
# That word can be a command word with shortloops (`repeat 2 ls`)
|
|
||||||
# or a command separator (`repeat 2; ls` or `repeat 2; do ls; done`).
|
|
||||||
#
|
|
||||||
# The repeat-count word will be handled like a redirection target.
|
|
||||||
this_word=':start::regular:'
|
|
||||||
fi
|
fi
|
||||||
start_pos=$end_pos
|
start_pos=$end_pos
|
||||||
if (( in_redirection == 0 )); then
|
if (( in_redirection == 0 )); then
|
||||||
|
Loading…
Reference in New Issue
Block a user