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_SCANNER_H_ | 7 #ifndef V8_SCANNER_H_ |
8 #define V8_SCANNER_H_ | 8 #define V8_SCANNER_H_ |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 // Returns the value of the last smi that was scanned. | 472 // Returns the value of the last smi that was scanned. |
473 int smi_value() const { return current_.smi_value_; } | 473 int smi_value() const { return current_.smi_value_; } |
474 | 474 |
475 // Seek forward to the given position. This operation does not | 475 // Seek forward to the given position. This operation does not |
476 // work in general, for instance when there are pushed back | 476 // work in general, for instance when there are pushed back |
477 // characters, but works for seeking forward until simple delimiter | 477 // characters, but works for seeking forward until simple delimiter |
478 // tokens, which is what it is used for. | 478 // tokens, which is what it is used for. |
479 void SeekForward(int pos); | 479 void SeekForward(int pos); |
480 | 480 |
481 bool HarmonyUnicode() const { return harmony_unicode_; } | |
482 void SetHarmonyUnicode(bool unicode) { harmony_unicode_ = unicode; } | |
483 | |
484 // Returns true if there was a line terminator before the peek'ed token, | 481 // Returns true if there was a line terminator before the peek'ed token, |
485 // possibly inside a multi-line comment. | 482 // possibly inside a multi-line comment. |
486 bool HasAnyLineTerminatorBeforeNext() const { | 483 bool HasAnyLineTerminatorBeforeNext() const { |
487 return has_line_terminator_before_next_ || | 484 return has_line_terminator_before_next_ || |
488 has_multiline_comment_before_next_; | 485 has_multiline_comment_before_next_; |
489 } | 486 } |
490 | 487 |
491 // Scans the input as a regular expression pattern, previous | 488 // Scans the input as a regular expression pattern, previous |
492 // character(s) must be /(=). Returns true if a pattern is scanned. | 489 // character(s) must be /(=). Returns true if a pattern is scanned. |
493 bool ScanRegExpPattern(bool seen_equal); | 490 bool ScanRegExpPattern(bool seen_equal); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 780 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
784 uc32 c0_; | 781 uc32 c0_; |
785 | 782 |
786 // Whether there is a line terminator whitespace character after | 783 // Whether there is a line terminator whitespace character after |
787 // the current token, and before the next. Does not count newlines | 784 // the current token, and before the next. Does not count newlines |
788 // inside multiline comments. | 785 // inside multiline comments. |
789 bool has_line_terminator_before_next_; | 786 bool has_line_terminator_before_next_; |
790 // Whether there is a multi-line comment that contains a | 787 // Whether there is a multi-line comment that contains a |
791 // line-terminator after the current token, and before the next. | 788 // line-terminator after the current token, and before the next. |
792 bool has_multiline_comment_before_next_; | 789 bool has_multiline_comment_before_next_; |
793 // Whether we allow \u{xxxxx}. | |
794 bool harmony_unicode_; | |
795 }; | 790 }; |
796 | 791 |
797 } } // namespace v8::internal | 792 } } // namespace v8::internal |
798 | 793 |
799 #endif // V8_SCANNER_H_ | 794 #endif // V8_SCANNER_H_ |
OLD | NEW |