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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 void* RegExpUnparser::VisitLookahead(RegExpLookahead* that, void* data) { | 322 void* RegExpUnparser::VisitLookahead(RegExpLookahead* that, void* data) { |
323 stream()->Add("(-> "); | 323 stream()->Add("(-> "); |
324 stream()->Add(that->is_positive() ? "+ " : "- "); | 324 stream()->Add(that->is_positive() ? "+ " : "- "); |
325 that->body()->Accept(this, data); | 325 that->body()->Accept(this, data); |
326 stream()->Add(")"); | 326 stream()->Add(")"); |
327 return NULL; | 327 return NULL; |
328 } | 328 } |
329 | 329 |
330 | 330 |
| 331 void* RegExpUnparser::VisitBackreference(RegExpBackreference* that, |
| 332 void* data) { |
| 333 stream()->Add("(<- %i)", that->index()); |
| 334 return NULL; |
| 335 } |
| 336 |
| 337 |
331 void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) { | 338 void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) { |
332 stream()->Put('%'); | 339 stream()->Put('%'); |
333 return NULL; | 340 return NULL; |
334 } | 341 } |
335 | 342 |
336 | 343 |
337 SmartPointer<char> RegExpTree::ToString() { | 344 SmartPointer<char> RegExpTree::ToString() { |
338 RegExpUnparser unparser; | 345 RegExpUnparser unparser; |
339 Accept(&unparser, NULL); | 346 Accept(&unparser, NULL); |
340 return unparser.ToString(); | 347 return unparser.ToString(); |
341 } | 348 } |
342 | 349 |
343 | 350 |
344 } } // namespace v8::internal | 351 } } // namespace v8::internal |
OLD | NEW |