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

Negative numbers #7

Open
Y-Less opened this issue Oct 15, 2017 · 0 comments
Open

Negative numbers #7

Y-Less opened this issue Oct 15, 2017 · 0 comments

Comments

@Y-Less
Copy link
Contributor

Y-Less commented Oct 15, 2017

In my pulll request ( #6 ), I added syntax highlighting for the - in negative numbers. These highlight correctly:

a = -5;
a = 10 - 5;
a = 10 - -5;
a = 10--5;
a = 10-5;

These don't:

a = 10 -5;
a = (10)-5;

The lookbehind doesn't go far enough backwards to determine that - is not subtract in all cases. I think the total list of preceding symbols for which this becomes negate is = + - * / % & | ~ ! : ? ^ # > < ( , ;. Note the only place I can see an expression legally following ; and starting with a negative number is in a for loop yoda conditional: for (new i = 0; -5 > i; --i) {}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant