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

Side by Side Diff: src/ast.cc

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // Convert regular expression trees to a simple sexp representation. 210 // Convert regular expression trees to a simple sexp representation.
211 // This representation should be different from the input grammar 211 // This representation should be different from the input grammar
212 // 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
213 // 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
214 // output formats are alike. 214 // output formats are alike.
215 class RegExpUnparser: public RegExpVisitor { 215 class RegExpUnparser: public RegExpVisitor {
216 public: 216 public:
217 RegExpUnparser(); 217 RegExpUnparser();
218 void VisitCharacterRange(CharacterRange that); 218 void VisitCharacterRange(CharacterRange that);
219 SmartPointer<char> ToString() { return stream_.ToCString(); } 219 SmartPointer<const char> ToString() { return stream_.ToCString(); }
220 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, void* data); 220 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, void* data);
221 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_CASE) 221 FOR_EACH_REG_EXP_NODE_TYPE(MAKE_CASE)
222 #undef MAKE_CASE 222 #undef MAKE_CASE
223 private: 223 private:
224 StringStream* stream() { return &stream_; } 224 StringStream* stream() { return &stream_; }
225 HeapStringAllocator alloc_; 225 HeapStringAllocator alloc_;
226 StringStream stream_; 226 StringStream stream_;
227 }; 227 };
228 228
229 229
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 return NULL; 345 return NULL;
346 } 346 }
347 347
348 348
349 void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) { 349 void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) {
350 stream()->Put('%'); 350 stream()->Put('%');
351 return NULL; 351 return NULL;
352 } 352 }
353 353
354 354
355 SmartPointer<char> RegExpTree::ToString() { 355 SmartPointer<const char> RegExpTree::ToString() {
356 RegExpUnparser unparser; 356 RegExpUnparser unparser;
357 Accept(&unparser, NULL); 357 Accept(&unparser, NULL);
358 return unparser.ToString(); 358 return unparser.ToString();
359 } 359 }
360 360
361 361
362 } } // namespace v8::internal 362 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698