Open Nixinova opened 3 years ago
The issue is the [^
...#
...]
and [^#]*?
bits here (and in similar constructs):
It's been quite a while since I touched these regexes but looking at the line you linked, we're not being strict enough about hitting a comment. We break as soon as a # is found, even though the spec says "Comments must be separated from other tokens by white space characters". Maybe something like this would work:
([^!{@#%&*>,\'"](?:[^#]|(?<!\\s#)*?)
Maybe. I forget if the lookbehind would behave as expected there.
I've messed around with a regex for this and like the many other times I've tried to figure out how to negate multiple characters, but can't figure out how to do it.
It would probably be more easier and accurate to have a comment token overwrite all the other tokens.
So I realized that negating multiple characters is very hard, but explicitly capturing the "space with everything except a # after it" is easier.
([^!{@#%&*>,\'"](?>\s[^#]|\S)*\s*)
Is that better? If not then yeah we might have to settle for what you proposed.
That seems like it could work
@Nixinova would you mind creating a PR? If not I can go and setup my environment again and do it :).
Removing most of the checklist as I'm not using atom, I'm using the grammar file directly.
Description
The syntax grammar does not correctly tokenise properties with hashes inside them:
This syntax is valid and should be shown as such.