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 incorrect predicate usage in PowerShell lexer #1536

Merged
merged 2 commits into from Jun 9, 2020

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Jun 7, 2020

The PowerShell lexer includes rules that use the existence of a nil value in a regular expression to decide whether to push new states onto the stack. The predicates for these rules were written incorrectly. This PR removes one of the predicates (which wasn't necessary) and uses Object#nil? in the other to match correctly.

This fixes #1535.

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

pyrmont commented Jun 7, 2020

@pekspro In the visual sample, I'm now seeing your example code lexing correctly. How does it look to you?

@pekspro
Copy link

pekspro commented Jun 8, 2020

Wow, this fix was done very fast. I am impressed :-)

When I look on http://rouge.jneen.net it still looks like same. Could I verify this somewhere else? Or do I need to compile this? I have never worked with ruby, but I guess I could learn :-D

@pyrmont
Copy link
Contributor Author

pyrmont commented Jun 9, 2020

@pekspro Yeah, unfortunately you need to download the repo and run master on your local machine. But I've had a look again and I'm pretty confident this fixes the issue. I'll merge it in now and then it can be part of the v3.20.0 release I'll do right after :)

@pyrmont pyrmont merged commit 661386a into rouge-ruby:master Jun 9, 2020
@pyrmont pyrmont deleted the bugfix.powershell-interpolation branch June 9, 2020 19:31
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Jun 9, 2020
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
The PowerShell lexer includes rules that use the existence of a nil
value in a regular expression to decide whether to push new states onto
the stack. The predicates for these rules were written incorrectly.
This commit removes one of the predicates (which wasn't necessary) and
uses `Object#nil?` in the other to match correctly.
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.

PowerShell comments not always highlighted as a comment
2 participants