| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(" "); |
| 249 that->nodes()->at(i)->Accept(this, data); | 249 that->nodes()->at(i)->Accept(this, data); |
| 250 } | 250 } |
| 251 stream()->Add(")"); | 251 stream()->Add(")"); |
| 252 return NULL; | 252 return NULL; |
| 253 } | 253 } |
| 254 | 254 |
| 255 | 255 |
| 256 void RegExpUnparser::VisitCharacterRange(CharacterRange that) { | 256 void RegExpUnparser::VisitCharacterRange(CharacterRange that) { |
| 257 if (that.is_character_class()) { | 257 if (that.IsSingleton()) { |
| 258 stream()->Add("&%c", that.from()); | |
| 259 } else if (that.IsSingleton()) { | |
| 260 stream()->Add("%c", that.from()); | 258 stream()->Add("%c", that.from()); |
| 261 } else { | 259 } else { |
| 262 stream()->Add("%c-%c", that.from(), that.to()); | 260 stream()->Add("%c-%c", that.from(), that.to()); |
| 263 } | 261 } |
| 264 } | 262 } |
| 265 | 263 |
| 266 | 264 |
| 267 | 265 |
| 268 void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that, | 266 void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that, |
| 269 void* data) { | 267 void* data) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 353 |
| 356 | 354 |
| 357 SmartPointer<char> RegExpTree::ToString() { | 355 SmartPointer<char> RegExpTree::ToString() { |
| 358 RegExpUnparser unparser; | 356 RegExpUnparser unparser; |
| 359 Accept(&unparser, NULL); | 357 Accept(&unparser, NULL); |
| 360 return unparser.ToString(); | 358 return unparser.ToString(); |
| 361 } | 359 } |
| 362 | 360 |
| 363 | 361 |
| 364 } } // namespace v8::internal | 362 } } // namespace v8::internal |
| OLD | NEW |