| 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" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 // type. Both arguments must be non-null (in the handle sense). | 485 // type. Both arguments must be non-null (in the handle sense). |
| 486 Expression* NewThrowTypeError(const char* type, const AstRawString* arg, | 486 Expression* NewThrowTypeError(const char* type, const AstRawString* arg, |
| 487 int pos); | 487 int pos); |
| 488 | 488 |
| 489 // Generic AST generator for throwing errors from compiled code. | 489 // Generic AST generator for throwing errors from compiled code. |
| 490 Expression* NewThrowError( | 490 Expression* NewThrowError( |
| 491 const AstRawString* constructor, const char* type, | 491 const AstRawString* constructor, const char* type, |
| 492 const AstRawString* arg, int pos); | 492 const AstRawString* arg, int pos); |
| 493 | 493 |
| 494 // Reporting errors. | 494 // Reporting errors. |
| 495 void ReportMessageAt(Scanner::Location source_location, | 495 void ReportMessageAt(Scanner::Location source_location, const char* message, |
| 496 const char* message, | |
| 497 const char* arg = NULL, | 496 const char* arg = NULL, |
| 498 bool is_reference_error = false); | 497 ParseErrorType error_type = kSyntaxError); |
| 499 void ReportMessage(const char* message, | 498 void ReportMessage(const char* message, const char* arg = NULL, |
| 500 const char* arg = NULL, | 499 ParseErrorType error_type = kSyntaxError); |
| 501 bool is_reference_error = false); | 500 void ReportMessage(const char* message, const AstRawString* arg, |
| 502 void ReportMessage(const char* message, | 501 ParseErrorType error_type = kSyntaxError); |
| 503 const AstRawString* arg, | 502 void ReportMessageAt(Scanner::Location source_location, const char* message, |
| 504 bool is_reference_error = false); | |
| 505 void ReportMessageAt(Scanner::Location source_location, | |
| 506 const char* message, | |
| 507 const AstRawString* arg, | 503 const AstRawString* arg, |
| 508 bool is_reference_error = false); | 504 ParseErrorType error_type = kSyntaxError); |
| 509 | 505 |
| 510 // "null" return type creators. | 506 // "null" return type creators. |
| 511 static const AstRawString* EmptyIdentifier() { | 507 static const AstRawString* EmptyIdentifier() { |
| 512 return NULL; | 508 return NULL; |
| 513 } | 509 } |
| 514 static Expression* EmptyExpression() { | 510 static Expression* EmptyExpression() { |
| 515 return NULL; | 511 return NULL; |
| 516 } | 512 } |
| 517 static Expression* EmptyArrowParamList() { return NULL; } | 513 static Expression* EmptyArrowParamList() { return NULL; } |
| 518 static Literal* EmptyLiteral() { | 514 static Literal* EmptyLiteral() { |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 ParseData* cached_parse_data_; | 842 ParseData* cached_parse_data_; |
| 847 | 843 |
| 848 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. | 844 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. |
| 849 | 845 |
| 850 // Pending errors. | 846 // Pending errors. |
| 851 bool has_pending_error_; | 847 bool has_pending_error_; |
| 852 Scanner::Location pending_error_location_; | 848 Scanner::Location pending_error_location_; |
| 853 const char* pending_error_message_; | 849 const char* pending_error_message_; |
| 854 const AstRawString* pending_error_arg_; | 850 const AstRawString* pending_error_arg_; |
| 855 const char* pending_error_char_arg_; | 851 const char* pending_error_char_arg_; |
| 856 bool pending_error_is_reference_error_; | 852 ParseErrorType pending_error_type_; |
| 857 | 853 |
| 858 // Other information which will be stored in Parser and moved to Isolate after | 854 // Other information which will be stored in Parser and moved to Isolate after |
| 859 // parsing. | 855 // parsing. |
| 860 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 856 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
| 861 int total_preparse_skipped_; | 857 int total_preparse_skipped_; |
| 862 HistogramTimer* pre_parse_timer_; | 858 HistogramTimer* pre_parse_timer_; |
| 863 | 859 |
| 864 bool parsing_on_main_thread_; | 860 bool parsing_on_main_thread_; |
| 865 }; | 861 }; |
| 866 | 862 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 } | 945 } |
| 950 | 946 |
| 951 | 947 |
| 952 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 948 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
| 953 int start, Expression* tag) { | 949 int start, Expression* tag) { |
| 954 return parser_->CloseTemplateLiteral(state, start, tag); | 950 return parser_->CloseTemplateLiteral(state, start, tag); |
| 955 } | 951 } |
| 956 } } // namespace v8::internal | 952 } } // namespace v8::internal |
| 957 | 953 |
| 958 #endif // V8_PARSER_H_ | 954 #endif // V8_PARSER_H_ |
| OLD | NEW |