| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Setters that determine whether certain syntactical constructs are | 69 // Setters that determine whether certain syntactical constructs are |
| 70 // allowed to be parsed by this instance of the parser. | 70 // allowed to be parsed by this instance of the parser. |
| 71 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } | 71 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
| 72 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } | 72 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } |
| 73 void set_allow_generators(bool allow) { allow_generators_ = allow; } | 73 void set_allow_generators(bool allow) { allow_generators_ = allow; } |
| 74 void set_allow_for_of(bool allow) { allow_for_of_ = allow; } | 74 void set_allow_for_of(bool allow) { allow_for_of_ = allow; } |
| 75 void set_allow_modules(bool allow) { | 75 void set_allow_modules(bool allow) { |
| 76 allow_harmony_modules_ = allow; | 76 allow_harmony_modules_ = allow; |
| 77 if (scanner()) | 77 if (scanner()) { |
| 78 scanner()->SetHarmonyModules(allow); | 78 scanner()->SetHarmonyModules(allow); |
| 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 void set_allow_harmony_scoping(bool allow) { | 82 void set_allow_harmony_scoping(bool allow) { |
| 82 allow_harmony_scoping_ = allow; | 83 allow_harmony_scoping_ = allow; |
| 83 if (scanner()) | 84 if (scanner()) { |
| 84 scanner()->SetHarmonyScoping(allow); | 85 scanner()->SetHarmonyScoping(allow); |
| 86 } |
| 85 } | 87 } |
| 86 void set_allow_harmony_numeric_literals(bool allow) { | 88 void set_allow_harmony_numeric_literals(bool allow) { |
| 87 allow_harmony_numeric_literals_ = allow; | 89 allow_harmony_numeric_literals_ = allow; |
| 88 if (scanner()) | 90 if (scanner()) { |
| 89 scanner()->SetHarmonyNumericLiterals(allow); | 91 scanner()->SetHarmonyNumericLiterals(allow); |
| 92 } |
| 90 } | 93 } |
| 91 | 94 |
| 92 protected: | 95 protected: |
| 93 ScannerBase* scanner() const { return scanner_; } | 96 ScannerBase* scanner() const { return scanner_; } |
| 94 int position() { return scanner_->location().beg_pos; } | 97 int position() { return scanner_->location().beg_pos; } |
| 95 int peek_position() { return scanner_->peek_location().beg_pos; } | 98 int peek_position() { return scanner_->peek_location().beg_pos; } |
| 96 bool stack_overflow() const { return stack_overflow_; } | 99 bool stack_overflow() const { return stack_overflow_; } |
| 97 void set_stack_overflow() { stack_overflow_ = true; } | 100 void set_stack_overflow() { stack_overflow_ = true; } |
| 98 | 101 |
| 99 INLINE(Token::Value peek()) { | 102 INLINE(Token::Value peek()) { |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 ParserRecorder* log_; | 704 ParserRecorder* log_; |
| 702 Scope* scope_; | 705 Scope* scope_; |
| 703 ScannerBase::Location strict_mode_violation_location_; | 706 ScannerBase::Location strict_mode_violation_location_; |
| 704 const char* strict_mode_violation_type_; | 707 const char* strict_mode_violation_type_; |
| 705 bool parenthesized_function_; | 708 bool parenthesized_function_; |
| 706 }; | 709 }; |
| 707 | 710 |
| 708 } } // v8::internal | 711 } } // v8::internal |
| 709 | 712 |
| 710 #endif // V8_PREPARSER_H | 713 #endif // V8_PREPARSER_H |
| OLD | NEW |