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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 // Returns the value of the last smi that was scanned. | 438 // Returns the value of the last smi that was scanned. |
439 int smi_value() const { return smi_value_; } | 439 int smi_value() const { return smi_value_; } |
440 | 440 |
441 // Seek forward to the given position. This operation does not | 441 // Seek forward to the given position. This operation does not |
442 // work in general, for instance when there are pushed back | 442 // work in general, for instance when there are pushed back |
443 // characters, but works for seeking forward until simple delimiter | 443 // characters, but works for seeking forward until simple delimiter |
444 // tokens, which is what it is used for. | 444 // tokens, which is what it is used for. |
445 void SeekForward(int pos); | 445 void SeekForward(int pos); |
446 | 446 |
447 bool HarmonyScoping() const { | |
448 return harmony_scoping_; | |
449 } | |
450 void SetHarmonyScoping(bool scoping) { | |
451 harmony_scoping_ = scoping; | |
452 } | |
453 bool HarmonyModules() const { | 447 bool HarmonyModules() const { |
454 return harmony_modules_; | 448 return harmony_modules_; |
455 } | 449 } |
456 void SetHarmonyModules(bool modules) { | 450 void SetHarmonyModules(bool modules) { |
457 harmony_modules_ = modules; | 451 harmony_modules_ = modules; |
458 } | 452 } |
459 bool HarmonyNumericLiterals() const { | 453 bool HarmonyNumericLiterals() const { |
460 return harmony_numeric_literals_; | 454 return harmony_numeric_literals_; |
461 } | 455 } |
462 void SetHarmonyNumericLiterals(bool numeric_literals) { | 456 void SetHarmonyNumericLiterals(bool numeric_literals) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 732 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
739 uc32 c0_; | 733 uc32 c0_; |
740 | 734 |
741 // Whether there is a line terminator whitespace character after | 735 // Whether there is a line terminator whitespace character after |
742 // the current token, and before the next. Does not count newlines | 736 // the current token, and before the next. Does not count newlines |
743 // inside multiline comments. | 737 // inside multiline comments. |
744 bool has_line_terminator_before_next_; | 738 bool has_line_terminator_before_next_; |
745 // Whether there is a multi-line comment that contains a | 739 // Whether there is a multi-line comment that contains a |
746 // line-terminator after the current token, and before the next. | 740 // line-terminator after the current token, and before the next. |
747 bool has_multiline_comment_before_next_; | 741 bool has_multiline_comment_before_next_; |
748 // Whether we scan 'let' as a keyword for harmony block-scoped let bindings. | |
749 bool harmony_scoping_; | |
750 // Whether we scan 'module', 'import', 'export' as keywords. | 742 // Whether we scan 'module', 'import', 'export' as keywords. |
751 bool harmony_modules_; | 743 bool harmony_modules_; |
752 // Whether we scan 0o777 and 0b111 as numbers. | 744 // Whether we scan 0o777 and 0b111 as numbers. |
753 bool harmony_numeric_literals_; | 745 bool harmony_numeric_literals_; |
754 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. | 746 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. |
755 bool harmony_classes_; | 747 bool harmony_classes_; |
756 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL | 748 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL |
757 bool harmony_templates_; | 749 bool harmony_templates_; |
758 // Whether we allow \u{xxxxx}. | 750 // Whether we allow \u{xxxxx}. |
759 bool harmony_unicode_; | 751 bool harmony_unicode_; |
760 }; | 752 }; |
761 | 753 |
762 } } // namespace v8::internal | 754 } } // namespace v8::internal |
763 | 755 |
764 #endif // V8_SCANNER_H_ | 756 #endif // V8_SCANNER_H_ |
OLD | NEW |