| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const ORIGINAL_DATE = (global.Date, $Date); | 106 const ORIGINAL_DATE = (global.Date, $Date); |
| 107 | 107 |
| 108 # Constants used on an array to implement the properties of the RegExp object. | 108 # Constants used on an array to implement the properties of the RegExp object. |
| 109 const REGEXP_NUMBER_OF_CAPTURES = 0; | 109 const REGEXP_NUMBER_OF_CAPTURES = 0; |
| 110 const REGEXP_FIRST_CAPTURE = 3; | 110 const REGEXP_FIRST_CAPTURE = 3; |
| 111 | 111 |
| 112 # We can't put macros in macros so we use constants here. | 112 # We can't put macros in macros so we use constants here. |
| 113 # REGEXP_NUMBER_OF_CAPTURES | 113 # REGEXP_NUMBER_OF_CAPTURES |
| 114 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); | 114 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); |
| 115 | 115 |
| 116 # Gets the value of a Date object. If arg is not a Date object |
| 117 # a type error is thrown. |
| 118 macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_ValueOf(arg) : ThrowTypeE
rror()); |
| 119 |
| 116 # Last input and last subject are after the captures so we can omit them on | 120 # Last input and last subject are after the captures so we can omit them on |
| 117 # results returned from global searches. Beware - these evaluate their | 121 # results returned from global searches. Beware - these evaluate their |
| 118 # arguments twice. | 122 # arguments twice. |
| 119 macro LAST_SUBJECT(array) = ((array)[1]); | 123 macro LAST_SUBJECT(array) = ((array)[1]); |
| 120 macro LAST_INPUT(array) = ((array)[2]); | 124 macro LAST_INPUT(array) = ((array)[2]); |
| 121 | 125 |
| 122 # REGEXP_FIRST_CAPTURE | 126 # REGEXP_FIRST_CAPTURE |
| 123 macro CAPTURE(index) = (3 + (index)); | 127 macro CAPTURE(index) = (3 + (index)); |
| 124 const CAPTURE0 = 3; | 128 const CAPTURE0 = 3; |
| 125 const CAPTURE1 = 4; | 129 const CAPTURE1 = 4; |
| OLD | NEW |