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_PARSING_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/parsing/parser-base.h" | 9 #include "src/parsing/parser-base.h" |
10 | 10 |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 typedef PreParserExpression Expression; | 831 typedef PreParserExpression Expression; |
832 typedef PreParserStatement Statement; | 832 typedef PreParserStatement Statement; |
833 | 833 |
834 enum PreParseResult { | 834 enum PreParseResult { |
835 kPreParseStackOverflow, | 835 kPreParseStackOverflow, |
836 kPreParseAbort, | 836 kPreParseAbort, |
837 kPreParseSuccess | 837 kPreParseSuccess |
838 }; | 838 }; |
839 | 839 |
840 PreParser(Zone* zone, Scanner* scanner, AstValueFactory* ast_value_factory, | 840 PreParser(Zone* zone, Scanner* scanner, AstValueFactory* ast_value_factory, |
841 uintptr_t stack_limit) | 841 RuntimeCallStats* runtime_call_stats, uintptr_t stack_limit) |
842 : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, | 842 : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, |
843 ast_value_factory), | 843 ast_value_factory, runtime_call_stats), |
844 use_counts_(nullptr), | 844 use_counts_(nullptr), |
845 track_unresolved_variables_(false) {} | 845 track_unresolved_variables_(false) {} |
846 | 846 |
| 847 static bool const IsPreParser() { return true; } |
| 848 |
847 PreParserLogger* logger() { return &log_; } | 849 PreParserLogger* logger() { return &log_; } |
848 | 850 |
849 // Pre-parse the program from the character stream; returns true on | 851 // Pre-parse the program from the character stream; returns true on |
850 // success (even if parsing failed, the pre-parse data successfully | 852 // success (even if parsing failed, the pre-parse data successfully |
851 // captured the syntax error), and false if a stack-overflow happened | 853 // captured the syntax error), and false if a stack-overflow happened |
852 // during parsing. | 854 // during parsing. |
853 PreParseResult PreParseProgram(int* materialized_literals = 0, | 855 PreParseResult PreParseProgram(int* materialized_literals = 0, |
854 bool is_module = false) { | 856 bool is_module = false) { |
855 DCHECK_NULL(scope_state_); | 857 DCHECK_NULL(scope_state_); |
856 DeclarationScope* scope = NewScriptScope(); | 858 DeclarationScope* scope = NewScriptScope(); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 function_state_->NextMaterializedLiteralIndex(); | 1552 function_state_->NextMaterializedLiteralIndex(); |
1551 function_state_->NextMaterializedLiteralIndex(); | 1553 function_state_->NextMaterializedLiteralIndex(); |
1552 } | 1554 } |
1553 return EmptyExpression(); | 1555 return EmptyExpression(); |
1554 } | 1556 } |
1555 | 1557 |
1556 } // namespace internal | 1558 } // namespace internal |
1557 } // namespace v8 | 1559 } // namespace v8 |
1558 | 1560 |
1559 #endif // V8_PARSING_PREPARSER_H | 1561 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |