mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-10 20:57:11 +00:00
Bring back the Rhino regex patch to use native Java regex.
This commit is contained in:
committed by
Francisco Ryan Tolmasky I
parent
90e7508700
commit
380b0d0e5d
@@ -1,6 +1,8 @@
|
||||
var File = require("file");
|
||||
var window = require("browser/window");
|
||||
|
||||
require("./regexp-rhino-patch");
|
||||
|
||||
var exported = ["OBJJ_HOME", "objj_preprocess",
|
||||
"FRAGMENT_FILE", "FRAGMENT_LOCAL",
|
||||
"MARKER_CODE", "MARKER_IMPORT_STD", "MARKER_IMPORT_LOCAL",
|
||||
|
||||
+5
-8
@@ -1,9 +1,3 @@
|
||||
importClass(java.util.ArrayList);
|
||||
importClass(java.util.List);
|
||||
importClass(java.util.regex.Matcher);
|
||||
importClass(java.util.regex.Pattern);
|
||||
importClass(java.util.regex.PatternSyntaxException);
|
||||
|
||||
var CachedRegexData = [];
|
||||
|
||||
function regexDataFromRegex(aRegex)
|
||||
@@ -37,10 +31,10 @@ function regexDataFromRegex(aRegex)
|
||||
source = source.replace("(?<!\\\\)\\{(?!\\d)", "\\\\{", "g");
|
||||
source = source.replace("(?<!(\\d,?|\\\\))\\}", "\\\\}", "g");
|
||||
|
||||
return CachedRegexData[string] = { pattern:Pattern.compile(source, 0), flags:flags };
|
||||
return CachedRegexData[string] = { pattern:java.util.regex.Pattern.compile(source, 0), flags:flags };
|
||||
}
|
||||
|
||||
String.prototype.match = function(regex)
|
||||
function newMatch(regex)
|
||||
{
|
||||
var regexData = regexDataFromRegex(regex);
|
||||
|
||||
@@ -74,3 +68,6 @@ String.prototype.match = function(regex)
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
if (system.platform === "rhino")
|
||||
String.prototype.match = newMatch;
|
||||
Reference in New Issue
Block a user