| 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_PARSING_SCANNER_H_ | 7 #ifndef V8_PARSING_SCANNER_H_ |
| 8 #define V8_PARSING_SCANNER_H_ | 8 #define V8_PARSING_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 int FindSymbol(DuplicateFinder* finder, int value); | 421 int FindSymbol(DuplicateFinder* finder, int value); |
| 422 | 422 |
| 423 UnicodeCache* unicode_cache() { return unicode_cache_; } | 423 UnicodeCache* unicode_cache() { return unicode_cache_; } |
| 424 | 424 |
| 425 // Returns the location of the last seen octal literal. | 425 // Returns the location of the last seen octal literal. |
| 426 Location octal_position() const { return octal_pos_; } | 426 Location octal_position() const { return octal_pos_; } |
| 427 void clear_octal_position() { octal_pos_ = Location::invalid(); } | 427 void clear_octal_position() { octal_pos_ = Location::invalid(); } |
| 428 // Returns the location of the last seen decimal literal with a leading zero. |
| 429 Location decimal_with_leading_zero_position() const { |
| 430 return decimal_with_leading_zero_pos_; |
| 431 } |
| 432 void clear_decimal_with_leading_zero_position() { |
| 433 decimal_with_leading_zero_pos_ = Location::invalid(); |
| 434 } |
| 428 | 435 |
| 429 // Returns the value of the last smi that was scanned. | 436 // Returns the value of the last smi that was scanned. |
| 430 int smi_value() const { return current_.smi_value_; } | 437 int smi_value() const { return current_.smi_value_; } |
| 431 | 438 |
| 432 // Seek forward to the given position. This operation does not | 439 // Seek forward to the given position. This operation does not |
| 433 // work in general, for instance when there are pushed back | 440 // work in general, for instance when there are pushed back |
| 434 // characters, but works for seeking forward until simple delimiter | 441 // characters, but works for seeking forward until simple delimiter |
| 435 // tokens, which is what it is used for. | 442 // tokens, which is what it is used for. |
| 436 void SeekForward(int pos); | 443 void SeekForward(int pos); |
| 437 | 444 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 TokenDesc bookmark_current_; | 772 TokenDesc bookmark_current_; |
| 766 TokenDesc bookmark_next_; | 773 TokenDesc bookmark_next_; |
| 767 LiteralBuffer bookmark_current_literal_; | 774 LiteralBuffer bookmark_current_literal_; |
| 768 LiteralBuffer bookmark_current_raw_literal_; | 775 LiteralBuffer bookmark_current_raw_literal_; |
| 769 LiteralBuffer bookmark_next_literal_; | 776 LiteralBuffer bookmark_next_literal_; |
| 770 LiteralBuffer bookmark_next_raw_literal_; | 777 LiteralBuffer bookmark_next_raw_literal_; |
| 771 | 778 |
| 772 // Input stream. Must be initialized to an Utf16CharacterStream. | 779 // Input stream. Must be initialized to an Utf16CharacterStream. |
| 773 Utf16CharacterStream* source_; | 780 Utf16CharacterStream* source_; |
| 774 | 781 |
| 775 | 782 // Last-seen positions of potentially problematic tokens. |
| 776 // Start position of the octal literal last scanned. | |
| 777 Location octal_pos_; | 783 Location octal_pos_; |
| 784 Location decimal_with_leading_zero_pos_; |
| 778 | 785 |
| 779 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 786 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
| 780 uc32 c0_; | 787 uc32 c0_; |
| 781 | 788 |
| 782 // Whether there is a line terminator whitespace character after | 789 // Whether there is a line terminator whitespace character after |
| 783 // the current token, and before the next. Does not count newlines | 790 // the current token, and before the next. Does not count newlines |
| 784 // inside multiline comments. | 791 // inside multiline comments. |
| 785 bool has_line_terminator_before_next_; | 792 bool has_line_terminator_before_next_; |
| 786 // Whether there is a multi-line comment that contains a | 793 // Whether there is a multi-line comment that contains a |
| 787 // line-terminator after the current token, and before the next. | 794 // line-terminator after the current token, and before the next. |
| 788 bool has_multiline_comment_before_next_; | 795 bool has_multiline_comment_before_next_; |
| 789 | 796 |
| 790 // Whether this scanner encountered an HTML comment. | 797 // Whether this scanner encountered an HTML comment. |
| 791 bool found_html_comment_; | 798 bool found_html_comment_; |
| 792 | 799 |
| 793 bool allow_harmony_exponentiation_operator_; | 800 bool allow_harmony_exponentiation_operator_; |
| 794 | 801 |
| 795 MessageTemplate::Template scanner_error_; | 802 MessageTemplate::Template scanner_error_; |
| 796 Location scanner_error_location_; | 803 Location scanner_error_location_; |
| 797 }; | 804 }; |
| 798 | 805 |
| 799 } // namespace internal | 806 } // namespace internal |
| 800 } // namespace v8 | 807 } // namespace v8 |
| 801 | 808 |
| 802 #endif // V8_PARSING_SCANNER_H_ | 809 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |