OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 Scanner::Location* dupe_loc, | 749 Scanner::Location* dupe_loc, |
750 bool* ok); | 750 bool* ok); |
751 | 751 |
752 // Temporary glue; these functions will move to ParserBase. | 752 // Temporary glue; these functions will move to ParserBase. |
753 Expression* ParseV8Intrinsic(bool* ok); | 753 Expression* ParseV8Intrinsic(bool* ok); |
754 FunctionLiteral* ParseFunctionLiteral( | 754 FunctionLiteral* ParseFunctionLiteral( |
755 const AstRawString* name, Scanner::Location function_name_location, | 755 const AstRawString* name, Scanner::Location function_name_location, |
756 bool name_is_strict_reserved, FunctionKind kind, | 756 bool name_is_strict_reserved, FunctionKind kind, |
757 int function_token_position, FunctionLiteral::FunctionType type, | 757 int function_token_position, FunctionLiteral::FunctionType type, |
758 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 758 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
759 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, | 759 V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count, |
760 int* materialized_literal_count, | |
761 int* expected_property_count, bool* ok); | 760 int* expected_property_count, bool* ok); |
762 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 761 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
763 const AstRawString* name, int pos, Variable* fvar, | 762 const AstRawString* name, int pos, Variable* fvar, |
764 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 763 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
765 | 764 |
766 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 765 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
767 Scanner::Location class_name_location, | 766 Scanner::Location class_name_location, |
768 bool name_is_strict_reserved, int pos, | 767 bool name_is_strict_reserved, int pos, |
769 bool* ok); | 768 bool* ok); |
770 | 769 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 988 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
990 | 989 |
991 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); | 990 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); |
992 | 991 |
993 // Factory methods. | 992 // Factory methods. |
994 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 993 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
995 int end_pos); | 994 int end_pos); |
996 | 995 |
997 // Skip over a lazy function, either using cached data if we have it, or | 996 // Skip over a lazy function, either using cached data if we have it, or |
998 // by parsing the function with PreParser. Consumes the ending }. | 997 // by parsing the function with PreParser. Consumes the ending }. |
999 void SkipLazyFunctionBody(const AstRawString* function_name, | 998 void SkipLazyFunctionBody(int* materialized_literal_count, |
1000 int* materialized_literal_count, | |
1001 int* expected_property_count, | 999 int* expected_property_count, |
1002 bool* ok); | 1000 bool* ok); |
1003 | 1001 |
1004 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 1002 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
1005 SingletonLogger* logger); | 1003 SingletonLogger* logger); |
1006 | 1004 |
1007 // Consumes the ending }. | 1005 // Consumes the ending }. |
1008 ZoneList<Statement*>* ParseEagerFunctionBody( | 1006 ZoneList<Statement*>* ParseEagerFunctionBody( |
1009 const AstRawString* function_name, int pos, Variable* fvar, | 1007 const AstRawString* function_name, int pos, Variable* fvar, |
1010 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 1008 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 FunctionKind kind) { | 1048 FunctionKind kind) { |
1051 return parser_->NewScope(parent_scope, scope_type, kind); | 1049 return parser_->NewScope(parent_scope, scope_type, kind); |
1052 } | 1050 } |
1053 | 1051 |
1054 | 1052 |
1055 const AstRawString* ParserTraits::EmptyIdentifierString() { | 1053 const AstRawString* ParserTraits::EmptyIdentifierString() { |
1056 return parser_->ast_value_factory()->empty_string(); | 1054 return parser_->ast_value_factory()->empty_string(); |
1057 } | 1055 } |
1058 | 1056 |
1059 | 1057 |
1060 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, | 1058 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, |
1061 int* materialized_literal_count, | |
1062 int* expected_property_count, | 1059 int* expected_property_count, |
1063 bool* ok) { | 1060 bool* ok) { |
1064 return parser_->SkipLazyFunctionBody( | 1061 return parser_->SkipLazyFunctionBody( |
1065 function_name, materialized_literal_count, expected_property_count, ok); | 1062 materialized_literal_count, expected_property_count, ok); |
1066 } | 1063 } |
1067 | 1064 |
1068 | 1065 |
1069 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( | 1066 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( |
1070 const AstRawString* name, int pos, Variable* fvar, | 1067 const AstRawString* name, int pos, Variable* fvar, |
1071 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { | 1068 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
1072 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, | 1069 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, |
1073 ok); | 1070 ok); |
1074 } | 1071 } |
1075 | 1072 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 } | 1121 } |
1125 | 1122 |
1126 | 1123 |
1127 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1124 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
1128 int start, Expression* tag) { | 1125 int start, Expression* tag) { |
1129 return parser_->CloseTemplateLiteral(state, start, tag); | 1126 return parser_->CloseTemplateLiteral(state, start, tag); |
1130 } | 1127 } |
1131 } } // namespace v8::internal | 1128 } } // namespace v8::internal |
1132 | 1129 |
1133 #endif // V8_PARSER_H_ | 1130 #endif // V8_PARSER_H_ |
OLD | NEW |