| 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/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 stack_limit_(stack_limit), | 82 stack_limit_(stack_limit), |
| 83 isolate_(isolate), | 83 isolate_(isolate), |
| 84 zone_(zone), | 84 zone_(zone), |
| 85 scanner_(scanner), | 85 scanner_(scanner), |
| 86 stack_overflow_(false), | 86 stack_overflow_(false), |
| 87 allow_lazy_(false), | 87 allow_lazy_(false), |
| 88 allow_natives_(false), | 88 allow_natives_(false), |
| 89 allow_harmony_arrow_functions_(false), | 89 allow_harmony_arrow_functions_(false), |
| 90 allow_harmony_object_literals_(false), | 90 allow_harmony_object_literals_(false), |
| 91 allow_harmony_sloppy_(false), | 91 allow_harmony_sloppy_(false), |
| 92 allow_harmony_computed_property_names_(false) {} | 92 allow_harmony_computed_property_names_(false), |
| 93 allow_harmony_rest_params_(false) {} |
| 93 | 94 |
| 94 // Getters that indicate whether certain syntactical constructs are | 95 // Getters that indicate whether certain syntactical constructs are |
| 95 // allowed to be parsed by this instance of the parser. | 96 // allowed to be parsed by this instance of the parser. |
| 96 bool allow_lazy() const { return allow_lazy_; } | 97 bool allow_lazy() const { return allow_lazy_; } |
| 97 bool allow_natives() const { return allow_natives_; } | 98 bool allow_natives() const { return allow_natives_; } |
| 98 bool allow_harmony_arrow_functions() const { | 99 bool allow_harmony_arrow_functions() const { |
| 99 return allow_harmony_arrow_functions_; | 100 return allow_harmony_arrow_functions_; |
| 100 } | 101 } |
| 101 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } | 102 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } |
| 102 bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); } | 103 bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); } |
| 103 bool allow_harmony_numeric_literals() const { | 104 bool allow_harmony_numeric_literals() const { |
| 104 return scanner()->HarmonyNumericLiterals(); | 105 return scanner()->HarmonyNumericLiterals(); |
| 105 } | 106 } |
| 106 bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } | 107 bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } |
| 107 bool allow_harmony_object_literals() const { | 108 bool allow_harmony_object_literals() const { |
| 108 return allow_harmony_object_literals_; | 109 return allow_harmony_object_literals_; |
| 109 } | 110 } |
| 110 bool allow_harmony_templates() const { return scanner()->HarmonyTemplates(); } | 111 bool allow_harmony_templates() const { return scanner()->HarmonyTemplates(); } |
| 111 bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; } | 112 bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; } |
| 112 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } | 113 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } |
| 113 bool allow_harmony_computed_property_names() const { | 114 bool allow_harmony_computed_property_names() const { |
| 114 return allow_harmony_computed_property_names_; | 115 return allow_harmony_computed_property_names_; |
| 115 } | 116 } |
| 117 bool allow_harmony_rest_params() const { |
| 118 return allow_harmony_rest_params_; |
| 119 } |
| 116 | 120 |
| 117 // Setters that determine whether certain syntactical constructs are | 121 // Setters that determine whether certain syntactical constructs are |
| 118 // allowed to be parsed by this instance of the parser. | 122 // allowed to be parsed by this instance of the parser. |
| 119 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } | 123 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
| 120 void set_allow_natives(bool allow) { allow_natives_ = allow; } | 124 void set_allow_natives(bool allow) { allow_natives_ = allow; } |
| 121 void set_allow_harmony_arrow_functions(bool allow) { | 125 void set_allow_harmony_arrow_functions(bool allow) { |
| 122 allow_harmony_arrow_functions_ = allow; | 126 allow_harmony_arrow_functions_ = allow; |
| 123 } | 127 } |
| 124 void set_allow_harmony_modules(bool allow) { | 128 void set_allow_harmony_modules(bool allow) { |
| 125 scanner()->SetHarmonyModules(allow); | 129 scanner()->SetHarmonyModules(allow); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 141 } | 145 } |
| 142 void set_allow_harmony_sloppy(bool allow) { | 146 void set_allow_harmony_sloppy(bool allow) { |
| 143 allow_harmony_sloppy_ = allow; | 147 allow_harmony_sloppy_ = allow; |
| 144 } | 148 } |
| 145 void set_allow_harmony_unicode(bool allow) { | 149 void set_allow_harmony_unicode(bool allow) { |
| 146 scanner()->SetHarmonyUnicode(allow); | 150 scanner()->SetHarmonyUnicode(allow); |
| 147 } | 151 } |
| 148 void set_allow_harmony_computed_property_names(bool allow) { | 152 void set_allow_harmony_computed_property_names(bool allow) { |
| 149 allow_harmony_computed_property_names_ = allow; | 153 allow_harmony_computed_property_names_ = allow; |
| 150 } | 154 } |
| 155 void set_allow_harmony_rest_params(bool allow) { |
| 156 allow_harmony_rest_params_ = allow; |
| 157 } |
| 151 | 158 |
| 152 protected: | 159 protected: |
| 153 enum AllowEvalOrArgumentsAsIdentifier { | 160 enum AllowEvalOrArgumentsAsIdentifier { |
| 154 kAllowEvalOrArguments, | 161 kAllowEvalOrArguments, |
| 155 kDontAllowEvalOrArguments | 162 kDontAllowEvalOrArguments |
| 156 }; | 163 }; |
| 157 | 164 |
| 158 enum Mode { | 165 enum Mode { |
| 159 PARSE_LAZILY, | 166 PARSE_LAZILY, |
| 160 PARSE_EAGERLY | 167 PARSE_EAGERLY |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 | 625 |
| 619 Scanner* scanner_; | 626 Scanner* scanner_; |
| 620 bool stack_overflow_; | 627 bool stack_overflow_; |
| 621 | 628 |
| 622 bool allow_lazy_; | 629 bool allow_lazy_; |
| 623 bool allow_natives_; | 630 bool allow_natives_; |
| 624 bool allow_harmony_arrow_functions_; | 631 bool allow_harmony_arrow_functions_; |
| 625 bool allow_harmony_object_literals_; | 632 bool allow_harmony_object_literals_; |
| 626 bool allow_harmony_sloppy_; | 633 bool allow_harmony_sloppy_; |
| 627 bool allow_harmony_computed_property_names_; | 634 bool allow_harmony_computed_property_names_; |
| 635 bool allow_harmony_rest_params_; |
| 628 }; | 636 }; |
| 629 | 637 |
| 630 | 638 |
| 631 class PreParserIdentifier { | 639 class PreParserIdentifier { |
| 632 public: | 640 public: |
| 633 PreParserIdentifier() : type_(kUnknownIdentifier) {} | 641 PreParserIdentifier() : type_(kUnknownIdentifier) {} |
| 634 static PreParserIdentifier Default() { | 642 static PreParserIdentifier Default() { |
| 635 return PreParserIdentifier(kUnknownIdentifier); | 643 return PreParserIdentifier(kUnknownIdentifier); |
| 636 } | 644 } |
| 637 static PreParserIdentifier Eval() { | 645 static PreParserIdentifier Eval() { |
| (...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3060 *ok = false; | 3068 *ok = false; |
| 3061 return; | 3069 return; |
| 3062 } | 3070 } |
| 3063 has_seen_constructor_ = true; | 3071 has_seen_constructor_ = true; |
| 3064 return; | 3072 return; |
| 3065 } | 3073 } |
| 3066 } | 3074 } |
| 3067 } } // v8::internal | 3075 } } // v8::internal |
| 3068 | 3076 |
| 3069 #endif // V8_PREPARSER_H | 3077 #endif // V8_PREPARSER_H |
| OLD | NEW |