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

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

Issue 8760: Experimental regexp: Use new RegExp parser to test syntax. (Closed)
Patch Set: Parses regexp using new parser. Rebased patch. 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.cc » ('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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 193
194 #define MAKE_CONVERSION(Name) \
195 RegExp##Name* RegExpTree::As##Name() { \
196 return NULL; \
197 }
198 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_CONVERSION)
199 #undef MAKE_CONVERSION
200
201
202 #define MAKE_CONVERSION(Name) \
203 RegExp##Name* RegExp##Name::As##Name() { \
204 return this; \
205 }
206 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_CONVERSION)
207 #undef MAKE_CONVERSION
208
209
210
194 RegExpEmpty RegExpEmpty::kInstance; 211 RegExpEmpty RegExpEmpty::kInstance;
195 212
196 213
197 // Convert regular expression trees to a simple sexp representation. 214 // Convert regular expression trees to a simple sexp representation.
198 // This representation should be different from the input grammar 215 // This representation should be different from the input grammar
199 // in as many cases as possible, to make it more difficult for incorrect 216 // 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 217 // parses to look as correct ones which is likely if the input and
201 // output formats are alike. 218 // output formats are alike.
202 class RegExpUnparser: public RegExpVisitor { 219 class RegExpUnparser: public RegExpVisitor {
203 public: 220 public:
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 359
343 360
344 SmartPointer<char> RegExpTree::ToString() { 361 SmartPointer<char> RegExpTree::ToString() {
345 RegExpUnparser unparser; 362 RegExpUnparser unparser;
346 Accept(&unparser, NULL); 363 Accept(&unparser, NULL);
347 return unparser.ToString(); 364 return unparser.ToString();
348 } 365 }
349 366
350 367
351 } } // namespace v8::internal 368 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « regexp2000/src/ast.h ('k') | regexp2000/src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698