Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting breaks when bitwise or operator is used #2

Open
bjorn-ove opened this issue Dec 10, 2022 · 2 comments
Open

Highlighting breaks when bitwise or operator is used #2

bjorn-ove opened this issue Dec 10, 2022 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@bjorn-ove
Copy link

Thanks for this, I'm using rhai as my Advent og Code challenge when I noticed this issue.

I think it is because of the closure handling. Maybe the order is wrong?

To reproduce just add code with a logical or anywhere and the code until the next logical or is not highlighted.

@schungx schungx added the bug Something isn't working label Dec 10, 2022
@schungx
Copy link
Contributor

schungx commented Dec 10, 2022

Thanks for catching this.

This seems to be due to a conflict between the bitwise or operator | and a closure |x, y| ...

This may not be easy to solve... say... foo | bar | baz may be interpreted as: foo, |bar| baz (closure) or foo | bar | baz (operators). Same with || it seems, which is recognized as a closure with no arguments instead of the logical OR operator.

Right now, it favors closures over bitwise OR because bitwise operators are rare. However, you can claim that it is better to favor the logical OR for || over a closure...

I'm not sure if this can be easily resolved without adding complexity to the syntax highlighting...

@schungx schungx added the help wanted Extra attention is needed label Dec 12, 2022
@schungx
Copy link
Contributor

schungx commented Dec 12, 2022

Calling for someone with the skills to fix this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants