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

Side by Side Diff: regexp2000/src/ast.cc

Issue 8765: * Use new RegExp parser. (Closed)
Patch Set: Use new RegExp parser. Created 12 years, 1 month 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
« no previous file with comments | « regexp2000/src/ast.h ('k') | regexp2000/src/jsregexp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // ---------------------------------------------------------------------------- 183 // ----------------------------------------------------------------------------
184 // Regular expressions 184 // Regular expressions
185 185
186 #define MAKE_ACCEPT(Name) \ 186 #define MAKE_ACCEPT(Name) \
187 void* RegExp##Name::Accept(RegExpVisitor* visitor, void* data) { \ 187 void* RegExp##Name::Accept(RegExpVisitor* visitor, void* data) { \
188 return visitor->Visit##Name(this, data); \ 188 return visitor->Visit##Name(this, data); \
189 } 189 }
190 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_ACCEPT) 190 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_ACCEPT)
191 #undef MAKE_ACCEPT 191 #undef MAKE_ACCEPT
192 192
193 #define MAKE_CONVERSION(Name) \
194 RegExp##Name* RegExpTree::As##Name() { \
195 return NULL; \
196 }
197 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_CONVERSION)
198 #undef MAKE_CONVERSION
199
200 #define MAKE_CONVERSION(Name) \
201 RegExp##Name* RegExp##Name::As##Name() { \
202 return this; \
203 }
204 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_CONVERSION)
205 #undef MAKE_CONVERSION
193 206
194 RegExpEmpty RegExpEmpty::kInstance; 207 RegExpEmpty RegExpEmpty::kInstance;
195 208
196 209
197 // Convert regular expression trees to a simple sexp representation. 210 // Convert regular expression trees to a simple sexp representation.
198 // This representation should be different from the input grammar 211 // This representation should be different from the input grammar
199 // in as many cases as possible, to make it more difficult for incorrect 212 // in as many cases as possible, to make it more difficult for incorrect
200 // parses to look as correct ones which is likely if the input and 213 // parses to look as correct ones which is likely if the input and
201 // output formats are alike. 214 // output formats are alike.
202 class RegExpUnparser: public RegExpVisitor { 215 class RegExpUnparser: public RegExpVisitor {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 355
343 356
344 SmartPointer<char> RegExpTree::ToString() { 357 SmartPointer<char> RegExpTree::ToString() {
345 RegExpUnparser unparser; 358 RegExpUnparser unparser;
346 Accept(&unparser, NULL); 359 Accept(&unparser, NULL);
347 return unparser.ToString(); 360 return unparser.ToString();
348 } 361 }
349 362
350 363
351 } } // namespace v8::internal 364 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « regexp2000/src/ast.h ('k') | regexp2000/src/jsregexp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698