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/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } else { | 477 } else { |
478 ReadChar(); // Skip left curly bracket. | 478 ReadChar(); // Skip left curly bracket. |
479 is_valid = ScanHexDigits(1, 6, code_point); | 479 is_valid = ScanHexDigits(1, 6, code_point); |
480 if (is_valid) { | 480 if (is_valid) { |
481 if (c0_ != '}') { | 481 if (c0_ != '}') { |
482 ErrorMsg("expected '}' after character code"); | 482 ErrorMsg("expected '}' after character code"); |
483 return; | 483 return; |
484 } | 484 } |
485 } | 485 } |
486 } | 486 } |
487 if (is_valid && | 487 if (is_valid && (Utf::IsOutOfRange(*code_point))) { |
488 ((Utf::IsOutOfRange(*code_point) || | |
489 (Utf16::IsSurrogate(*code_point))))) { | |
490 ErrorMsg("invalid code point"); | 488 ErrorMsg("invalid code point"); |
491 } | 489 } |
492 } | 490 } |
493 | 491 |
494 | 492 |
495 void Scanner::ScanLiteralStringChars(bool is_raw, bool remove_whitespace) { | 493 void Scanner::ScanLiteralStringChars(bool is_raw, bool remove_whitespace) { |
496 GrowableArray<int32_t> string_chars(64); | 494 GrowableArray<int32_t> string_chars(64); |
497 | 495 |
498 ASSERT(IsScanningString()); | 496 ASSERT(IsScanningString()); |
499 // We are at the first character of a string literal piece. A string literal | 497 // We are at the first character of a string literal piece. A string literal |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 keywords_[i].keyword_symbol = &Symbols::Token(token); | 952 keywords_[i].keyword_symbol = &Symbols::Token(token); |
955 | 953 |
956 int ch = keywords_[i].keyword_chars[0] - 'a'; | 954 int ch = keywords_[i].keyword_chars[0] - 'a'; |
957 if (keywords_char_offset_[ch] == Token::kNumKeywords) { | 955 if (keywords_char_offset_[ch] == Token::kNumKeywords) { |
958 keywords_char_offset_[ch] = i; | 956 keywords_char_offset_[ch] = i; |
959 } | 957 } |
960 } | 958 } |
961 } | 959 } |
962 | 960 |
963 } // namespace dart | 961 } // namespace dart |
OLD | NEW |