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