Skip to content
Permalink
Browse files
JQ: Improved performance of strings (#3084)
  • Loading branch information
RunDevelopment committed Sep 26, 2021
1 parent 9ed4cf6 commit 233415b8591d017f4639fa62465b69984eaf8de0
Showing with 4 additions and 2 deletions.
  1. +3 −1 components/prism-jq.js
  2. +1 −1 components/prism-jq.min.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),
@@ -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
},

Some generated files are not rendered by default. Learn more.

0 comments on commit 233415b

Please sign in to comment.