Skip to content

Commit 0ca1353

Browse files
committed
JSON: Fix property and string patterns performance. Fix #1080
1 parent 23c6e8a commit 0ca1353

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

components/prism-json.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Prism.languages.json = {
2-
'property': /"(?:\\.|[^|"])*"(?=\s*:)/ig,
3-
'string': /"(?!:)(?:\\.|[^|"])*"(?!:)/g,
4-
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,
5-
'punctuation': /[{}[\]);,]/g,
6-
'operator': /:/g,
7-
'boolean': /\b(true|false)\b/gi,
8-
'null': /\bnull\b/gi
2+
'property': /"(?:\\.|[^\\"])*"(?=\s*:)/ig,
3+
'string': /"(?!:)(?:\\.|[^\\"])*"(?!:)/g,
4+
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,
5+
'punctuation': /[{}[\]);,]/g,
6+
'operator': /:/g,
7+
'boolean': /\b(true|false)\b/gi,
8+
'null': /\bnull\b/gi
99
};
1010

1111
Prism.languages.jsonp = Prism.languages.json;

components/prism-json.min.js

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

0 commit comments

Comments
 (0)