| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void AddAtom(RegExpTree* tree); | 273 void AddAtom(RegExpTree* tree); |
| 274 void AddAssertion(RegExpTree* tree); | 274 void AddAssertion(RegExpTree* tree); |
| 275 void NewAlternative(); // '|' | 275 void NewAlternative(); // '|' |
| 276 void AddQuantifierToAtom(int min, int max, RegExpQuantifier::Type type); | 276 void AddQuantifierToAtom(int min, int max, RegExpQuantifier::Type type); |
| 277 RegExpTree* ToRegExp(); | 277 RegExpTree* ToRegExp(); |
| 278 | 278 |
| 279 private: | 279 private: |
| 280 void FlushCharacters(); | 280 void FlushCharacters(); |
| 281 void FlushText(); | 281 void FlushText(); |
| 282 void FlushTerms(); | 282 void FlushTerms(); |
| 283 Zone* zone() { return zone_; } |
| 284 |
| 285 Zone* zone_; |
| 283 bool pending_empty_; | 286 bool pending_empty_; |
| 284 ZoneList<uc16>* characters_; | 287 ZoneList<uc16>* characters_; |
| 285 BufferedZoneList<RegExpTree, 2> terms_; | 288 BufferedZoneList<RegExpTree, 2> terms_; |
| 286 BufferedZoneList<RegExpTree, 2> text_; | 289 BufferedZoneList<RegExpTree, 2> text_; |
| 287 BufferedZoneList<RegExpTree, 2> alternatives_; | 290 BufferedZoneList<RegExpTree, 2> alternatives_; |
| 288 #ifdef DEBUG | 291 #ifdef DEBUG |
| 289 enum {ADD_NONE, ADD_CHAR, ADD_TERM, ADD_ASSERT, ADD_ATOM} last_added_; | 292 enum {ADD_NONE, ADD_CHAR, ADD_TERM, ADD_ASSERT, ADD_ATOM} last_added_; |
| 290 #define LAST(x) last_added_ = x; | 293 #define LAST(x) last_added_ = x; |
| 291 #else | 294 #else |
| 292 #define LAST(x) | 295 #define LAST(x) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 RegExpParserState* previous_state_; | 385 RegExpParserState* previous_state_; |
| 383 // Builder for the stored disjunction. | 386 // Builder for the stored disjunction. |
| 384 RegExpBuilder* builder_; | 387 RegExpBuilder* builder_; |
| 385 // Stored disjunction type (capture, look-ahead or grouping), if any. | 388 // Stored disjunction type (capture, look-ahead or grouping), if any. |
| 386 SubexpressionType group_type_; | 389 SubexpressionType group_type_; |
| 387 // Stored disjunction's capture index (if any). | 390 // Stored disjunction's capture index (if any). |
| 388 int disjunction_capture_index_; | 391 int disjunction_capture_index_; |
| 389 }; | 392 }; |
| 390 | 393 |
| 391 Isolate* isolate() { return isolate_; } | 394 Isolate* isolate() { return isolate_; } |
| 395 Zone* zone() { return isolate_->zone(); } |
| 392 | 396 |
| 393 uc32 current() { return current_; } | 397 uc32 current() { return current_; } |
| 394 bool has_more() { return has_more_; } | 398 bool has_more() { return has_more_; } |
| 395 bool has_next() { return next_pos_ < in()->length(); } | 399 bool has_next() { return next_pos_ < in()->length(); } |
| 396 uc32 Next(); | 400 uc32 Next(); |
| 397 FlatStringReader* in() { return in_; } | 401 FlatStringReader* in() { return in_; } |
| 398 void ScanForCaptures(); | 402 void ScanForCaptures(); |
| 399 | 403 |
| 400 Isolate* isolate_; | 404 Isolate* isolate_; |
| 401 Handle<String>* error_; | 405 Handle<String>* error_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 static const int kMaxNumFunctionParameters = 32766; | 450 static const int kMaxNumFunctionParameters = 32766; |
| 447 FunctionLiteral* ParseLazy(CompilationInfo* info, | 451 FunctionLiteral* ParseLazy(CompilationInfo* info, |
| 448 UC16CharacterStream* source, | 452 UC16CharacterStream* source, |
| 449 ZoneScope* zone_scope); | 453 ZoneScope* zone_scope); |
| 450 enum Mode { | 454 enum Mode { |
| 451 PARSE_LAZILY, | 455 PARSE_LAZILY, |
| 452 PARSE_EAGERLY | 456 PARSE_EAGERLY |
| 453 }; | 457 }; |
| 454 | 458 |
| 455 Isolate* isolate() { return isolate_; } | 459 Isolate* isolate() { return isolate_; } |
| 460 Zone* zone() { return isolate_->zone(); } |
| 456 | 461 |
| 457 // Called by ParseProgram after setting up the scanner. | 462 // Called by ParseProgram after setting up the scanner. |
| 458 FunctionLiteral* DoParseProgram(Handle<String> source, | 463 FunctionLiteral* DoParseProgram(Handle<String> source, |
| 459 bool in_global_context, | 464 bool in_global_context, |
| 460 StrictModeFlag strict_mode, | 465 StrictModeFlag strict_mode, |
| 461 ZoneScope* zone_scope); | 466 ZoneScope* zone_scope); |
| 462 | 467 |
| 463 // Report syntax error | 468 // Report syntax error |
| 464 void ReportUnexpectedToken(Token::Value token); | 469 void ReportUnexpectedToken(Token::Value token); |
| 465 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 470 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 // Converts the currently parsed literal to a JavaScript String. | 814 // Converts the currently parsed literal to a JavaScript String. |
| 810 Handle<String> GetString(); | 815 Handle<String> GetString(); |
| 811 | 816 |
| 812 Isolate* isolate_; | 817 Isolate* isolate_; |
| 813 JsonScanner scanner_; | 818 JsonScanner scanner_; |
| 814 bool stack_overflow_; | 819 bool stack_overflow_; |
| 815 }; | 820 }; |
| 816 } } // namespace v8::internal | 821 } } // namespace v8::internal |
| 817 | 822 |
| 818 #endif // V8_PARSER_H_ | 823 #endif // V8_PARSER_H_ |
| OLD | NEW |