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