зеркало из https://github.com/mozilla/gecko-dev.git
Patch from nanto@moon.email.ne.jp for misordered alternates in string-lexing regexp, and lack of IE /[/]/ compat in regexp-lexing regexp (433831, r=me, NPOTB).
This commit is contained in:
Родитель
7f43c5d089
Коммит
0b62c0a1e4
|
@ -55,6 +55,9 @@ var opRegExp = new RegExp(opRegExpSrc);
|
|||
// A regexp to match floating point literals (but not integer literals).
|
||||
var fpRegExp = /^\d+\.\d*(?:[eE][-+]?\d+)?|^\d+(?:\.\d*)?[eE][-+]?\d+|^\.\d+(?:[eE][-+]?\d+)?/;
|
||||
|
||||
// A regexp to match regexp literals.
|
||||
var reRegExp = /^\/((?:\\.|\[(?:\\.|[^\]])*\]|[^\/])+)\/([gimy]*)/;
|
||||
|
||||
function Tokenizer(s, f, l) {
|
||||
this.cursor = 0;
|
||||
this.source = String(s);
|
||||
|
@ -161,11 +164,10 @@ Tokenizer.prototype = {
|
|||
var id = match[0];
|
||||
token.type = keywords[id] || IDENTIFIER;
|
||||
token.value = id;
|
||||
} else if ((match = /^"(?:\\.|[^"])*"|^'(?:[^']|\\.)*'/(input))) { //"){
|
||||
} else if ((match = /^"(?:\\.|[^"])*"|^'(?:\\.|[^'])*'/(input))) { //"){
|
||||
token.type = STRING;
|
||||
token.value = eval(match[0]);
|
||||
} else if (this.scanOperand &&
|
||||
(match = /^\/((?:\\.|[^\/])+)\/([gimy]*)/(input))) {
|
||||
} else if (this.scanOperand && (match = reRegExp(input))) {
|
||||
token.type = REGEXP;
|
||||
token.value = new RegExp(match[1], match[2]);
|
||||
} else if ((match = opRegExp(input))) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче