| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 267 } |
| 268 return false; | 268 return false; |
| 269 } | 269 } |
| 270 | 270 |
| 271 int FindSymbol(DuplicateFinder* finder, int value); | 271 int FindSymbol(DuplicateFinder* finder, int value); |
| 272 | 272 |
| 273 UnicodeCache* unicode_cache() { return unicode_cache_; } | 273 UnicodeCache* unicode_cache() { return unicode_cache_; } |
| 274 | 274 |
| 275 // Returns the location of the last seen octal literal. | 275 // Returns the location of the last seen octal literal. |
| 276 Location octal_position() const { return octal_pos_; } | 276 Location octal_position() const { return octal_pos_; } |
| 277 void clear_octal_position() { octal_pos_ = Location::invalid(); } | 277 MessageTemplate::Template octal_message() const { return octal_message_; } |
| 278 // Returns the location of the last seen decimal literal with a leading zero. | 278 void clear_octal_position() { |
| 279 Location decimal_with_leading_zero_position() const { | 279 octal_pos_ = Location::invalid(); |
| 280 return decimal_with_leading_zero_pos_; | 280 octal_message_ = MessageTemplate::kNone; |
| 281 } | |
| 282 void clear_decimal_with_leading_zero_position() { | |
| 283 decimal_with_leading_zero_pos_ = Location::invalid(); | |
| 284 } | 281 } |
| 285 | 282 |
| 286 // Returns the value of the last smi that was scanned. | 283 // Returns the value of the last smi that was scanned. |
| 287 uint32_t smi_value() const { return current_.smi_value_; } | 284 uint32_t smi_value() const { return current_.smi_value_; } |
| 288 | 285 |
| 289 // Seek forward to the given position. This operation does not | 286 // Seek forward to the given position. This operation does not |
| 290 // work in general, for instance when there are pushed back | 287 // work in general, for instance when there are pushed back |
| 291 // characters, but works for seeking forward until simple delimiter | 288 // characters, but works for seeking forward until simple delimiter |
| 292 // tokens, which is what it is used for. | 289 // tokens, which is what it is used for. |
| 293 void SeekForward(int pos); | 290 void SeekForward(int pos); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 | 776 |
| 780 TokenDesc current_; // desc for current token (as returned by Next()) | 777 TokenDesc current_; // desc for current token (as returned by Next()) |
| 781 TokenDesc next_; // desc for next token (one token look-ahead) | 778 TokenDesc next_; // desc for next token (one token look-ahead) |
| 782 TokenDesc next_next_; // desc for the token after next (after PeakAhead()) | 779 TokenDesc next_next_; // desc for the token after next (after PeakAhead()) |
| 783 | 780 |
| 784 // Input stream. Must be initialized to an Utf16CharacterStream. | 781 // Input stream. Must be initialized to an Utf16CharacterStream. |
| 785 Utf16CharacterStream* source_; | 782 Utf16CharacterStream* source_; |
| 786 | 783 |
| 787 // Last-seen positions of potentially problematic tokens. | 784 // Last-seen positions of potentially problematic tokens. |
| 788 Location octal_pos_; | 785 Location octal_pos_; |
| 789 Location decimal_with_leading_zero_pos_; | 786 MessageTemplate::Template octal_message_; |
| 790 | 787 |
| 791 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 788 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
| 792 uc32 c0_; | 789 uc32 c0_; |
| 793 | 790 |
| 794 // Whether there is a line terminator whitespace character after | 791 // Whether there is a line terminator whitespace character after |
| 795 // the current token, and before the next. Does not count newlines | 792 // the current token, and before the next. Does not count newlines |
| 796 // inside multiline comments. | 793 // inside multiline comments. |
| 797 bool has_line_terminator_before_next_; | 794 bool has_line_terminator_before_next_; |
| 798 // Whether there is a multi-line comment that contains a | 795 // Whether there is a multi-line comment that contains a |
| 799 // line-terminator after the current token, and before the next. | 796 // line-terminator after the current token, and before the next. |
| 800 bool has_multiline_comment_before_next_; | 797 bool has_multiline_comment_before_next_; |
| 801 bool has_line_terminator_after_next_; | 798 bool has_line_terminator_after_next_; |
| 802 | 799 |
| 803 // Whether this scanner encountered an HTML comment. | 800 // Whether this scanner encountered an HTML comment. |
| 804 bool found_html_comment_; | 801 bool found_html_comment_; |
| 805 | 802 |
| 806 MessageTemplate::Template scanner_error_; | 803 MessageTemplate::Template scanner_error_; |
| 807 Location scanner_error_location_; | 804 Location scanner_error_location_; |
| 808 }; | 805 }; |
| 809 | 806 |
| 810 } // namespace internal | 807 } // namespace internal |
| 811 } // namespace v8 | 808 } // namespace v8 |
| 812 | 809 |
| 813 #endif // V8_PARSING_SCANNER_H_ | 810 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |