OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 parenthesized_function_(false) { } | 134 parenthesized_function_(false) { } |
135 | 135 |
136 ~PreParser() {} | 136 ~PreParser() {} |
137 | 137 |
138 bool allow_natives_syntax() const { return allow_natives_syntax_; } | 138 bool allow_natives_syntax() const { return allow_natives_syntax_; } |
139 bool allow_lazy() const { return allow_lazy_; } | 139 bool allow_lazy() const { return allow_lazy_; } |
140 bool allow_modules() const { return scanner_->HarmonyModules(); } | 140 bool allow_modules() const { return scanner_->HarmonyModules(); } |
141 bool allow_harmony_scoping() const { return scanner_->HarmonyScoping(); } | 141 bool allow_harmony_scoping() const { return scanner_->HarmonyScoping(); } |
142 bool allow_generators() const { return allow_generators_; } | 142 bool allow_generators() const { return allow_generators_; } |
143 bool allow_for_of() const { return allow_for_of_; } | 143 bool allow_for_of() const { return allow_for_of_; } |
| 144 bool allow_harmony_numeric_literals() const { |
| 145 return scanner_->HarmonyNumericLiterals(); |
| 146 } |
144 | 147 |
145 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } | 148 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } |
146 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } | 149 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
147 void set_allow_modules(bool allow) { scanner_->SetHarmonyModules(allow); } | 150 void set_allow_modules(bool allow) { scanner_->SetHarmonyModules(allow); } |
148 void set_allow_harmony_scoping(bool allow) { | 151 void set_allow_harmony_scoping(bool allow) { |
149 scanner_->SetHarmonyScoping(allow); | 152 scanner_->SetHarmonyScoping(allow); |
150 } | 153 } |
151 void set_allow_generators(bool allow) { allow_generators_ = allow; } | 154 void set_allow_generators(bool allow) { allow_generators_ = allow; } |
152 void set_allow_for_of(bool allow) { allow_for_of_ = allow; } | 155 void set_allow_for_of(bool allow) { allow_for_of_ = allow; } |
| 156 void set_allow_harmony_numeric_literals(bool allow) { |
| 157 scanner_->SetHarmonyNumericLiterals(allow); |
| 158 } |
153 | 159 |
154 // Pre-parse the program from the character stream; returns true on | 160 // Pre-parse the program from the character stream; returns true on |
155 // success (even if parsing failed, the pre-parse data successfully | 161 // success (even if parsing failed, the pre-parse data successfully |
156 // captured the syntax error), and false if a stack-overflow happened | 162 // captured the syntax error), and false if a stack-overflow happened |
157 // during parsing. | 163 // during parsing. |
158 PreParseResult PreParseProgram() { | 164 PreParseResult PreParseProgram() { |
159 Scope top_scope(&scope_, kTopLevelScope); | 165 Scope top_scope(&scope_, kTopLevelScope); |
160 bool ok = true; | 166 bool ok = true; |
161 int start_position = scanner_->peek_location().beg_pos; | 167 int start_position = scanner_->peek_location().beg_pos; |
162 ParseSourceElements(i::Token::EOS, &ok); | 168 ParseSourceElements(i::Token::EOS, &ok); |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 bool stack_overflow_; | 688 bool stack_overflow_; |
683 bool allow_lazy_; | 689 bool allow_lazy_; |
684 bool allow_natives_syntax_; | 690 bool allow_natives_syntax_; |
685 bool allow_generators_; | 691 bool allow_generators_; |
686 bool allow_for_of_; | 692 bool allow_for_of_; |
687 bool parenthesized_function_; | 693 bool parenthesized_function_; |
688 }; | 694 }; |
689 } } // v8::preparser | 695 } } // v8::preparser |
690 | 696 |
691 #endif // V8_PREPARSER_H | 697 #endif // V8_PREPARSER_H |
OLD | NEW |