1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-21 18:35:44 +01:00

Add cheap CSS highlighting which is unfortunately far to slow to make any use of.

This commit is contained in:
Kris Maglione
2011-01-13 14:20:32 -05:00
parent 671077f1e7
commit 203730ae62
3 changed files with 89 additions and 8 deletions

View File

@@ -1220,12 +1220,13 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
expr = expr.source;
if (tokens)
expr = String.replace(expr, /<(\w+)>/g, function (m, n1) set.has(tokens, n1) ? tokens[n1].source || tokens[n1] : m);
expr = String.replace(expr, /(\(?P)?<(\w+)>/g, function (m, n1, n2) !n1 && set.has(tokens, n2) ? tokens[n2].dactylSource || tokens[n2].source || tokens[n2] : m);
expr = String.replace(expr, /\/\/[^\n]*|\/\*[^]*?\*\//gm, "")
.replace(/\s+/g, "");
if (/\(\?P</.test(expr)) {
var source = expr;
let groups = ["wholeMatch"];
expr = expr.replace(/((?:[^[(\\]|\\.|\[(?:[^\]]|\\.)*\])*)\((?:\?P<([^>]+)>|(\?))?/gy,
function (m0, m1, m2, m3) {
@@ -1234,7 +1235,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
return m1 + "(" + (m3 || "");
});
var struct = Struct.apply(null, groups);
var source = expr;
}
let res = update(RegExp(expr, flags), {
@@ -1244,7 +1244,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (struct)
update(res, {
exec: function exec() let (match = exec.superapply(this, arguments)) match && struct.fromArray(match),
struct: struct
dactylSource: source, struct: struct
});
return res;
}, {