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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 uc32 c1 = source_->Advance(); | 581 uc32 c1 = source_->Advance(); |
582 if (!unibrow::Utf16::IsTrailSurrogate(c1)) { | 582 if (!unibrow::Utf16::IsTrailSurrogate(c1)) { |
583 source_->PushBack(c1); | 583 source_->PushBack(c1); |
584 } else { | 584 } else { |
585 c0_ = unibrow::Utf16::CombineSurrogatePair(c0_, c1); | 585 c0_ = unibrow::Utf16::CombineSurrogatePair(c0_, c1); |
586 } | 586 } |
587 } | 587 } |
588 } | 588 } |
589 | 589 |
590 void PushBack(uc32 ch) { | 590 void PushBack(uc32 ch) { |
591 if (ch > static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) { | 591 if (c0_ > static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) { |
592 source_->PushBack(unibrow::Utf16::TrailSurrogate(c0_)); | 592 source_->PushBack(unibrow::Utf16::TrailSurrogate(c0_)); |
593 source_->PushBack(unibrow::Utf16::LeadSurrogate(c0_)); | 593 source_->PushBack(unibrow::Utf16::LeadSurrogate(c0_)); |
594 } else { | 594 } else { |
595 source_->PushBack(c0_); | 595 source_->PushBack(c0_); |
596 } | 596 } |
597 c0_ = ch; | 597 c0_ = ch; |
598 } | 598 } |
599 | 599 |
600 inline Token::Value Select(Token::Value tok) { | 600 inline Token::Value Select(Token::Value tok) { |
601 Advance(); | 601 Advance(); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 bool allow_harmony_exponentiation_operator_; | 793 bool allow_harmony_exponentiation_operator_; |
794 | 794 |
795 MessageTemplate::Template scanner_error_; | 795 MessageTemplate::Template scanner_error_; |
796 Location scanner_error_location_; | 796 Location scanner_error_location_; |
797 }; | 797 }; |
798 | 798 |
799 } // namespace internal | 799 } // namespace internal |
800 } // namespace v8 | 800 } // namespace v8 |
801 | 801 |
802 #endif // V8_PARSING_SCANNER_H_ | 802 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |