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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 Statement* ParseThrowStatement(bool* ok); | 629 Statement* ParseThrowStatement(bool* ok); |
630 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); | 630 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); |
631 TryStatement* ParseTryStatement(bool* ok); | 631 TryStatement* ParseTryStatement(bool* ok); |
632 DebuggerStatement* ParseDebuggerStatement(bool* ok); | 632 DebuggerStatement* ParseDebuggerStatement(bool* ok); |
633 | 633 |
634 // Support for hamony block scoped bindings. | 634 // Support for hamony block scoped bindings. |
635 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); | 635 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); |
636 | 636 |
637 Expression* ParseExpression(bool accept_IN, bool* ok); | 637 Expression* ParseExpression(bool accept_IN, bool* ok); |
638 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok); | 638 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok); |
639 Expression* ParseYieldExpression(bool* ok); | |
639 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); | 640 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); |
640 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); | 641 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); |
641 Expression* ParseUnaryExpression(bool* ok); | 642 Expression* ParseUnaryExpression(bool* ok); |
642 Expression* ParsePostfixExpression(bool* ok); | 643 Expression* ParsePostfixExpression(bool* ok); |
643 Expression* ParseLeftHandSideExpression(bool* ok); | 644 Expression* ParseLeftHandSideExpression(bool* ok); |
644 Expression* ParseNewExpression(bool* ok); | 645 Expression* ParseNewExpression(bool* ok); |
645 Expression* ParseMemberExpression(bool* ok); | 646 Expression* ParseMemberExpression(bool* ok); |
646 Expression* ParseNewPrefix(PositionStack* stack, bool* ok); | 647 Expression* ParseNewPrefix(PositionStack* stack, bool* ok); |
647 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack, | 648 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack, |
648 bool* ok); | 649 bool* ok); |
(...skipping 23 matching lines...) Expand all Loading... | |
672 // If the expression is a literal, return the literal value; | 673 // If the expression is a literal, return the literal value; |
673 // if the expression is a materialized literal and is simple return a | 674 // if the expression is a materialized literal and is simple return a |
674 // compile time value as encoded by CompileTimeValue::GetValue(). | 675 // compile time value as encoded by CompileTimeValue::GetValue(). |
675 // Otherwise, return undefined literal as the placeholder | 676 // Otherwise, return undefined literal as the placeholder |
676 // in the object literal boilerplate. | 677 // in the object literal boilerplate. |
677 Handle<Object> GetBoilerplateValue(Expression* expression); | 678 Handle<Object> GetBoilerplateValue(Expression* expression); |
678 | 679 |
679 ZoneList<Expression*>* ParseArguments(bool* ok); | 680 ZoneList<Expression*>* ParseArguments(bool* ok); |
680 FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name, | 681 FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name, |
681 bool name_is_reserved, | 682 bool name_is_reserved, |
683 bool is_generator, | |
682 int function_token_position, | 684 int function_token_position, |
683 FunctionLiteral::Type type, | 685 FunctionLiteral::Type type, |
684 bool* ok); | 686 bool* ok); |
685 | 687 |
686 | 688 |
687 // Magical syntax support. | 689 // Magical syntax support. |
688 Expression* ParseV8Intrinsic(bool* ok); | 690 Expression* ParseV8Intrinsic(bool* ok); |
689 | 691 |
690 INLINE(Token::Value peek()) { | 692 INLINE(Token::Value peek()) { |
691 if (stack_overflow_) return Token::ILLEGAL; | 693 if (stack_overflow_) return Token::ILLEGAL; |
692 return scanner().peek(); | 694 return scanner().peek(); |
693 } | 695 } |
694 | 696 |
695 INLINE(Token::Value Next()) { | 697 INLINE(Token::Value Next()) { |
696 // BUG 1215673: Find a thread safe way to set a stack limit in | 698 // BUG 1215673: Find a thread safe way to set a stack limit in |
697 // pre-parse mode. Otherwise, we cannot safely pre-parse from other | 699 // pre-parse mode. Otherwise, we cannot safely pre-parse from other |
698 // threads. | 700 // threads. |
699 if (stack_overflow_) { | 701 if (stack_overflow_) { |
700 return Token::ILLEGAL; | 702 return Token::ILLEGAL; |
701 } | 703 } |
702 if (StackLimitCheck(isolate()).HasOverflowed()) { | 704 if (StackLimitCheck(isolate()).HasOverflowed()) { |
703 // Any further calls to Next or peek will return the illegal token. | 705 // Any further calls to Next or peek will return the illegal token. |
704 // The current call must return the next token, which might already | 706 // The current call must return the next token, which might already |
705 // have been peek'ed. | 707 // have been peek'ed. |
706 stack_overflow_ = true; | 708 stack_overflow_ = true; |
707 } | 709 } |
708 return scanner().Next(); | 710 return scanner().Next(); |
709 } | 711 } |
710 | 712 |
713 bool inside_generator() const { return top_scope_->inside_generator(); } | |
Michael Starzinger
2013/03/14 22:29:24
See comment in ParseIdentifier(), I think we shoul
| |
714 | |
711 bool peek_any_identifier(); | 715 bool peek_any_identifier(); |
712 | 716 |
713 INLINE(void Consume(Token::Value token)); | 717 INLINE(void Consume(Token::Value token)); |
714 void Expect(Token::Value token, bool* ok); | 718 void Expect(Token::Value token, bool* ok); |
715 bool Check(Token::Value token); | 719 bool Check(Token::Value token); |
716 void ExpectSemicolon(bool* ok); | 720 void ExpectSemicolon(bool* ok); |
717 void ExpectContextualKeyword(const char* keyword, bool* ok); | 721 void ExpectContextualKeyword(const char* keyword, bool* ok); |
718 | 722 |
719 Handle<String> LiteralString(PretenureFlag tenured) { | 723 Handle<String> LiteralString(PretenureFlag tenured) { |
720 if (scanner().is_literal_ascii()) { | 724 if (scanner().is_literal_ascii()) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
877 private: | 881 private: |
878 static const int kTypeSlot = 0; | 882 static const int kTypeSlot = 0; |
879 static const int kElementsSlot = 1; | 883 static const int kElementsSlot = 1; |
880 | 884 |
881 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 885 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
882 }; | 886 }; |
883 | 887 |
884 } } // namespace v8::internal | 888 } } // namespace v8::internal |
885 | 889 |
886 #endif // V8_PARSER_H_ | 890 #endif // V8_PARSER_H_ |
OLD | NEW |