-
Notifications
You must be signed in to change notification settings - Fork 745
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
Add SAS lexer and accompanying files #1107
Conversation
Import: Add SAS lexer and accompanying files rouge-ruby#1107
Forgive me, @tomsutch. It might take a bit of time to get through this lexer—there sure are a lot of keywords! |
@tomsutch I do wonder if there's some shortcut to identifying keywords (such as by position) as it seems like there's a lot of matching being done to produce relatively few distinct tokens. |
@pyrmont Thanks for your feedback. I'll take a look at your comments in detail over the coming days. |
Pass string literals to mimetypes Remove excess whitespace Add link to CC-BY licence Add examples of hex numbers to visual sample
* Use consistent naming for method and instance variable * Use a Set for each list of keywords * Wrap the proc_keywords Hash in a method
Co-Authored-By: Ashwin Maroli <ashmaroli@users.noreply.github.com>
You'll need to resolve all offenses reported by RuboCop: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more corrections to regexps in the lexer..
@tomsutch Any luck fixing the outstanding items in this PR? |
No need to re-split text as we are capturing terms separately Use upper-case keys in proc_keywords for simplicity
Co-Authored-By: Ashwin Maroli <ashmaroli@users.noreply.github.com>
@tomsutch I hate to inform you but looks like Travis CI failed with some linting errors. Please fix. |
@tomsutch Before pushing, it's a good idea to run the following: rake && bundle exec rubucop bin lib spec tasks If that runs without error then your code should pass Travis as well. |
Thanks - the latest build is https://travis-ci.org/rouge-ruby/rouge/jobs/559860704
There's one offense for every instance of I'm certainly happy to do what's needed to fix this, but I don't understand why these are happening when other lexers contain similar rules in similar formats and don't get picked up by Rubocop. Do you know why this might be? |
The offense is simply |
@tomsutch The explanation given by RuboCop is brief but, essentially, RuboCop flags the use of literal regular expressions of the form Other lexers avoid this warning by either using a sigil to mark the beginning of the regex ( |
Ah, thanks. Now I see that the the other lexers I was referring to when putting this together have also been changed accordingly via #1180. I'll fix this now. |
I think I've now addressed all the feedback, if you're happy with my response to your request @pyrmont? |
@tomsutch Thanks for the contribution to Rouge :) Another language that's highlighted! 🎉 |
Add lexer for SAS.
It's a bit of an odd language with lots of keywords, most of them specific to individual procedures, so I hope I have gone about this in an appropriate way. I haven't attempted to implement all of the procedure-specific stuff by any means.
Happy to change in response to feedback :-)