OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 | 295 |
296 // Remove irrelevant preceeding '.*' in a test regexp. The expression | 296 // Remove irrelevant preceeding '.*' in a test regexp. The expression |
297 // checks whether this.source starts with '.*' and that the third | 297 // checks whether this.source starts with '.*' and that the third |
298 // char is not a '?' | 298 // char is not a '?' |
299 if (%_StringCharCodeAt(this.source,0) == 46 && // '.' | 299 if (%_StringCharCodeAt(this.source,0) == 46 && // '.' |
300 %_StringCharCodeAt(this.source,1) == 42 && // '*' | 300 %_StringCharCodeAt(this.source,1) == 42 && // '*' |
301 %_StringCharCodeAt(this.source,2) != 63) { // '?' | 301 %_StringCharCodeAt(this.source,2) != 63) { // '?' |
302 if (!%_ObjectEquals(regexp_key, this)) { | 302 if (!%_ObjectEquals(regexp_key, this)) { |
303 regexp_key = this; | 303 regexp_key = this; |
304 regexp_val = new $RegExp(this.source.substring(2, | 304 regexp_val = new $RegExp(this.source.substring(2, this.source.length), |
305 this.source.length - 2), | |
306 (this.global ? 'g' : '') | 305 (this.global ? 'g' : '') |
307 + (this.ignoreCase ? 'i' : '') | 306 + (this.ignoreCase ? 'i' : '') |
308 + (this.multiline ? 'm' : '')); | 307 + (this.multiline ? 'm' : '')); |
309 } | 308 } |
310 if (!regexp_val.test(s)) return false; | 309 if (!regexp_val.test(s)) return false; |
311 } | 310 } |
312 | 311 |
313 var length = s.length; | 312 var length = s.length; |
314 var i = this.global ? TO_INTEGER(lastIndex) : 0; | 313 var i = this.global ? TO_INTEGER(lastIndex) : 0; |
315 | 314 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 537 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
539 | 538 |
540 for (var i = 1; i < 10; ++i) { | 539 for (var i = 1; i < 10; ++i) { |
541 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 540 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
542 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 541 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
543 } | 542 } |
544 } | 543 } |
545 | 544 |
546 | 545 |
547 SetupRegExp(); | 546 SetupRegExp(); |
OLD | NEW |