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