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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 int FindNumber(DuplicateFinder* finder, int value); | 430 int FindNumber(DuplicateFinder* finder, int value); |
431 int FindSymbol(DuplicateFinder* finder, int value); | 431 int FindSymbol(DuplicateFinder* finder, int value); |
432 | 432 |
433 UnicodeCache* unicode_cache() { return unicode_cache_; } | 433 UnicodeCache* unicode_cache() { return unicode_cache_; } |
434 | 434 |
435 // Returns the location of the last seen octal literal. | 435 // Returns the location of the last seen octal literal. |
436 Location octal_position() const { return octal_pos_; } | 436 Location octal_position() const { return octal_pos_; } |
437 void clear_octal_position() { octal_pos_ = Location::invalid(); } | 437 void clear_octal_position() { octal_pos_ = Location::invalid(); } |
438 | 438 |
| 439 // Returns the value of the last smi that was scanned. |
| 440 int smi_value() const { return smi_value_; } |
| 441 |
439 // Seek forward to the given position. This operation does not | 442 // Seek forward to the given position. This operation does not |
440 // work in general, for instance when there are pushed back | 443 // work in general, for instance when there are pushed back |
441 // characters, but works for seeking forward until simple delimiter | 444 // characters, but works for seeking forward until simple delimiter |
442 // tokens, which is what it is used for. | 445 // tokens, which is what it is used for. |
443 void SeekForward(int pos); | 446 void SeekForward(int pos); |
444 | 447 |
445 bool HarmonyScoping() const { | 448 bool HarmonyScoping() const { |
446 return harmony_scoping_; | 449 return harmony_scoping_; |
447 } | 450 } |
448 void SetHarmonyScoping(bool scoping) { | 451 void SetHarmonyScoping(bool scoping) { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 TokenDesc current_; // desc for current token (as returned by Next()) | 718 TokenDesc current_; // desc for current token (as returned by Next()) |
716 TokenDesc next_; // desc for next token (one token look-ahead) | 719 TokenDesc next_; // desc for next token (one token look-ahead) |
717 | 720 |
718 // Input stream. Must be initialized to an Utf16CharacterStream. | 721 // Input stream. Must be initialized to an Utf16CharacterStream. |
719 Utf16CharacterStream* source_; | 722 Utf16CharacterStream* source_; |
720 | 723 |
721 | 724 |
722 // Start position of the octal literal last scanned. | 725 // Start position of the octal literal last scanned. |
723 Location octal_pos_; | 726 Location octal_pos_; |
724 | 727 |
| 728 // Value of the last smi that was scanned. |
| 729 int smi_value_; |
| 730 |
725 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 731 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
726 uc32 c0_; | 732 uc32 c0_; |
727 | 733 |
728 // Whether there is a line terminator whitespace character after | 734 // Whether there is a line terminator whitespace character after |
729 // the current token, and before the next. Does not count newlines | 735 // the current token, and before the next. Does not count newlines |
730 // inside multiline comments. | 736 // inside multiline comments. |
731 bool has_line_terminator_before_next_; | 737 bool has_line_terminator_before_next_; |
732 // Whether there is a multi-line comment that contains a | 738 // Whether there is a multi-line comment that contains a |
733 // line-terminator after the current token, and before the next. | 739 // line-terminator after the current token, and before the next. |
734 bool has_multiline_comment_before_next_; | 740 bool has_multiline_comment_before_next_; |
735 // Whether we scan 'let' as a keyword for harmony block-scoped let bindings. | 741 // Whether we scan 'let' as a keyword for harmony block-scoped let bindings. |
736 bool harmony_scoping_; | 742 bool harmony_scoping_; |
737 // Whether we scan 'module', 'import', 'export' as keywords. | 743 // Whether we scan 'module', 'import', 'export' as keywords. |
738 bool harmony_modules_; | 744 bool harmony_modules_; |
739 // Whether we scan 0o777 and 0b111 as numbers. | 745 // Whether we scan 0o777 and 0b111 as numbers. |
740 bool harmony_numeric_literals_; | 746 bool harmony_numeric_literals_; |
741 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. | 747 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. |
742 bool harmony_classes_; | 748 bool harmony_classes_; |
743 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL | 749 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL |
744 bool harmony_templates_; | 750 bool harmony_templates_; |
745 // Whether we allow \u{xxxxx}. | 751 // Whether we allow \u{xxxxx}. |
746 bool harmony_unicode_; | 752 bool harmony_unicode_; |
747 }; | 753 }; |
748 | 754 |
749 } } // namespace v8::internal | 755 } } // namespace v8::internal |
750 | 756 |
751 #endif // V8_SCANNER_H_ | 757 #endif // V8_SCANNER_H_ |
OLD | NEW |