| OLD | NEW |
| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 StringStream stream_; | 226 StringStream stream_; |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 | 229 |
| 230 RegExpUnparser::RegExpUnparser() : stream_(&alloc_) { | 230 RegExpUnparser::RegExpUnparser() : stream_(&alloc_) { |
| 231 } | 231 } |
| 232 | 232 |
| 233 | 233 |
| 234 void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { | 234 void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { |
| 235 stream()->Add("(|"); | 235 stream()->Add("(|"); |
| 236 for (int i = 0; i < that->nodes()->length(); i++) { | 236 for (int i = 0; i < that->alternatives()->length(); i++) { |
| 237 stream()->Add(" "); | 237 stream()->Add(" "); |
| 238 that->nodes()->at(i)->Accept(this, data); | 238 that->alternatives()->at(i)->Accept(this, data); |
| 239 } | 239 } |
| 240 stream()->Add(")"); | 240 stream()->Add(")"); |
| 241 return NULL; | 241 return NULL; |
| 242 } | 242 } |
| 243 | 243 |
| 244 | 244 |
| 245 void* RegExpUnparser::VisitAlternative(RegExpAlternative* that, void* data) { | 245 void* RegExpUnparser::VisitAlternative(RegExpAlternative* that, void* data) { |
| 246 stream()->Add("(:"); | 246 stream()->Add("(:"); |
| 247 for (int i = 0; i < that->nodes()->length(); i++) { | 247 for (int i = 0; i < that->nodes()->length(); i++) { |
| 248 stream()->Add(" "); | 248 stream()->Add(" "); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 | 354 |
| 355 SmartPointer<const 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 |
| OLD | NEW |