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 debug errors in Liquid lexer #1192

Merged
merged 2 commits into from
Jun 21, 2019

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Jun 17, 2019

The Liquid lexer used nil to avoid creating tokens for unwanted capture groups. When run with @debug enabled, this would cause Sinatra to crash. This commit removes the need for passing nil by using non-capturing groups.

The Liquid lexer used `nil` to avoid creating tokens for unwanted
capture groups. When run with `@debug` enabled, this would cause Sinatra
to crash. This commit removes the need for passing `nil` by using
non-capturing groups.
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Jun 17, 2019
@pyrmont
Copy link
Contributor Author

pyrmont commented Jun 17, 2019

This fixes the problem with the Liquid lexer that was observed in #943. The fix in that PR involved patching regex_lexer.rb to avoid inspecting tokens that were set to nil. I think the mistake is really in having nil tokens in the first place. The Liquid lexer was using them because it wasn't correctly using non-capturing groups in its rules. Fixing those rules fixes the problem.

@pyrmont pyrmont mentioned this pull request Jun 17, 2019
@pyrmont pyrmont merged commit f099368 into rouge-ruby:master Jun 21, 2019
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Jun 21, 2019
@pyrmont pyrmont deleted the bugfix.liquid-lexer-debug branch June 21, 2019 08:18
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.

2 participants