Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: src/macros.py

Issue 48061: Remapped regexp last-match-info to put subject and index before match indices. (Closed)
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 # Macros implemented in Python. 96 # Macros implemented in Python.
97 python macro CHAR_CODE(str) = ord(str[1]); 97 python macro CHAR_CODE(str) = ord(str[1]);
98 98
99 # Accessors for original global properties that ensure they have been loaded. 99 # Accessors for original global properties that ensure they have been loaded.
100 const ORIGINAL_REGEXP = (global.RegExp, $RegExp); 100 const ORIGINAL_REGEXP = (global.RegExp, $RegExp);
101 const ORIGINAL_DATE = (global.Date, $Date); 101 const ORIGINAL_DATE = (global.Date, $Date);
102 102
103 # Constants used on an array to implement the properties of the RegExp object. 103 # Constants used on an array to implement the properties of the RegExp object.
104 const REGEXP_NUMBER_OF_CAPTURES = 0; 104 const REGEXP_NUMBER_OF_CAPTURES = 0;
105 const REGEXP_FIRST_CAPTURE = 1; 105 const REGEXP_FIRST_CAPTURE = 3;
106 106
107 # We can't put macros in macros so we use constants here. 107 # We can't put macros in macros so we use constants here.
108 # REGEXP_NUMBER_OF_CAPTURES 108 # REGEXP_NUMBER_OF_CAPTURES
109 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); 109 macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
110 110
111 # Last input and last subject are after the captures so we can omit them on 111 # Last input and last subject are after the captures so we can omit them on
112 # results returned from global searches. Beware - these evaluate their 112 # results returned from global searches. Beware - these evaluate their
113 # arguments twice. 113 # arguments twice.
114 macro LAST_SUBJECT(array) = ((array)[(array)[0] + 1]); 114 macro LAST_SUBJECT(array) = ((array)[1]);
115 macro LAST_INPUT(array) = ((array)[(array)[0] + 2]); 115 macro LAST_INPUT(array) = ((array)[2]);
116 116
117 # REGEXP_FIRST_CAPTURE 117 # REGEXP_FIRST_CAPTURE
118 macro CAPTURE(index) = (1 + (index)); 118 macro CAPTURE(index) = (3 + (index));
119 const CAPTURE0 = 1; 119 const CAPTURE0 = 3;
120 const CAPTURE1 = 2; 120 const CAPTURE1 = 4;
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | src/regexp-delay.js » ('j') | src/regexp-delay.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698