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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 int beg_pos; | 343 int beg_pos; |
344 int end_pos; | 344 int end_pos; |
345 }; | 345 }; |
346 | 346 |
347 // -1 is outside of the range of any real source code. | 347 // -1 is outside of the range of any real source code. |
348 static const int kNoOctalLocation = -1; | 348 static const int kNoOctalLocation = -1; |
349 | 349 |
350 explicit Scanner(UnicodeCache* scanner_contants); | 350 explicit Scanner(UnicodeCache* scanner_contants); |
351 | 351 |
352 void Initialize(Utf16CharacterStream* source); | 352 void Initialize(Utf16CharacterStream* source, bool allow_html_comments); |
353 | 353 |
354 // Returns the next token and advances input. | 354 // Returns the next token and advances input. |
355 Token::Value Next(); | 355 Token::Value Next(); |
356 // Returns the token following peek() | 356 // Returns the token following peek() |
357 Token::Value PeekAhead(); | 357 Token::Value PeekAhead(); |
358 // Returns the current token again. | 358 // Returns the current token again. |
359 Token::Value current_token() { return current_.token; } | 359 Token::Value current_token() { return current_.token; } |
360 // Returns the location information for the current token | 360 // Returns the location information for the current token |
361 // (the token last returned by Next()). | 361 // (the token last returned by Next()). |
362 Location location() const { return current_.location; } | 362 Location location() const { return current_.location; } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 // inside multiline comments. | 797 // inside multiline comments. |
798 bool has_line_terminator_before_next_; | 798 bool has_line_terminator_before_next_; |
799 // Whether there is a multi-line comment that contains a | 799 // Whether there is a multi-line comment that contains a |
800 // line-terminator after the current token, and before the next. | 800 // line-terminator after the current token, and before the next. |
801 bool has_multiline_comment_before_next_; | 801 bool has_multiline_comment_before_next_; |
802 bool has_line_terminator_after_next_; | 802 bool has_line_terminator_after_next_; |
803 | 803 |
804 // Whether this scanner encountered an HTML comment. | 804 // Whether this scanner encountered an HTML comment. |
805 bool found_html_comment_; | 805 bool found_html_comment_; |
806 | 806 |
| 807 // Whether this scanner should interpret character sequences describing HTML |
| 808 // comments as JavaScript comment delimiters (as per ES2015 section B.1.3, |
| 809 // "HTML-like Comments") |
| 810 bool allow_html_comments_; |
| 811 |
807 bool allow_harmony_exponentiation_operator_; | 812 bool allow_harmony_exponentiation_operator_; |
808 | 813 |
809 MessageTemplate::Template scanner_error_; | 814 MessageTemplate::Template scanner_error_; |
810 Location scanner_error_location_; | 815 Location scanner_error_location_; |
811 }; | 816 }; |
812 | 817 |
813 } // namespace internal | 818 } // namespace internal |
814 } // namespace v8 | 819 } // namespace v8 |
815 | 820 |
816 #endif // V8_PARSING_SCANNER_H_ | 821 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |