| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // tokens, which is what it is used for. | 435 // tokens, which is what it is used for. |
| 436 void SeekForward(int pos); | 436 void SeekForward(int pos); |
| 437 | 437 |
| 438 // Returns true if there was a line terminator before the peek'ed token, | 438 // Returns true if there was a line terminator before the peek'ed token, |
| 439 // possibly inside a multi-line comment. | 439 // possibly inside a multi-line comment. |
| 440 bool HasAnyLineTerminatorBeforeNext() const { | 440 bool HasAnyLineTerminatorBeforeNext() const { |
| 441 return has_line_terminator_before_next_ || | 441 return has_line_terminator_before_next_ || |
| 442 has_multiline_comment_before_next_; | 442 has_multiline_comment_before_next_; |
| 443 } | 443 } |
| 444 | 444 |
| 445 bool HasAnyLineTerminatorAfterNext() { |
| 446 Token::Value ensure_next_next = PeekAhead(); |
| 447 USE(ensure_next_next); |
| 448 return has_line_terminator_after_next_; |
| 449 } |
| 450 |
| 445 // Scans the input as a regular expression pattern, previous | 451 // Scans the input as a regular expression pattern, previous |
| 446 // character(s) must be /(=). Returns true if a pattern is scanned. | 452 // character(s) must be /(=). Returns true if a pattern is scanned. |
| 447 bool ScanRegExpPattern(bool seen_equal); | 453 bool ScanRegExpPattern(bool seen_equal); |
| 448 // Scans the input as regular expression flags. Returns the flags on success. | 454 // Scans the input as regular expression flags. Returns the flags on success. |
| 449 Maybe<RegExp::Flags> ScanRegExpFlags(); | 455 Maybe<RegExp::Flags> ScanRegExpFlags(); |
| 450 | 456 |
| 451 // Scans the input as a template literal | 457 // Scans the input as a template literal |
| 452 Token::Value ScanTemplateStart(); | 458 Token::Value ScanTemplateStart(); |
| 453 Token::Value ScanTemplateContinuation(); | 459 Token::Value ScanTemplateContinuation(); |
| 454 | 460 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 785 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
| 780 uc32 c0_; | 786 uc32 c0_; |
| 781 | 787 |
| 782 // Whether there is a line terminator whitespace character after | 788 // Whether there is a line terminator whitespace character after |
| 783 // the current token, and before the next. Does not count newlines | 789 // the current token, and before the next. Does not count newlines |
| 784 // inside multiline comments. | 790 // inside multiline comments. |
| 785 bool has_line_terminator_before_next_; | 791 bool has_line_terminator_before_next_; |
| 786 // Whether there is a multi-line comment that contains a | 792 // Whether there is a multi-line comment that contains a |
| 787 // line-terminator after the current token, and before the next. | 793 // line-terminator after the current token, and before the next. |
| 788 bool has_multiline_comment_before_next_; | 794 bool has_multiline_comment_before_next_; |
| 795 bool has_line_terminator_after_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 |