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

Do not read ::class as opening a 'class' #1572

Merged
merged 2 commits into from
Sep 8, 2020
Merged

Do not read ::class as opening a 'class' #1572

merged 2 commits into from
Sep 8, 2020

Conversation

contradictioned
Copy link
Contributor

Explicitly find 'class' after the '::' operator and render as name. Prevents pushing a :class. Fixes #1571

I figured that this works. But please tell me if that is not the best way to do so :)

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

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@contradictioned Thanks for submitting a PR and I'm sorry that it took so long to get to it. I have a question below.

lib/rouge/lexers/kotlin.rb Outdated Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Sep 8, 2020
@pyrmont pyrmont merged commit eef2a4f into rouge-ruby:master Sep 8, 2020
@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Sep 8, 2020
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
Due to the way the Kotlin lexer treats the 'class' keyword, the use of
the callable reference, `::class`, can result in the lexer moving into
an incorrect state where it interprets `class` as beginning a class
definition. This commit fixes that bug.

Co-authored-by: Michael Camilleri <mike@inqk.net>
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 ::class is interpreted operator followed by class-Keyword
2 participants