mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Fixed bug #189898, replace not working with string argument. Also added
error checking for bad quantifiers (see bug 188206)
This commit is contained in:
parent
fbdf468076
commit
517e75d112
@ -715,6 +715,7 @@ System.out.println();
|
|||||||
state.result = new RENode(REOP_FLAT);
|
state.result = new RENode(REOP_FLAT);
|
||||||
state.result.chr = c;
|
state.result.chr = c;
|
||||||
state.result.length = 1;
|
state.result.length = 1;
|
||||||
|
state.result.flatIndex = -1;
|
||||||
state.progLength += 3;
|
state.progLength += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,6 +1015,14 @@ System.out.println();
|
|||||||
state.result = new RENode(REOP_DOT);
|
state.result = new RENode(REOP_DOT);
|
||||||
state.progLength++;
|
state.progLength++;
|
||||||
break;
|
break;
|
||||||
|
case '*':
|
||||||
|
case '+':
|
||||||
|
case '{':
|
||||||
|
case '}':
|
||||||
|
case '?':
|
||||||
|
reportError("msg.bad.quant",
|
||||||
|
String.valueOf(src[state.cp - 1]), state);
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
state.result = new RENode(REOP_FLAT);
|
state.result = new RENode(REOP_FLAT);
|
||||||
state.result.chr = c;
|
state.result.chr = c;
|
||||||
@ -1205,7 +1214,7 @@ System.out.println();
|
|||||||
/*
|
/*
|
||||||
* Consecutize FLAT's if possible.
|
* Consecutize FLAT's if possible.
|
||||||
*/
|
*/
|
||||||
if (t.kid != null) {
|
if (t.flatIndex != -1) {
|
||||||
while ((t.next != null) && (t.next.op == REOP_FLAT)
|
while ((t.next != null) && (t.next.op == REOP_FLAT)
|
||||||
&& ((t.flatIndex + t.length)
|
&& ((t.flatIndex + t.length)
|
||||||
== t.next.flatIndex)) {
|
== t.next.flatIndex)) {
|
||||||
@ -1213,7 +1222,7 @@ System.out.println();
|
|||||||
t.next = t.next.next;
|
t.next = t.next.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((t.kid != null) && (t.length > 1)) {
|
if ((t.flatIndex != -1) && (t.length > 1)) {
|
||||||
if ((state.flags & JSREG_FOLD) != 0)
|
if ((state.flags & JSREG_FOLD) != 0)
|
||||||
program[pc - 1] = REOP_FLATi;
|
program[pc - 1] = REOP_FLATi;
|
||||||
else
|
else
|
||||||
@ -2845,7 +2854,7 @@ class RENode {
|
|||||||
/* or a literal sequence */
|
/* or a literal sequence */
|
||||||
char chr; /* of one character */
|
char chr; /* of one character */
|
||||||
int length; /* or many (via the index) */
|
int length; /* or many (via the index) */
|
||||||
int flatIndex;
|
int flatIndex; /* which is -1 if not sourced */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user