| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 builder.addSpecialSlice(end, subject.length); | 267 builder.addSpecialSlice(end, subject.length); |
| 268 | 268 |
| 269 return builder.generate(); | 269 return builder.generate(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 | 272 |
| 273 // Expand the $-expressions in the string and return a new string with | 273 // Expand the $-expressions in the string and return a new string with |
| 274 // the result. | 274 // the result. |
| 275 function ExpandReplacement(string, subject, matchInfo, builder) { | 275 function ExpandReplacement(string, subject, matchInfo, builder) { |
| 276 var length = string.length; | 276 var length = string.length; |
| 277 var builder_elements = builder.elements; | 277 var builder_elements = builder.elements; |
| 278 var next = %StringIndexOf(string, '$', 0); | 278 var next = %StringIndexOf(string, '$', 0); |
| 279 if (next < 0) { | 279 if (next < 0) { |
| 280 if (length > 0) builder_elements.push(string); | 280 if (length > 0) builder_elements.push(string); |
| 281 return; | 281 return; |
| 282 } | 282 } |
| 283 | 283 |
| 284 // Compute the number of captures; see ECMA-262, 15.5.4.11, p. 102. | 284 // Compute the number of captures; see ECMA-262, 15.5.4.11, p. 102. |
| 285 var m = NUMBER_OF_CAPTURES(matchInfo) >> 1; // Includes the match. | 285 var m = NUMBER_OF_CAPTURES(matchInfo) >> 1; // Includes the match. |
| 286 | 286 |
| 287 if (next > 0) builder_elements.push(SubString(string, 0, next)); | 287 if (next > 0) builder_elements.push(SubString(string, 0, next)); |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 "italics", StringItalics, | 985 "italics", StringItalics, |
| 986 "small", StringSmall, | 986 "small", StringSmall, |
| 987 "strike", StringStrike, | 987 "strike", StringStrike, |
| 988 "sub", StringSub, | 988 "sub", StringSub, |
| 989 "sup", StringSup | 989 "sup", StringSup |
| 990 )); | 990 )); |
| 991 } | 991 } |
| 992 | 992 |
| 993 | 993 |
| 994 SetupString(); | 994 SetupString(); |
| OLD | NEW |