Chromium Code Reviews| 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 Advance(); | 564 Advance(); |
| 565 } | 565 } |
| 566 | 566 |
| 567 // Low-level scanning support. | 567 // Low-level scanning support. |
| 568 template <bool capture_raw = false, bool check_surrogate = true> | 568 template <bool capture_raw = false, bool check_surrogate = true> |
| 569 void Advance() { | 569 void Advance() { |
| 570 if (capture_raw) { | 570 if (capture_raw) { |
| 571 AddRawLiteralChar(c0_); | 571 AddRawLiteralChar(c0_); |
| 572 } | 572 } |
| 573 c0_ = source_->Advance(); | 573 c0_ = source_->Advance(); |
| 574 if (check_surrogate) HandleLeadSurrugate(); | 574 if (check_surrogate) HandleLeadSurrogate(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 void HandleLeadSurrugate() { | 577 void HandleLeadSurrogate() { |
| 578 if (unibrow::Utf16::IsLeadSurrogate(c0_)) { | 578 if (unibrow::Utf16::IsLeadSurrogate(c0_)) { |
|
marja
2015/03/04 08:52:51
So this function is also called when c0_ is not a
| |
| 579 uc32 c1 = source_->Advance(); | 579 uc32 c1 = source_->Advance(); |
| 580 if (!unibrow::Utf16::IsTrailSurrogate(c1)) { | 580 if (!unibrow::Utf16::IsTrailSurrogate(c1)) { |
| 581 source_->PushBack(c1); | 581 source_->PushBack(c1); |
| 582 } else { | 582 } else { |
| 583 c0_ = unibrow::Utf16::CombineSurrogatePair(c0_, c1); | 583 c0_ = unibrow::Utf16::CombineSurrogatePair(c0_, c1); |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 | 587 |
| 588 void PushBack(uc32 ch) { | 588 void PushBack(uc32 ch) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 bool harmony_classes_; | 752 bool harmony_classes_; |
| 753 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL | 753 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL |
| 754 bool harmony_templates_; | 754 bool harmony_templates_; |
| 755 // Whether we allow \u{xxxxx}. | 755 // Whether we allow \u{xxxxx}. |
| 756 bool harmony_unicode_; | 756 bool harmony_unicode_; |
| 757 }; | 757 }; |
| 758 | 758 |
| 759 } } // namespace v8::internal | 759 } } // namespace v8::internal |
| 760 | 760 |
| 761 #endif // V8_SCANNER_H_ | 761 #endif // V8_SCANNER_H_ |
| OLD | NEW |