Commit 4615e4904964250983c6198f91c28505f403b776

Gregor Martynus 2013-05-11T12:27:50

I had a problem with syntax highlighting of JavaScript when it starts with a `// comment`. The problem of the comment pattern was ``` /(^|[^\\])(\/\*[\w\W]*?\*\/|[^:]\/\/.*?(\r?\n|$))/g ^^^^ ``` And I'm not sure what it is for, exactly? Adding a `?` to it fixes the problem for me, but I hope that it doesn't cause problems with other use case. Could you look into it? Is there any test suite for the existing code?

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/components/prism-clike.js b/components/prism-clike.js
index 3c0b24a..3d53698 100644
--- a/components/prism-clike.js
+++ b/components/prism-clike.js
@@ -1,6 +1,6 @@
 Prism.languages.clike = {
 	'comment': {
-		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|[^:]\/\/.*?(\r?\n|$))/g,
+		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|[^:]?\/\/.*?(\r?\n|$))/g,
 		lookbehind: true
 	},
 	'string': /("|')(\\?.)*?\1/g,