Home | History | Annotate | Download | only in src

Lines Matching refs:RegExp

33 var $RegExp = global.RegExp;
40 // RegExp : Called as constructor; see ECMA-262, section 15.10.4.
94 // RegExp : Called as function; see ECMA-262, section 15.10.3.1.
98 return new $RegExp(pattern, flags);
102 // Deprecated RegExp.prototype.compile method. We behave like the constructor
103 // were called again. In SpiderMonkey, this method returns the regexp object.
111 // RegExp.prototype.compile and in the constructor, where they are
114 if (this == $RegExp.prototype) {
115 // We don't allow recompiling RegExp.prototype.
117 ['RegExp.prototype.compile', this]);
127 function DoRegExpExec(regexp, string, index) {
128 var result = %_RegExpExec(regexp, string, index, lastMatchInfo);
153 function RegExpExecNoTests(regexp, string, start) {
154 // Must be called with RegExp, string and positive integer as arguments.
155 var matchInfo = %_RegExpExec(regexp, string, start, lastMatchInfo);
160 regexp.lastIndex = 0;
168 ['RegExp.prototype.exec', this]);
174 // Conversion is required by the ES5 specification (RegExp.prototype.exec
188 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, string, lastIndex]);
206 // One-element cache for the simplified test regexp.
217 ['RegExp.prototype.test', this]);
223 // Conversion is required by the ES5 specification (RegExp.prototype.exec
232 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, string, lastIndex]);
243 // Non-global regexp.
244 // Remove irrelevant preceeding '.*' in a non-global test regexp.
247 var regexp = this;
248 if (%_StringCharCodeAt(regexp.source, 0) == 46 && // '.'
249 %_StringCharCodeAt(regexp.source, 1) == 42 && // '*'
250 %_StringCharCodeAt(regexp.source, 2) != 63) { // '?'
251 regexp = TrimRegExp(regexp);
253 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [regexp, string, lastIndex]);
255 var matchIndices = %_RegExpExec(regexp, string, 0, lastMatchInfo);
265 function TrimRegExp(regexp) {
266 if (!%_ObjectEquals(regexp_key, regexp)) {
267 regexp_key = regexp;
269 new $RegExp(%_SubString(regexp.source, 2, regexp.source.length),
270 (regexp.ignoreCase ? regexp.multiline ? "im" : "i"
271 : regexp.multiline ? "m" : ""));
280 ['RegExp.prototype.toString', this]);
291 // rightContext of the RegExp constructor. The properties are computed based
379 // regexp match. The property lastMatchInfo includes the matchIndices
380 // array of the last successful regexp match (an array of start/end index
393 // Used internally by replace regexp with function.
402 %FunctionSetInstanceClassName($RegExp, 'RegExp');
403 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM);
404 %SetCode($RegExp, RegExpConstructor);
406 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array(
414 %FunctionSetLength($RegExp.prototype.compile, 1);
427 %OptimizeObjectForAddingMultipleProperties($RegExp, 22);
428 %DefineOrRedefineAccessorProperty($RegExp, 'input', RegExpGetInput,
430 %DefineOrRedefineAccessorProperty($RegExp, '$_', RegExpGetInput,
432 %DefineOrRedefineAccessorProperty($RegExp, '$input', RegExpGetInput,
438 // the value of the expression 'RegExp.multiline = null' (for instance) is the
447 %DefineOrRedefineAccessorProperty($RegExp, 'multiline', RegExpGetMultiline,
449 %DefineOrRedefineAccessorProperty($RegExp, '$*', RegExpGetMultiline,
458 %DefineOrRedefineAccessorProperty($RegExp, 'lastMatch', RegExpGetLastMatch,
460 %DefineOrRedefineAccessorProperty($RegExp, '$&', RegExpGetLastMatch,
462 %DefineOrRedefineAccessorProperty($RegExp, 'lastParen', RegExpGetLastParen,
464 %DefineOrRedefineAccessorProperty($RegExp, '$+', RegExpGetLastParen,
466 %DefineOrRedefineAccessorProperty($RegExp, 'leftContext',
469 %DefineOrRedefineAccessorProperty($RegExp, '$`', RegExpGetLeftContext,
471 %DefineOrRedefineAccessorProperty($RegExp, 'rightContext',
474 %DefineOrRedefineAccessorProperty($RegExp, "$'", RegExpGetRightContext,
478 %DefineOrRedefineAccessorProperty($RegExp, '$' + i,
482 %ToFastProperties($RegExp);