Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: src/parser.h

Issue 13179002: Add parser support for generators. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: added additional syntax tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 Statement* ParseThrowStatement(bool* ok); 624 Statement* ParseThrowStatement(bool* ok);
625 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); 625 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value);
626 TryStatement* ParseTryStatement(bool* ok); 626 TryStatement* ParseTryStatement(bool* ok);
627 DebuggerStatement* ParseDebuggerStatement(bool* ok); 627 DebuggerStatement* ParseDebuggerStatement(bool* ok);
628 628
629 // Support for hamony block scoped bindings. 629 // Support for hamony block scoped bindings.
630 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); 630 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok);
631 631
632 Expression* ParseExpression(bool accept_IN, bool* ok); 632 Expression* ParseExpression(bool accept_IN, bool* ok);
633 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok); 633 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok);
634 Expression* ParseYieldExpression(bool* ok);
634 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); 635 Expression* ParseConditionalExpression(bool accept_IN, bool* ok);
635 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); 636 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok);
636 Expression* ParseUnaryExpression(bool* ok); 637 Expression* ParseUnaryExpression(bool* ok);
637 Expression* ParsePostfixExpression(bool* ok); 638 Expression* ParsePostfixExpression(bool* ok);
638 Expression* ParseLeftHandSideExpression(bool* ok); 639 Expression* ParseLeftHandSideExpression(bool* ok);
639 Expression* ParseNewExpression(bool* ok); 640 Expression* ParseNewExpression(bool* ok);
640 Expression* ParseMemberExpression(bool* ok); 641 Expression* ParseMemberExpression(bool* ok);
641 Expression* ParseNewPrefix(PositionStack* stack, bool* ok); 642 Expression* ParseNewPrefix(PositionStack* stack, bool* ok);
642 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack, 643 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack,
643 bool* ok); 644 bool* ok);
(...skipping 23 matching lines...) Expand all
667 // If the expression is a literal, return the literal value; 668 // If the expression is a literal, return the literal value;
668 // if the expression is a materialized literal and is simple return a 669 // if the expression is a materialized literal and is simple return a
669 // compile time value as encoded by CompileTimeValue::GetValue(). 670 // compile time value as encoded by CompileTimeValue::GetValue().
670 // Otherwise, return undefined literal as the placeholder 671 // Otherwise, return undefined literal as the placeholder
671 // in the object literal boilerplate. 672 // in the object literal boilerplate.
672 Handle<Object> GetBoilerplateValue(Expression* expression); 673 Handle<Object> GetBoilerplateValue(Expression* expression);
673 674
674 ZoneList<Expression*>* ParseArguments(bool* ok); 675 ZoneList<Expression*>* ParseArguments(bool* ok);
675 FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name, 676 FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name,
676 bool name_is_reserved, 677 bool name_is_reserved,
678 bool is_generator,
677 int function_token_position, 679 int function_token_position,
678 FunctionLiteral::Type type, 680 FunctionLiteral::Type type,
679 bool* ok); 681 bool* ok);
680 682
681 683
682 // Magical syntax support. 684 // Magical syntax support.
683 Expression* ParseV8Intrinsic(bool* ok); 685 Expression* ParseV8Intrinsic(bool* ok);
684 686
685 INLINE(Token::Value peek()) { 687 INLINE(Token::Value peek()) {
686 if (stack_overflow_) return Token::ILLEGAL; 688 if (stack_overflow_) return Token::ILLEGAL;
687 return scanner().peek(); 689 return scanner().peek();
688 } 690 }
689 691
690 INLINE(Token::Value Next()) { 692 INLINE(Token::Value Next()) {
691 // BUG 1215673: Find a thread safe way to set a stack limit in 693 // BUG 1215673: Find a thread safe way to set a stack limit in
692 // pre-parse mode. Otherwise, we cannot safely pre-parse from other 694 // pre-parse mode. Otherwise, we cannot safely pre-parse from other
693 // threads. 695 // threads.
694 if (stack_overflow_) { 696 if (stack_overflow_) {
695 return Token::ILLEGAL; 697 return Token::ILLEGAL;
696 } 698 }
697 if (StackLimitCheck(isolate()).HasOverflowed()) { 699 if (StackLimitCheck(isolate()).HasOverflowed()) {
698 // Any further calls to Next or peek will return the illegal token. 700 // Any further calls to Next or peek will return the illegal token.
699 // The current call must return the next token, which might already 701 // The current call must return the next token, which might already
700 // have been peek'ed. 702 // have been peek'ed.
701 stack_overflow_ = true; 703 stack_overflow_ = true;
702 } 704 }
703 return scanner().Next(); 705 return scanner().Next();
704 } 706 }
705 707
708 bool inside_generator() const { return top_scope_->inside_generator(); }
709
706 bool peek_any_identifier(); 710 bool peek_any_identifier();
707 711
708 INLINE(void Consume(Token::Value token)); 712 INLINE(void Consume(Token::Value token));
709 void Expect(Token::Value token, bool* ok); 713 void Expect(Token::Value token, bool* ok);
710 bool Check(Token::Value token); 714 bool Check(Token::Value token);
711 void ExpectSemicolon(bool* ok); 715 void ExpectSemicolon(bool* ok);
712 void ExpectContextualKeyword(const char* keyword, bool* ok); 716 void ExpectContextualKeyword(const char* keyword, bool* ok);
713 717
714 Handle<String> LiteralString(PretenureFlag tenured) { 718 Handle<String> LiteralString(PretenureFlag tenured) {
715 if (scanner().is_literal_ascii()) { 719 if (scanner().is_literal_ascii()) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 private: 876 private:
873 static const int kTypeSlot = 0; 877 static const int kTypeSlot = 0;
874 static const int kElementsSlot = 1; 878 static const int kElementsSlot = 1;
875 879
876 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 880 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
877 }; 881 };
878 882
879 } } // namespace v8::internal 883 } } // namespace v8::internal
880 884
881 #endif // V8_PARSER_H_ 885 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698