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

q lexer does not allow for comments with multiple leading whitespace #857

Closed
mkst opened this issue Jan 6, 2018 · 2 comments
Closed

q lexer does not allow for comments with multiple leading whitespace #857

mkst opened this issue Jan 6, 2018 · 2 comments
Labels
bugfix-request A request for a bugfix to be developed. pr-open A PR addressing this issue is open.

Comments

@mkst
Copy link
Contributor

mkst commented Jan 6, 2018

I've noticed that if you have more than one space before a single-line comment /, it is not recognised correctly.

q)1+10 / this would be recognised as a comment
q)1+2  / but this would not

It's a single-character change, which I will submit a PR for now:

$ git diff q.rb 
diff --git a/lib/rouge/lexers/q.rb b/lib/rouge/lexers/q.rb
index 196cac4..4326d9a 100644
--- a/lib/rouge/lexers/q.rb
+++ b/lib/rouge/lexers/q.rb
@@ -65,7 +65,7 @@ module Rouge
         end
 
         # White space and comments
-        rule(%r{[ \t\r]\/.*$}, Comment::Single)
+        rule(%r{[ \t\r]+\/.*$}, Comment::Single)
         rule(/[ \t\r]+/, Text::Whitespace)
         rule(%r{^/$.*?^\\$}m, Comment::Multiline)
         rule(%r{^\/[^\n]*$(\n[^\S\n]+.*$)*}, Comment::Multiline)
pyrmont added a commit to pyrmont/rouge that referenced this issue May 11, 2019
This commit:

* fixes the q lexer for handling whitespace before comments
* adds comments to the q sample file with leading whitespace
pyrmont pushed a commit to pyrmont/rouge that referenced this issue May 17, 2019
@stale
Copy link

stale bot commented Jun 19, 2019

This contribution has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.

@stale stale bot added the stale-issue There has been no activity for a year. label Jun 19, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2019

I'm sorry, this has an associated PR and shouldn't have been marked as stale. I've fixed it. (We are slowly getting through the backlog of PRs and will get to it!)

@stale stale bot removed the stale-issue There has been no activity for a year. label Jun 19, 2019
@pyrmont pyrmont added bugfix-request A request for a bugfix to be developed. pr-open A PR addressing this issue is open. labels Jun 19, 2019
@pyrmont pyrmont closed this as completed Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix-request A request for a bugfix to be developed. pr-open A PR addressing this issue is open.
Projects
None yet
Development

No branches or pull requests

2 participants