Description
This is a mirror issue of the sublimehq/Packages#2635.
Summary
Arithmetic Evaluation context is not subject to comments.
Description
Syntax highlighting engine treats #
symbol inside an Arithmetic Evaluation context as the beginning of a comment. Which is incorrect, because #
in that context could be one of several operators but not a comment.
According to zsh documentation at http://zsh.sourceforge.net/Doc/Release/Arithmetic-Evaluation.html#Arithmetic-Evaluation:
An expression of the form ‘##x’ where x is any character sequence such as ‘a’, ‘^A’, or ‘\M-\C-x’ gives the value of this character and an expression of the form ‘#name’ gives the value of the first character of the contents of the parameter name.
Steps to reproduce
Neither of the expressions below contain a single comment, regardless of the interactive_comments
zsh option.
: $(( # word ))
: $(( #word ))
Expected result
The #
operator should be highlighted as an operator, and word
is its argument. Although, $(( # word ))
is not valid expression either: there should be no space after #
, so zsh would just bail out with an error:
: $(( # word ))
zsh: bad math expression: operator expected at `word '`
Observed result
The #
symbol and everything after it gets highlighted as a comment.
Additional information
- OS: Arch Linux
- zsh-syntax-highlighting: 0.7.1-1
- zsh: 5.8-1