kitlang / kit

Kit: a magical, high performance programming language, designed for game development.
https://www.kitlang.org
Other
1.02k stars 29 forks source link

fix highlighting multi-digit numbers #120

Closed AlexPoulsen closed 5 years ago

AlexPoulsen commented 5 years ago

it removes regex \b tags, which fixes highlighting multi-digit numbers for whatever reason

bendmorris commented 5 years ago

Can you give an example that this fixes the highlighting for? Because I'm seeing the same thing with both. It doesn't seem right to remove the \b - it would match numbers inside other tokens.

AlexPoulsen commented 5 years ago

With \b:

Screen Shot 2019-03-30 at 12 57 26 PM Screen Shot 2019-03-30 at 12 57 07 PM

Without \b:

Screen Shot 2019-03-30 at 12 58 07 PM Screen Shot 2019-03-30 at 12 55 50 PM
AlexPoulsen commented 5 years ago

it's not perfect, the hex literal isn't colored right, but it's better

bendmorris commented 5 years ago

I made a recent fix to this, and I suspect you're looking at a commit prior to that. Here's what I see (color scheme changed to emphasize the numbers):

image

The \b is still needed though, and that wouldn't affect matching multiple digit numbers, it prevents matching inside of other words. Not having them breaks hex parsing for example:

image

There are two improvements we could make, and you're welcome to make them here if you'd like to:

AlexPoulsen commented 5 years ago

so it turns out my code to install the package had a bug and so i probably had an old version in there