From 3d273901fc823c718ce9d9bffe1eab582c093c06 Mon Sep 17 00:00:00 2001 From: Mark Street Date: Sat, 6 Jan 2018 10:44:02 +0000 Subject: [PATCH] Fix whitespace bug before comments in Q lexer This fixes #857. --- lib/rouge/lexers/q.rb | 2 +- spec/visual/samples/q | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rouge/lexers/q.rb b/lib/rouge/lexers/q.rb index 196cac4b2f..4326d9a1f6 100644 --- a/lib/rouge/lexers/q.rb +++ b/lib/rouge/lexers/q.rb @@ -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) diff --git a/spec/visual/samples/q b/spec/visual/samples/q index b1b79b679e..c43df289d5 100644 --- a/spec/visual/samples/q +++ b/spec/visual/samples/q @@ -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 @@ -74,4 +76,4 @@ til eof comment / no effect \ -no effect \ No newline at end of file +no effect