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

Fix identifier matching in Rego lexer #1556

Merged
merged 2 commits into from
Jul 5, 2020

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Jun 19, 2020

The Rego lexer matches certain identifiers using \b. This will match identifiers that include _. This PR replaces these rules with a more robust generic regular expression. In addition, it changes the token used for variable names to Name.

It fixes #1547.

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Jun 19, 2020
@pyrmont pyrmont self-assigned this Jun 19, 2020
@pyrmont
Copy link
Contributor Author

pyrmont commented Jun 19, 2020

@jcmcken I think this should provide a more robust set of rules.

Oh, and as noted above, I also changed the token that's used to highlight rule names. I don't think using Str::Symbol is the best choice. I opted for the more generic Name.

What do you think?

@pyrmont pyrmont merged commit 1863a89 into rouge-ruby:master Jul 5, 2020
@pyrmont pyrmont deleted the bugfix.rego-identifier-names branch July 5, 2020 05:04
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Jul 5, 2020
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
The Rego lexer matches certain identifiers using `\b`. This will match
identifiers that include `_`. This commit replaces these rules with a
more robust generic regular expression. In addition, it changes the
token used for variable names to `Name`.
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

Successfully merging this pull request may close these issues.

Rego lexer needs some help
1 participant