Skip to content

Commit

Permalink
Fix whitespace bug before comments in Q lexer
Browse files Browse the repository at this point in the history
This fixes rouge-ruby#857.
  • Loading branch information
mkst authored and pyrmont committed May 17, 2019
1 parent bf3136f commit 3d27390
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/q.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def self.builtins
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)
Expand Down
4 changes: 3 additions & 1 deletion spec/visual/samples/q
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ iasc|idesc|inv|keys|load|log|lsq|ltime|ltrim|maxs|md5|meta|mins|next|parse|plist
/ Strings
("";"x\n";"\007")

a:1 2 3 / comment with leading whitespaces
b:3 4 5 5 / to bring in line with this comment

10D 10D10 10D10:10 10D10:10:10 10D10:10:10.11
10Dz 10D10p 10D10:10n 10D10:10:10z 10D10:10:10.11p
Expand Down Expand Up @@ -74,4 +76,4 @@ til eof comment
/
no effect
\
no effect
no effect

0 comments on commit 3d27390

Please sign in to comment.