| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 610 |
| 611 void PushBack(uc32 ch) { | 611 void PushBack(uc32 ch) { |
| 612 if (c0_ > static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) { | 612 if (c0_ > static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) { |
| 613 source_->Back2(); | 613 source_->Back2(); |
| 614 } else { | 614 } else { |
| 615 source_->Back(); | 615 source_->Back(); |
| 616 } | 616 } |
| 617 c0_ = ch; | 617 c0_ = ch; |
| 618 } | 618 } |
| 619 | 619 |
| 620 // Same as PushBack(ch1); PushBack(ch2). |
| 621 // - Potentially more efficient as it uses Back2() on the stream. |
| 622 // - Uses char as parameters, since we're only calling it with ASCII chars in |
| 623 // practice. This way, we can avoid a few edge cases. |
| 624 void PushBack2(char ch1, char ch2) { |
| 625 source_->Back2(); |
| 626 c0_ = ch2; |
| 627 } |
| 628 |
| 620 inline Token::Value Select(Token::Value tok) { | 629 inline Token::Value Select(Token::Value tok) { |
| 621 Advance(); | 630 Advance(); |
| 622 return tok; | 631 return tok; |
| 623 } | 632 } |
| 624 | 633 |
| 625 inline Token::Value Select(uc32 next, Token::Value then, Token::Value else_) { | 634 inline Token::Value Select(uc32 next, Token::Value then, Token::Value else_) { |
| 626 Advance(); | 635 Advance(); |
| 627 if (c0_ == next) { | 636 if (c0_ == next) { |
| 628 Advance(); | 637 Advance(); |
| 629 return then; | 638 return then; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 bool found_html_comment_; | 804 bool found_html_comment_; |
| 796 | 805 |
| 797 MessageTemplate::Template scanner_error_; | 806 MessageTemplate::Template scanner_error_; |
| 798 Location scanner_error_location_; | 807 Location scanner_error_location_; |
| 799 }; | 808 }; |
| 800 | 809 |
| 801 } // namespace internal | 810 } // namespace internal |
| 802 } // namespace v8 | 811 } // namespace v8 |
| 803 | 812 |
| 804 #endif // V8_PARSING_SCANNER_H_ | 813 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |