Skip to content

Commit 571f2c5

Browse files
committed
C-like: Make single-line comments greedy. Fix #1337. Make sure #1340 stays fixed.
1 parent 294efaa commit 571f2c5

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

components/prism-clike.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Prism.languages.clike = {
66
},
77
{
88
pattern: /(^|[^\\:])\/\/.*/,
9-
lookbehind: true
9+
lookbehind: true,
10+
greedy: true
1011
}
1112
],
1213
'string': {

components/prism-clike.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prism.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,8 @@ Prism.languages.clike = {
693693
},
694694
{
695695
pattern: /(^|[^\\:])\/\/.*/,
696-
lookbehind: true
696+
lookbehind: true,
697+
greedy: true
697698
}
698699
],
699700
'string': {
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// gulp.watch('./src/**/*.js', ['move']);
2+
3+
----------------------------------------------------
4+
5+
[
6+
["comment", "// gulp.watch('./src/**/*.js', ['move']);"]
7+
]
8+
9+
----------------------------------------------------
10+
11+
Checks for multi-line comment inside single-line comment. See #1337
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* ([{}])
3+
* // <= double slash comment
4+
* ([{}]) <= punctuation
5+
*/
6+
7+
----------------------------------------------------
8+
9+
[
10+
["comment", "/*\r\n * ([{}])\r\n * // <= double slash comment\r\n * ([{}]) <= punctuation\r\n */"]
11+
]
12+
13+
----------------------------------------------------
14+
15+
Checks for single-line comment inside multi-line comment. See #1340

0 commit comments

Comments
 (0)