| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 393 |
| 394 void Scanner::SkipLine() { | 394 void Scanner::SkipLine() { |
| 395 while (c0_ != '\n' && c0_ != '\0') { | 395 while (c0_ != '\n' && c0_ != '\0') { |
| 396 ReadChar(); | 396 ReadChar(); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 | 400 |
| 401 void Scanner::ScanScriptTag() { | 401 void Scanner::ScanScriptTag() { |
| 402 ReadChar(); | 402 ReadChar(); |
| 403 if (c0_ == '!') { | 403 ASSERT(c0_ == '!'); |
| 404 Recognize(Token::kSCRIPTTAG); | 404 Recognize(Token::kSCRIPTTAG); |
| 405 // The script tag extends to the end of the line. Just treat this | 405 // The script tag extends to the end of the line. Just treat this |
| 406 // similar to a line comment. | 406 // similar to a line comment. |
| 407 SkipLine(); | 407 SkipLine(); |
| 408 return; | |
| 409 } else { | |
| 410 ErrorMsg("unexpected character: '#'"); | |
| 411 SkipLine(); | |
| 412 return; | |
| 413 } | |
| 414 } | 408 } |
| 415 | 409 |
| 416 | 410 |
| 417 void Scanner::ScanLiteralString(bool is_raw) { | 411 void Scanner::ScanLiteralString(bool is_raw) { |
| 418 ASSERT(!IsScanningString()); | 412 ASSERT(!IsScanningString()); |
| 419 ASSERT(c0_ == '"' || c0_ == '\''); | 413 ASSERT(c0_ == '"' || c0_ == '\''); |
| 420 | 414 |
| 421 // Entering string scanning mode. | 415 // Entering string scanning mode. |
| 422 BeginStringLiteral(c0_); | 416 BeginStringLiteral(c0_); |
| 423 string_is_multiline_ = (LookaheadChar(1) == c0_) && | 417 string_is_multiline_ = (LookaheadChar(1) == c0_) && |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 ScanIdent(); | 824 ScanIdent(); |
| 831 } | 825 } |
| 832 break; | 826 break; |
| 833 | 827 |
| 834 case '"': | 828 case '"': |
| 835 case '\'': | 829 case '\'': |
| 836 ScanLiteralString(false); | 830 ScanLiteralString(false); |
| 837 break; | 831 break; |
| 838 | 832 |
| 839 case '#': | 833 case '#': |
| 840 ScanScriptTag(); | 834 if (LookaheadChar(1) == '!') { |
| 835 ScanScriptTag(); |
| 836 } else { |
| 837 Recognize(Token::kHASH); |
| 838 } |
| 841 break; | 839 break; |
| 842 | 840 |
| 843 default: | 841 default: |
| 844 if (IsIdentStartChar(c0_)) { | 842 if (IsIdentStartChar(c0_)) { |
| 845 ScanIdent(); | 843 ScanIdent(); |
| 846 } else if (IsDecimalDigit(c0_)) { | 844 } else if (IsDecimalDigit(c0_)) { |
| 847 ScanNumber(false); | 845 ScanNumber(false); |
| 848 } else { | 846 } else { |
| 849 char msg[128]; | 847 char msg[128]; |
| 850 char utf8_char[5]; | 848 char utf8_char[5]; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 "%c%#" Px "", kPrivateKeySeparator, key_value); | 948 "%c%#" Px "", kPrivateKeySeparator, key_value); |
| 951 const String& result = String::Handle(String::New(private_key, Heap::kOld)); | 949 const String& result = String::Handle(String::New(private_key, Heap::kOld)); |
| 952 return result.raw(); | 950 return result.raw(); |
| 953 } | 951 } |
| 954 | 952 |
| 955 | 953 |
| 956 void Scanner::InitOnce() { | 954 void Scanner::InitOnce() { |
| 957 } | 955 } |
| 958 | 956 |
| 959 } // namespace dart | 957 } // namespace dart |
| OLD | NEW |