indexp[0] = i;
int matchlen = i - (start + gData.skipped);
int ep = index;
index -= matchlen;
Object result;
Scriptable obj;
if (matchType == TEST) {
/*
* Testing for a match and updating cx.regExpImpl: don't allocate
* an array object, do return true.
*/
result = Boolean.TRUE;
obj = null;
}
else {
/*
* The array returned on match has element 0 bound to the matched
* string, elements 1 through re.parenCount bound to the paren
* matches, an index property telling the length of the left context,
* and an input property referring to the input string.
*/
Scriptable scope = getTopLevelScope(scopeObj);
result = ScriptRuntime.newObject(cx, scope, "Array", null);
obj = (Scriptable) result;
String matchstr = new String(charArray, index, matchlen);
obj.put(0, obj, matchstr);