Lines Matching refs:RegExp
10 var $RegExp = global.RegExp;
17 // RegExp : Called as constructor; see ECMA-262, section 15.10.4.
80 // RegExp : Called as function; see ECMA-262, section 15.10.3.1.
84 return new $RegExp(pattern, flags);
88 // Deprecated RegExp.prototype.compile method. We behave like the constructor
89 // were called again. In SpiderMonkey, this method returns the regexp object.
97 // RegExp.prototype.compile and in the constructor, where they are
100 if (this == $RegExp.prototype) {
101 // We don't allow recompiling RegExp.prototype.
103 ['RegExp.prototype.compile', this]);
113 function DoRegExpExec(regexp, string, index) {
114 var result = %_RegExpExec(regexp, string, index, lastMatchInfo);
146 function RegExpExecNoTests(regexp, string, start) {
147 // Must be called with RegExp, string and positive integer as arguments.
148 var matchInfo = %_RegExpExec(regexp, string, start, lastMatchInfo);
153 regexp.lastIndex = 0;
161 ['RegExp.prototype.exec', this]);
167 // Conversion is required by the ES5 specification (RegExp.prototype.exec
198 // One-element cache for the simplified test regexp.
209 ['RegExp.prototype.test', this]);
215 // Conversion is required by the ES5 specification (RegExp.prototype.exec
234 // Non-global, non-sticky regexp.
235 // Remove irrelevant preceeding '.*' in a test regexp. The expression
238 var regexp = this;
239 if (regexp.source.length >= 3 &&
240 %_StringCharCodeAt(regexp.source, 0) == 46 && // '.'
241 %_StringCharCodeAt(regexp.source, 1) == 42 && // '*'
242 %_StringCharCodeAt(regexp.source, 2) != 63) { // '?'
243 regexp = TrimRegExp(regexp);
246 var matchIndices = %_RegExpExec(regexp, string, 0, lastMatchInfo);
256 function TrimRegExp(regexp) {
257 if (!%_ObjectEquals(regexp_key, regexp)) {
258 regexp_key = regexp;
260 new $RegExp(%_SubString(regexp.source, 2, regexp.source.length),
261 (regexp.ignoreCase ? regexp.multiline ? "im" : "i"
262 : regexp.multiline ? "m" : ""));
271 ['RegExp.prototype.toString', this]);
283 // rightContext of the RegExp constructor. The properties are computed based
371 // regexp match. The property lastMatchInfo includes the matchIndices
372 // array of the last successful regexp match (an array of start/end index
385 // Used internally by replace regexp with function.
394 %FunctionSetInstanceClassName($RegExp, 'RegExp');
395 %AddNamedProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM);
396 %SetCode($RegExp, RegExpConstructor);
398 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array(
406 %FunctionSetLength($RegExp.prototype.compile, 1);
419 %OptimizeObjectForAddingMultipleProperties($RegExp, 22);
420 %DefineAccessorPropertyUnchecked($RegExp, 'input', RegExpGetInput,
422 %DefineAccessorPropertyUnchecked($RegExp, '$_', RegExpGetInput,
428 // the value of the expression 'RegExp.multiline = null' (for instance) is the
437 %DefineAccessorPropertyUnchecked($RegExp, 'multiline', RegExpGetMultiline,
439 %DefineAccessorPropertyUnchecked($RegExp, '$*', RegExpGetMultiline,
448 %DefineAccessorPropertyUnchecked($RegExp, 'lastMatch', RegExpGetLastMatch,
450 %DefineAccessorPropertyUnchecked($RegExp, '$&', RegExpGetLastMatch,
452 %DefineAccessorPropertyUnchecked($RegExp, 'lastParen', RegExpGetLastParen,
454 %DefineAccessorPropertyUnchecked($RegExp, '$+', RegExpGetLastParen,
456 %DefineAccessorPropertyUnchecked($RegExp, 'leftContext',
459 %DefineAccessorPropertyUnchecked($RegExp, '$`', RegExpGetLeftContext,
461 %DefineAccessorPropertyUnchecked($RegExp, 'rightContext',
464 RegExp, "$'", RegExpGetRightContext,
468 %DefineAccessorPropertyUnchecked($RegExp, '$' + i,
472 %ToFastProperties($RegExp);