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

Tokenise error messages in Console lexer #1498

Merged
merged 2 commits into from Apr 14, 2020

Conversation

gavlock
Copy link
Contributor

@gavlock gavlock commented Apr 12, 2020

Add an "error" list option to the console lexer.
Option default to nil.

If non-nil, any line not already identified as a snip, prompt or
comment - that starts with one of the strings in the option - will be
tagged as Generic::Error

This closes #1487.

Add an "error" list option to the console lexer.
Option default to nil.

If non-nil, any line not already identified as a snip, prompt or
comment - that starts with one of the strings in the option - will be
tagged as `Generic::Error`
@gavlock gavlock marked this pull request as ready for review April 12, 2020 10:02
@pyrmont pyrmont self-assigned this Apr 13, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Apr 13, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Apr 14, 2020

@gavlock Thanks for submitting this. It looks good! I should probably have done this through a separate PR but I took the opportunity to put the methods in this class into alphabetical order. That's not necessary by any means but in considering the placement of the #error_regex method, I found myself somewhat at a loss to evaluate that. I think there's enough going in this lexer that trying to put it into any other kind of order doesn't really work and just makes it difficult to read.

@pyrmont pyrmont changed the title Add error message handling to Console lexer (resolves rouge-ruby/rouge#1487) Tokenise error messages in Console lexer Apr 14, 2020
@pyrmont pyrmont merged commit 844c0ee into rouge-ruby:master Apr 14, 2020
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Apr 14, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Apr 14, 2020

@gavlock OK, got it merged in :) This will go out as part of v3.18.0 of Rouge. That's scheduled for release on Tuesday 14 April (which, depending on when you're reading this, will either be today or tomorrow). Thanks again for the submission! 🎉

@gavlock
Copy link
Contributor Author

gavlock commented Apr 14, 2020

Thanks @pyrmont - looking forward to it :)

mattt pushed a commit to NSHipster/rouge that referenced this pull request May 21, 2020
The Console lexer is intended for use in lexing text that would be
expected in a console. As a convenience, it allows an end-user to
specify prompts and comment-demarcating characters.

As a similar convenience, this commit adds an `error` list option. By
default the value is `nil` but if specified by the end-user, any line
(not already identified as a snip, prompt or comment) which begins with
one of the strings in the option will be tokenised as `Generic::Error`.

To assist in future review and maintenance, this commit also
reorganises the methods in the class into alphabetical order.
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.

Add error message handling to Console lexer
2 participants