Skip to content

Arithmetic Evaluation context has no comments #784

Open
@ratijas

Description

@ratijas

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.

Screenshot_20201124_025951

Additional information

  • OS: Arch Linux
  • zsh-syntax-highlighting: 0.7.1-1
  • zsh: 5.8-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions