Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/scanner.h" | 5 #include "vm/scanner.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 574 // Strings are canonicalized: Allocate a symbol. | 574 // Strings are canonicalized: Allocate a symbol. |
| 575 current_token_.literal = &String::ZoneHandle( | 575 current_token_.literal = &String::ZoneHandle( |
| 576 Symbols::FromUTF32(string_chars.data(), string_chars.length())); | 576 Symbols::FromUTF32(string_chars.data(), string_chars.length())); |
| 577 } | 577 } |
| 578 EndStringLiteral(); | 578 EndStringLiteral(); |
| 579 return; | 579 return; |
| 580 } else { | 580 } else { |
| 581 string_chars.Add(string_delimiter_); | 581 string_chars.Add(string_delimiter_); |
| 582 } | 582 } |
| 583 } else { | 583 } else { |
| 584 string_chars.Add(c0_); | 584 // Test for a two part utf16 sequence, and decode to a code point |
| 585 // if we find one. | |
| 586 int32_t ch1 = c0_; | |
| 587 if (Utf16::IsLeadSurrogate(ch1)) { | |
| 588 ReadChar(); | |
| 589 const int32_t ch2 = c0_; | |
| 590 if (Utf16::IsTrailSurrogate(ch2)) { | |
| 591 ch1 = Utf16::Decode(ch1, ch2); | |
| 592 } else { | |
| 593 string_chars.Add(ch1); | |
| 594 continue; | |
|
Ivan Posva
2013/08/14 05:21:52
Can you restructure this to avoid the continue?
zra
2013/08/14 14:59:11
Yes. Missed the LookaheadChar function before.
| |
| 595 } | |
| 596 } | |
| 597 string_chars.Add(ch1); | |
| 585 } | 598 } |
| 586 ReadChar(); | 599 ReadChar(); |
| 587 } | 600 } |
| 588 } | 601 } |
| 589 | 602 |
| 590 | 603 |
| 591 void Scanner::Scan() { | 604 void Scanner::Scan() { |
| 592 newline_seen_ = false; | 605 newline_seen_ = false; |
| 593 | 606 |
| 594 do { | 607 do { |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 940 "%c%#"Px"", kPrivateKeySeparator, key_value); | 953 "%c%#"Px"", kPrivateKeySeparator, key_value); |
| 941 const String& result = String::Handle(String::New(private_key, Heap::kOld)); | 954 const String& result = String::Handle(String::New(private_key, Heap::kOld)); |
| 942 return result.raw(); | 955 return result.raw(); |
| 943 } | 956 } |
| 944 | 957 |
| 945 | 958 |
| 946 void Scanner::InitOnce() { | 959 void Scanner::InitOnce() { |
| 947 } | 960 } |
| 948 | 961 |
| 949 } // namespace dart | 962 } // namespace dart |
| OLD | NEW |