OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 456 |
457 // "null" return type creators. | 457 // "null" return type creators. |
458 static Handle<String> EmptyIdentifier() { | 458 static Handle<String> EmptyIdentifier() { |
459 return Handle<String>(); | 459 return Handle<String>(); |
460 } | 460 } |
461 static Expression* EmptyExpression() { | 461 static Expression* EmptyExpression() { |
462 return NULL; | 462 return NULL; |
463 } | 463 } |
464 | 464 |
465 // Producing data during the recursive descent. | 465 // Producing data during the recursive descent. |
466 Handle<String> GetSymbol(); | 466 Handle<String> GetSymbol(Scanner* scanner = NULL); |
467 Handle<String> NextLiteralString(PretenureFlag tenured); | 467 Handle<String> NextLiteralString(Scanner* scanner, |
| 468 PretenureFlag tenured); |
| 469 Expression* ThisExpression(Scope* scope, |
| 470 AstNodeFactory<AstConstructionVisitor>* factory); |
| 471 Expression* ExpressionFromLiteral( |
| 472 Token::Value token, int pos, Scanner* scanner, |
| 473 AstNodeFactory<AstConstructionVisitor>* factory); |
| 474 Expression* ExpressionFromIdentifier( |
| 475 Handle<String> name, int pos, Scope* scope, |
| 476 AstNodeFactory<AstConstructionVisitor>* factory); |
| 477 Expression* ExpressionFromString( |
| 478 int pos, Scanner* scanner, |
| 479 AstNodeFactory<AstConstructionVisitor>* factory); |
| 480 |
| 481 // Temporary glue; these functions will move to ParserBase. |
| 482 Expression* ParseArrayLiteral(bool* ok); |
| 483 Expression* ParseObjectLiteral(bool* ok); |
| 484 Expression* ParseExpression(bool accept_IN, bool* ok); |
| 485 Expression* ParseV8Intrinsic(bool* ok); |
468 | 486 |
469 private: | 487 private: |
470 Parser* parser_; | 488 Parser* parser_; |
471 }; | 489 }; |
472 | 490 |
473 | 491 |
474 class Parser : public ParserBase<ParserTraits> { | 492 class Parser : public ParserBase<ParserTraits> { |
475 public: | 493 public: |
476 explicit Parser(CompilationInfo* info); | 494 explicit Parser(CompilationInfo* info); |
477 ~Parser() { | 495 ~Parser() { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); | 637 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); |
620 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); | 638 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); |
621 Expression* ParseUnaryExpression(bool* ok); | 639 Expression* ParseUnaryExpression(bool* ok); |
622 Expression* ParsePostfixExpression(bool* ok); | 640 Expression* ParsePostfixExpression(bool* ok); |
623 Expression* ParseLeftHandSideExpression(bool* ok); | 641 Expression* ParseLeftHandSideExpression(bool* ok); |
624 Expression* ParseNewExpression(bool* ok); | 642 Expression* ParseNewExpression(bool* ok); |
625 Expression* ParseMemberExpression(bool* ok); | 643 Expression* ParseMemberExpression(bool* ok); |
626 Expression* ParseNewPrefix(PositionStack* stack, bool* ok); | 644 Expression* ParseNewPrefix(PositionStack* stack, bool* ok); |
627 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack, | 645 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack, |
628 bool* ok); | 646 bool* ok); |
629 Expression* ParsePrimaryExpression(bool* ok); | |
630 Expression* ParseArrayLiteral(bool* ok); | 647 Expression* ParseArrayLiteral(bool* ok); |
631 Expression* ParseObjectLiteral(bool* ok); | 648 Expression* ParseObjectLiteral(bool* ok); |
632 | 649 |
633 // Initialize the components of a for-in / for-of statement. | 650 // Initialize the components of a for-in / for-of statement. |
634 void InitializeForEachStatement(ForEachStatement* stmt, | 651 void InitializeForEachStatement(ForEachStatement* stmt, |
635 Expression* each, | 652 Expression* each, |
636 Expression* subject, | 653 Expression* subject, |
637 Statement* body); | 654 Statement* body); |
638 | 655 |
639 ZoneList<Expression*>* ParseArguments(bool* ok); | 656 ZoneList<Expression*>* ParseArguments(bool* ok); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 SingletonLogger* logger); | 745 SingletonLogger* logger); |
729 | 746 |
730 Isolate* isolate_; | 747 Isolate* isolate_; |
731 ZoneList<Handle<String> > symbol_cache_; | 748 ZoneList<Handle<String> > symbol_cache_; |
732 | 749 |
733 Handle<Script> script_; | 750 Handle<Script> script_; |
734 Scanner scanner_; | 751 Scanner scanner_; |
735 PreParser* reusable_preparser_; | 752 PreParser* reusable_preparser_; |
736 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 753 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
737 Target* target_stack_; // for break, continue statements | 754 Target* target_stack_; // for break, continue statements |
738 v8::Extension* extension_; | |
739 ScriptDataImpl* pre_parse_data_; | 755 ScriptDataImpl* pre_parse_data_; |
740 FuncNameInferrer* fni_; | 756 FuncNameInferrer* fni_; |
741 | 757 |
742 Mode mode_; | 758 Mode mode_; |
743 | 759 |
744 Zone* zone_; | 760 Zone* zone_; |
745 CompilationInfo* info_; | 761 CompilationInfo* info_; |
746 }; | 762 }; |
747 | 763 |
748 | 764 |
(...skipping 21 matching lines...) Expand all Loading... |
770 private: | 786 private: |
771 static const int kLiteralTypeSlot = 0; | 787 static const int kLiteralTypeSlot = 0; |
772 static const int kElementsSlot = 1; | 788 static const int kElementsSlot = 1; |
773 | 789 |
774 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 790 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
775 }; | 791 }; |
776 | 792 |
777 } } // namespace v8::internal | 793 } } // namespace v8::internal |
778 | 794 |
779 #endif // V8_PARSER_H_ | 795 #endif // V8_PARSER_H_ |
OLD | NEW |