mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Fixing Unicode ECMA 3 compliance issues.
Fixed bug in $ handling for ECMA 3 (don't support \$)
This commit is contained in:
parent
665e5eab81
commit
0123e33bfd
@ -1692,14 +1692,14 @@ public class NativeRegExp extends ScriptableObject implements Function {
|
||||
break;
|
||||
case REOP_SPACE:
|
||||
if ((index < input.length)
|
||||
&& Character.isWhitespace(input[index]))
|
||||
&& TokenStream.isJSSpace(input[index]))
|
||||
index++;
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
case REOP_NONSPACE:
|
||||
if ((index < input.length)
|
||||
&& !Character.isWhitespace(input[index]))
|
||||
&& !TokenStream.isJSSpace(input[index]))
|
||||
index++;
|
||||
else
|
||||
return -1;
|
||||
|
@ -390,6 +390,7 @@ class ReplaceData extends GlobData {
|
||||
static SubString interpretDollar(RegExpImpl res, char[] da, int dp,
|
||||
int bp, int[] skip)
|
||||
{
|
||||
Context cx = Context.getCurrentContext();
|
||||
char[] ca;
|
||||
int cp;
|
||||
char dc;
|
||||
@ -398,13 +399,14 @@ class ReplaceData extends GlobData {
|
||||
/* Allow a real backslash (literal "\\") to escape "$1" etc. */
|
||||
if (da[dp] != '$')
|
||||
throw new RuntimeException();
|
||||
if (dp > bp && da[dp-1] == '\\')
|
||||
return null;
|
||||
if ((cx.getLanguageVersion() != Context.VERSION_DEFAULT)
|
||||
&& (cx.getLanguageVersion() <= Context.VERSION_1_4))
|
||||
if (dp > bp && da[dp-1] == '\\')
|
||||
return null;
|
||||
|
||||
/* Interpret all Perl match-induced dollar variables. */
|
||||
dc = da[dp+1];
|
||||
if (NativeRegExp.isDigit(dc)) {
|
||||
Context cx = Context.getCurrentContext();
|
||||
if ((cx.getLanguageVersion() != Context.VERSION_DEFAULT)
|
||||
&& (cx.getLanguageVersion() <= Context.VERSION_1_4)) {
|
||||
if (dc == '0')
|
||||
@ -447,7 +449,6 @@ class ReplaceData extends GlobData {
|
||||
case '+':
|
||||
return res.lastParen;
|
||||
case '`':
|
||||
Context cx = Context.getCurrentContext();
|
||||
if (cx.getLanguageVersion() == Context.VERSION_1_2) {
|
||||
/*
|
||||
* JS1.2 imitated the Perl4 bug where left context at each step
|
||||
|
@ -1692,14 +1692,14 @@ public class NativeRegExp extends ScriptableObject implements Function {
|
||||
break;
|
||||
case REOP_SPACE:
|
||||
if ((index < input.length)
|
||||
&& Character.isWhitespace(input[index]))
|
||||
&& TokenStream.isJSSpace(input[index]))
|
||||
index++;
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
case REOP_NONSPACE:
|
||||
if ((index < input.length)
|
||||
&& !Character.isWhitespace(input[index]))
|
||||
&& !TokenStream.isJSSpace(input[index]))
|
||||
index++;
|
||||
else
|
||||
return -1;
|
||||
|
@ -390,6 +390,7 @@ class ReplaceData extends GlobData {
|
||||
static SubString interpretDollar(RegExpImpl res, char[] da, int dp,
|
||||
int bp, int[] skip)
|
||||
{
|
||||
Context cx = Context.getCurrentContext();
|
||||
char[] ca;
|
||||
int cp;
|
||||
char dc;
|
||||
@ -398,13 +399,14 @@ class ReplaceData extends GlobData {
|
||||
/* Allow a real backslash (literal "\\") to escape "$1" etc. */
|
||||
if (da[dp] != '$')
|
||||
throw new RuntimeException();
|
||||
if (dp > bp && da[dp-1] == '\\')
|
||||
return null;
|
||||
if ((cx.getLanguageVersion() != Context.VERSION_DEFAULT)
|
||||
&& (cx.getLanguageVersion() <= Context.VERSION_1_4))
|
||||
if (dp > bp && da[dp-1] == '\\')
|
||||
return null;
|
||||
|
||||
/* Interpret all Perl match-induced dollar variables. */
|
||||
dc = da[dp+1];
|
||||
if (NativeRegExp.isDigit(dc)) {
|
||||
Context cx = Context.getCurrentContext();
|
||||
if ((cx.getLanguageVersion() != Context.VERSION_DEFAULT)
|
||||
&& (cx.getLanguageVersion() <= Context.VERSION_1_4)) {
|
||||
if (dc == '0')
|
||||
@ -447,7 +449,6 @@ class ReplaceData extends GlobData {
|
||||
case '+':
|
||||
return res.lastParen;
|
||||
case '`':
|
||||
Context cx = Context.getCurrentContext();
|
||||
if (cx.getLanguageVersion() == Context.VERSION_1_2) {
|
||||
/*
|
||||
* JS1.2 imitated the Perl4 bug where left context at each step
|
||||
|
Loading…
Reference in New Issue
Block a user