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

module' ("module" then a "prime" symbol) is incorrectly highlight as a keyword #31

Closed
exists-forall opened this issue Jun 26, 2017 · 2 comments

Comments

@exists-forall
Copy link

The identifier module' triggers the syntax highlighting associated with the normal module keyword, even though the inclusion of the prime/single-quote symbol should turn it into an ordinary, non-reserved identifier. Importantly, all text after the identifier module' is highlighted as though it were part of a module declaration, which can seriously break syntax highlighting on large parts of valid source files.

Here's an example of the incorrect syntax highlighting for the identifier module':

screenshot from 2017-06-26 15-54-41

And an example of correct syntax highlighting for the identifier module_:

screenshot from 2017-06-26 15-56-28

@exists-forall exists-forall changed the title module' is not recognized as a non-reserved identifier module' ("module-prime") is incorrectly highlight as a keyword Jun 26, 2017
@exists-forall exists-forall changed the title module' ("module-prime") is incorrectly highlight as a keyword module' ("module" then a "prime" symbol) is incorrectly highlight as a keyword Jun 26, 2017
@JustusAdam
Copy link
Owner

The problem is this line \b(module)\b where it requires a word end after module. The problem is that the regex implementation does not recognise the ' as a word character.
I assume the same (or a similar one would be present if you tried using import' as an identifier or let').
I assume something like (\b(?!')) might fix it.

@JustusAdam
Copy link
Owner

That regex fixed it. I also applied the same technique to all other keywords like let', import' etc.
I'd appreciate if you can check that it I got them all.

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

2 participants