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