Skip to content

Commit

Permalink
JQ: Improved performance of strings (#3084)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Sep 26, 2021
1 parent 9ed4cf6 commit 233415b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion components/prism-jq.js
@@ -1,7 +1,7 @@
(function (Prism) {

var interpolation = /\\\((?:[^()]|\([^()]*\))*\)/.source;
var string = RegExp(/"(?:[^"\r\n\\]|\\[^\r\n(]|__)*"/.source.replace(/__/g, function () { return interpolation; }));
var string = RegExp(/(^|[^\\])"(?:[^"\r\n\\]|\\[^\r\n(]|__)*"/.source.replace(/__/g, function () { return interpolation; }));
var stringInterpolation = {
'interpolation': {
pattern: RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + interpolation),
Expand All @@ -21,11 +21,13 @@
'comment': /#.*/,
'property': {
pattern: RegExp(string.source + /(?=\s*:(?!:))/.source),
lookbehind: true,
greedy: true,
inside: stringInterpolation
},
'string': {
pattern: string,
lookbehind: true,
greedy: true,
inside: stringInterpolation
},
Expand Down
2 changes: 1 addition & 1 deletion components/prism-jq.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 233415b

Please sign in to comment.