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

Ensure word break exists after keywords in Kotlin lexer #1621

Merged
merged 1 commit into from Nov 9, 2020

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Nov 9, 2020

Rouge currently will match identifiers that begin with certain keywords (such as super). This is because of a change in #1496 that added a rule to support labels. That change should have ensured that the rule ended with a \b to ensure that identifiers that begin with the listed keywords are followed by a word break. This PR fixes that mistake.

It fixes #1608.

@pyrmont
Copy link
Contributor Author

pyrmont commented Nov 9, 2020

@s1monw1 Thanks for reporting this. The problem seemed to have been introduced by a rule that added support for labels being used with certain keywords (including super). That rule should have ended in a \b. I've added your example to the visual sample and it looks good to me now.

@pyrmont pyrmont self-assigned this Nov 9, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Nov 9, 2020
@jneen
Copy link
Member

jneen commented Nov 9, 2020

+1 from me.

@pyrmont pyrmont merged commit 2e2627e into rouge-ruby:master Nov 9, 2020
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Nov 9, 2020
@pyrmont pyrmont deleted the bugfix.kotlin-keyword-matches branch November 9, 2020 03:29
@s1monw1
Copy link

s1monw1 commented Nov 23, 2020

Thanks. Seems to work fine :)

mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
Rouge will currently match identifiers in the Kotlin lexer that begin
with certain keywords (such as `super`). This is because of a change in
rouge-ruby#1496 that added a rule to support labels. That change should have
updated the rule to end with a `\b` so as to ensure that identifiers
that begin with the listed keywords are followed by a word break.
This commit fixes that error.
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.

Kotlin keyword highlighed in variable name
3 participants