-
Notifications
You must be signed in to change notification settings - Fork 744
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 comment parsing in Console lexer #1379
Fix comment parsing in Console lexer #1379
Conversation
@dleidert Progress was delayed by a few things but I think I finally found the bug. I've patched that in this PR and added some tests to confirm this. Can you see how it looks on your end? |
Good catch! |
@jneen Always feels good to squash a bug! :) |
I can confirm that using e.g.
Only |
@dleidert Hmmm.... that As for the order not mattering, that's the behaviour working as intended. The way the Console lexer works is that it will first¹ attempt to match each line against the ¹ As you can see when you follow the link, what it actually checks first is whether there's an elision (as now described in this code comment). I've made an additional commit that adds some documentation to the beginning of the class that hopefully explains things a bit better. How does it look? |
That's what I thought.
Ok. Makes sense. This is probably more a matter of documenting the behavior.
Looks good to me :) Would be nice to have something like this at https://github.com/rouge-ruby/rouge/wiki/List-of-supported-languages-and-lexers or a sub-site for the console lexer. I can add it myself if you want me. |
@dleidert wrote:
I think adding it to the wiki is probably best for now. Speaking personally (and not for the other maintainers), I would like to have all documentation be centralised at rouge-ruby.github.io/docs/ and trash the wiki but even if we eventually decide to move in that direction, it would be a large scale effort and, in the meantime, having up to date information on the wiki seems like the smart move. I should note that, in case it wasn't obvious, the docs for the ConsoleLexer class will be updated but that won't happen until with the next release of Rouge on Tuesday 14 January. |
The Console lexer would not correctly parse comments if only the
comments
option was enabled. This was because of a bug in the way the prompt regular expression pattern. This PR fixes that bug and adds a series of tests to confirm the behaviour of the lexer is as intended.This fixes #1370.