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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 ErrorMsg("missing exponent digits"); | 378 ErrorMsg("missing exponent digits"); |
379 return; | 379 return; |
380 } | 380 } |
381 while (IsDecimalDigit(c0_)) { | 381 while (IsDecimalDigit(c0_)) { |
382 ReadChar(); | 382 ReadChar(); |
383 } | 383 } |
384 } | 384 } |
385 } | 385 } |
386 if (current_token_.kind != Token::kILLEGAL) { | 386 if (current_token_.kind != Token::kILLEGAL) { |
387 intptr_t len = lookahead_pos_ - token_start_; | 387 intptr_t len = lookahead_pos_ - token_start_; |
388 String& str = String::ZoneHandle(Z, | 388 const String& str = |
389 String::SubString(source_, token_start_, len, Heap::kOld)); | 389 String::ZoneHandle(Z, Symbols::New(source_, token_start_, len)); |
390 str = Symbols::New(str); | |
391 current_token_.literal = &str; | 390 current_token_.literal = &str; |
392 } | 391 } |
393 } | 392 } |
394 | 393 |
395 | 394 |
396 void Scanner::SkipLine() { | 395 void Scanner::SkipLine() { |
397 while (c0_ != '\n' && c0_ != '\0') { | 396 while (c0_ != '\n' && c0_ != '\0') { |
398 ReadChar(); | 397 ReadChar(); |
399 } | 398 } |
400 } | 399 } |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 keywords_[i].keyword_symbol = &Symbols::Keyword(token); | 971 keywords_[i].keyword_symbol = &Symbols::Keyword(token); |
973 | 972 |
974 int ch = keywords_[i].keyword_chars[0] - 'a'; | 973 int ch = keywords_[i].keyword_chars[0] - 'a'; |
975 if (keywords_char_offset_[ch] == Token::kNumKeywords) { | 974 if (keywords_char_offset_[ch] == Token::kNumKeywords) { |
976 keywords_char_offset_[ch] = i; | 975 keywords_char_offset_[ch] = i; |
977 } | 976 } |
978 } | 977 } |
979 } | 978 } |
980 | 979 |
981 } // namespace dart | 980 } // namespace dart |
OLD | NEW |