| 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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
| 6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 extension_(extension), | 74 extension_(extension), |
| 75 fni_(NULL), | 75 fni_(NULL), |
| 76 log_(log), | 76 log_(log), |
| 77 mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. | 77 mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. |
| 78 scanner_(scanner), | 78 scanner_(scanner), |
| 79 stack_limit_(stack_limit), | 79 stack_limit_(stack_limit), |
| 80 stack_overflow_(false), | 80 stack_overflow_(false), |
| 81 allow_lazy_(false), | 81 allow_lazy_(false), |
| 82 allow_natives_syntax_(false), | 82 allow_natives_syntax_(false), |
| 83 allow_generators_(false), | 83 allow_generators_(false), |
| 84 allow_for_of_(false), | |
| 85 allow_arrow_functions_(false), | 84 allow_arrow_functions_(false), |
| 86 zone_(zone) {} | 85 zone_(zone) {} |
| 87 | 86 |
| 88 // Getters that indicate whether certain syntactical constructs are | 87 // Getters that indicate whether certain syntactical constructs are |
| 89 // allowed to be parsed by this instance of the parser. | 88 // allowed to be parsed by this instance of the parser. |
| 90 bool allow_lazy() const { return allow_lazy_; } | 89 bool allow_lazy() const { return allow_lazy_; } |
| 91 bool allow_natives_syntax() const { return allow_natives_syntax_; } | 90 bool allow_natives_syntax() const { return allow_natives_syntax_; } |
| 92 bool allow_generators() const { return allow_generators_; } | 91 bool allow_generators() const { return allow_generators_; } |
| 93 bool allow_for_of() const { return allow_for_of_; } | |
| 94 bool allow_arrow_functions() const { return allow_arrow_functions_; } | 92 bool allow_arrow_functions() const { return allow_arrow_functions_; } |
| 95 bool allow_modules() const { return scanner()->HarmonyModules(); } | 93 bool allow_modules() const { return scanner()->HarmonyModules(); } |
| 96 bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); } | 94 bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); } |
| 97 bool allow_harmony_numeric_literals() const { | 95 bool allow_harmony_numeric_literals() const { |
| 98 return scanner()->HarmonyNumericLiterals(); | 96 return scanner()->HarmonyNumericLiterals(); |
| 99 } | 97 } |
| 100 | 98 |
| 101 // Setters that determine whether certain syntactical constructs are | 99 // Setters that determine whether certain syntactical constructs are |
| 102 // allowed to be parsed by this instance of the parser. | 100 // allowed to be parsed by this instance of the parser. |
| 103 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } | 101 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
| 104 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } | 102 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } |
| 105 void set_allow_generators(bool allow) { allow_generators_ = allow; } | 103 void set_allow_generators(bool allow) { allow_generators_ = allow; } |
| 106 void set_allow_for_of(bool allow) { allow_for_of_ = allow; } | |
| 107 void set_allow_arrow_functions(bool allow) { allow_arrow_functions_ = allow; } | 104 void set_allow_arrow_functions(bool allow) { allow_arrow_functions_ = allow; } |
| 108 void set_allow_modules(bool allow) { scanner()->SetHarmonyModules(allow); } | 105 void set_allow_modules(bool allow) { scanner()->SetHarmonyModules(allow); } |
| 109 void set_allow_harmony_scoping(bool allow) { | 106 void set_allow_harmony_scoping(bool allow) { |
| 110 scanner()->SetHarmonyScoping(allow); | 107 scanner()->SetHarmonyScoping(allow); |
| 111 } | 108 } |
| 112 void set_allow_harmony_numeric_literals(bool allow) { | 109 void set_allow_harmony_numeric_literals(bool allow) { |
| 113 scanner()->SetHarmonyNumericLiterals(allow); | 110 scanner()->SetHarmonyNumericLiterals(allow); |
| 114 } | 111 } |
| 115 | 112 |
| 116 protected: | 113 protected: |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 Mode mode_; | 560 Mode mode_; |
| 564 | 561 |
| 565 private: | 562 private: |
| 566 Scanner* scanner_; | 563 Scanner* scanner_; |
| 567 uintptr_t stack_limit_; | 564 uintptr_t stack_limit_; |
| 568 bool stack_overflow_; | 565 bool stack_overflow_; |
| 569 | 566 |
| 570 bool allow_lazy_; | 567 bool allow_lazy_; |
| 571 bool allow_natives_syntax_; | 568 bool allow_natives_syntax_; |
| 572 bool allow_generators_; | 569 bool allow_generators_; |
| 573 bool allow_for_of_; | |
| 574 bool allow_arrow_functions_; | 570 bool allow_arrow_functions_; |
| 575 | 571 |
| 576 typename Traits::Type::Zone* zone_; // Only used by Parser. | 572 typename Traits::Type::Zone* zone_; // Only used by Parser. |
| 577 }; | 573 }; |
| 578 | 574 |
| 579 | 575 |
| 580 class PreParserIdentifier { | 576 class PreParserIdentifier { |
| 581 public: | 577 public: |
| 582 PreParserIdentifier() : type_(kUnknownIdentifier) {} | 578 PreParserIdentifier() : type_(kUnknownIdentifier) {} |
| 583 static PreParserIdentifier Default() { | 579 static PreParserIdentifier Default() { |
| (...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 parser()->ReportMessage("accessor_get_set"); | 2654 parser()->ReportMessage("accessor_get_set"); |
| 2659 } | 2655 } |
| 2660 *ok = false; | 2656 *ok = false; |
| 2661 } | 2657 } |
| 2662 } | 2658 } |
| 2663 | 2659 |
| 2664 | 2660 |
| 2665 } } // v8::internal | 2661 } } // v8::internal |
| 2666 | 2662 |
| 2667 #endif // V8_PREPARSER_H | 2663 #endif // V8_PREPARSER_H |
| OLD | NEW |