Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/language/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Rainbow.extend('sql', [
},
{
name: 'comment',
pattern: /--.*$|\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm
pattern: /--.*$|#.*$|\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm
},
{
name: 'constant.numeric',
Expand Down
18 changes: 18 additions & 0 deletions test/language/sql-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,22 @@ export function testSQL(t) {

'<span class="keyword">select</span> <span class="function call">count</span>(<span class="keyword operator">*</span>) <span class="keyword">from</span> some_table <span class="keyword">WHERE</span> some_column <span class="keyword">is</span> <span class="keyword">not</span> <span class="keyword">null</span>;'
);

run(
t,

language,

'comments',

`/* This
is a
multi-line
comment */
select count(*) -- This is a one type of single line comment
from some_table # This is another type of single line comment
WHERE some_column is not null;`,

'<span class="comment">/* This\n is a \n multi-line\n comment */</span>\n <span class="keyword">select</span> <span class="function call">count</span>(<span class="keyword operator">*</span>) <span class="comment">-- This is a one type of single line comment</span>\n <span class="keyword">from</span> some_table <span class="comment"># This is another type of single line comment</span>\n <span class="keyword">WHERE</span> some_column <span class="keyword">is</span> <span class="keyword">not</span> <span class="keyword">null</span>;'
);
}