| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 // Features shared by parsing and pre-parsing scanners. | 5 // Features shared by parsing and pre-parsing scanners. |
| 6 | 6 |
| 7 #ifndef V8_SCANNER_H_ | 7 #ifndef V8_SCANNER_H_ |
| 8 #define V8_SCANNER_H_ | 8 #define V8_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 // Returns the value of the last smi that was scanned. | 472 // Returns the value of the last smi that was scanned. |
| 473 int smi_value() const { return current_.smi_value_; } | 473 int smi_value() const { return current_.smi_value_; } |
| 474 | 474 |
| 475 // Seek forward to the given position. This operation does not | 475 // Seek forward to the given position. This operation does not |
| 476 // work in general, for instance when there are pushed back | 476 // work in general, for instance when there are pushed back |
| 477 // characters, but works for seeking forward until simple delimiter | 477 // characters, but works for seeking forward until simple delimiter |
| 478 // tokens, which is what it is used for. | 478 // tokens, which is what it is used for. |
| 479 void SeekForward(int pos); | 479 void SeekForward(int pos); |
| 480 | 480 |
| 481 bool HarmonyModules() const { | |
| 482 return harmony_modules_; | |
| 483 } | |
| 484 void SetHarmonyModules(bool modules) { | |
| 485 harmony_modules_ = modules; | |
| 486 } | |
| 487 | |
| 488 bool HarmonyUnicode() const { return harmony_unicode_; } | 481 bool HarmonyUnicode() const { return harmony_unicode_; } |
| 489 void SetHarmonyUnicode(bool unicode) { harmony_unicode_ = unicode; } | 482 void SetHarmonyUnicode(bool unicode) { harmony_unicode_ = unicode; } |
| 490 | 483 |
| 491 // Returns true if there was a line terminator before the peek'ed token, | 484 // Returns true if there was a line terminator before the peek'ed token, |
| 492 // possibly inside a multi-line comment. | 485 // possibly inside a multi-line comment. |
| 493 bool HasAnyLineTerminatorBeforeNext() const { | 486 bool HasAnyLineTerminatorBeforeNext() const { |
| 494 return has_line_terminator_before_next_ || | 487 return has_line_terminator_before_next_ || |
| 495 has_multiline_comment_before_next_; | 488 has_multiline_comment_before_next_; |
| 496 } | 489 } |
| 497 | 490 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 783 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
| 791 uc32 c0_; | 784 uc32 c0_; |
| 792 | 785 |
| 793 // Whether there is a line terminator whitespace character after | 786 // Whether there is a line terminator whitespace character after |
| 794 // the current token, and before the next. Does not count newlines | 787 // the current token, and before the next. Does not count newlines |
| 795 // inside multiline comments. | 788 // inside multiline comments. |
| 796 bool has_line_terminator_before_next_; | 789 bool has_line_terminator_before_next_; |
| 797 // Whether there is a multi-line comment that contains a | 790 // Whether there is a multi-line comment that contains a |
| 798 // line-terminator after the current token, and before the next. | 791 // line-terminator after the current token, and before the next. |
| 799 bool has_multiline_comment_before_next_; | 792 bool has_multiline_comment_before_next_; |
| 800 // Whether we scan 'module', 'import', 'export' as keywords. | |
| 801 bool harmony_modules_; | |
| 802 // Whether we allow \u{xxxxx}. | 793 // Whether we allow \u{xxxxx}. |
| 803 bool harmony_unicode_; | 794 bool harmony_unicode_; |
| 804 }; | 795 }; |
| 805 | 796 |
| 806 } } // namespace v8::internal | 797 } } // namespace v8::internal |
| 807 | 798 |
| 808 #endif // V8_SCANNER_H_ | 799 #endif // V8_SCANNER_H_ |
| OLD | NEW |