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 Wollok lexer: entity list is shared between lexer instances #1954

Merged
merged 1 commit into from Jun 1, 2023

Conversation

nsfisis
Copy link
Contributor

@nsfisis nsfisis commented May 7, 2023

cf. #1939 (comment)

Problem

Wollok lexer had entities class variable to track defined entities, e.g., class, object.

If a token is included in entities, it will be recognized as Name.Class; if not, Keyword.Variable

          if entities.include?(variable) || ('A'..'Z').cover?(variable[0])
            token Name::Class
          else
            token Keyword::Variable
          end

Since a class variable is shared between instances, each lexer shared entity list.

Solution

I changed entities to an instance variable.

Copy link
Collaborator

@tancnle tancnle left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this, @nsfisis 🙇🏼 I have left a small comment. Please let me know what you think 🙏🏼

spec/lexers/wollok_spec.rb Outdated Show resolved Hide resolved
@tancnle tancnle added the author-action The PR has been reviewed but action by the author is needed label May 14, 2023
@tancnle tancnle added this pull request to the merge queue Jun 1, 2023
Merged via the queue into rouge-ruby:master with commit e7f6fb1 Jun 1, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-action The PR has been reviewed but action by the author is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants