| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 var s = ToString(string); | 171 var s = ToString(string); |
| 172 var length = s.length; | 172 var length = s.length; |
| 173 var lastIndex = this.lastIndex; | 173 var lastIndex = this.lastIndex; |
| 174 var i = this.global ? TO_INTEGER(lastIndex) : 0; | 174 var i = this.global ? TO_INTEGER(lastIndex) : 0; |
| 175 | 175 |
| 176 if (i < 0 || i > s.length) { | 176 if (i < 0 || i > s.length) { |
| 177 this.lastIndex = 0; | 177 this.lastIndex = 0; |
| 178 return null; | 178 return null; |
| 179 } | 179 } |
| 180 | 180 |
| 181 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, s, lastIndex]); |
| 181 // matchIndices is an array of integers with length of captures*2, | 182 // matchIndices is an array of integers with length of captures*2, |
| 182 // each pair of integers specified the start and the end of index | 183 // each pair of integers specified the start and the end of index |
| 183 // in the string. | 184 // in the string. |
| 184 var matchIndices = DoRegExpExec(this, s, i); | 185 var matchIndices = DoRegExpExec(this, s, i); |
| 185 | 186 |
| 186 if (matchIndices == null) { | 187 if (matchIndices == null) { |
| 187 if (this.global) this.lastIndex = 0; | 188 if (this.global) this.lastIndex = 0; |
| 188 return matchIndices; // no match | 189 return matchIndices; // no match |
| 189 } | 190 } |
| 190 | 191 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 366 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
| 366 | 367 |
| 367 for (var i = 1; i < 10; ++i) { | 368 for (var i = 1; i < 10; ++i) { |
| 368 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 369 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
| 369 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 370 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
| 370 } | 371 } |
| 371 } | 372 } |
| 372 | 373 |
| 373 | 374 |
| 374 SetupRegExp(); | 375 SetupRegExp(); |
| OLD | NEW |