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 handling of square parentheses in velocity lexer #1605

Merged

Conversation

domRowan
Copy link
Contributor

@domRowan domRowan commented Oct 12, 2020

Summary

Bugfix for using [ within nested parentheses for velocity lexer.

Details

I was seeing the following error message: unknown state: :push! when using a line similar to this in a .vm file.
#set( $result = $foo($bar[$baz]) )

This is being highlighted by velocity.rb

Looks like this is a result of this rule using push! instead of push:

rule %r/[(\[]/, Punctuation, :push!

Testing

I have added the line above to spec/visual/samples/velocity.
I have confirmed that with no change this causes a unknown state: :push! error message.
After applying my change I have confirmed that this case no longer appears.

Issue link

Raised an issue to track this here: #1604. This commit fixes #1604.

Further work

I have identified that a similar issue MAY be present in ceylon.rb

rule %r(/\*), Comment::Multiline, :push!

I have not amended this, as I don't have the full context on this lexer.

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

Hey @pyrmont

Just so I can get an idea of the down stream impact of this change on timings for my project, do you have an ETA for:

  • When we might be able to merge this change?
  • What's the date for the next release this change could be included in?

@pyrmont pyrmont merged commit 47c0718 into rouge-ruby:master Oct 20, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Oct 20, 2020

@domRowan My plan is for this to be part of the next release of Rouge, v3.25.0. That's scheduled for Tuesday 9 November. Thanks for the fix!

@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Oct 20, 2020
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
The Velocity lexer includes a rule that incorrectly spells the `:push`
magic state as `:push!`. This causes an error when lexing brackets
(which match this rule). This commit fixes that mistake.
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.

error message: unknown state: :push! when using velocity.rb
2 participants