Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: runtime/vm/scanner.cc

Issue 289893002: - Make use of the fact that idents and literals are symbols. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ErrorMsg("missing exponent digits"); 362 ErrorMsg("missing exponent digits");
363 return; 363 return;
364 } 364 }
365 while (IsDecimalDigit(c0_)) { 365 while (IsDecimalDigit(c0_)) {
366 ReadChar(); 366 ReadChar();
367 } 367 }
368 } 368 }
369 } 369 }
370 if (current_token_.kind != Token::kILLEGAL) { 370 if (current_token_.kind != Token::kILLEGAL) {
371 intptr_t len = lookahead_pos_ - token_start_; 371 intptr_t len = lookahead_pos_ - token_start_;
372 current_token_.literal = 372 String& str = String::ZoneHandle(
373 &String::ZoneHandle( 373 String::SubString(source_, token_start_, len, Heap::kOld));
374 String::SubString(source_, token_start_, len, Heap::kOld)); 374 str = Symbols::New(str);
375 current_token_.literal = &str;
375 } 376 }
376 } 377 }
377 378
378 379
379 void Scanner::SkipLine() { 380 void Scanner::SkipLine() {
380 while (c0_ != '\n' && c0_ != '\0') { 381 while (c0_ != '\n' && c0_ != '\0') {
381 ReadChar(); 382 ReadChar();
382 } 383 }
383 } 384 }
384 385
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 for (int i = 0; i < Token::numKeywords; i++) { 940 for (int i = 0; i < Token::numKeywords; i++) {
940 Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i); 941 Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i);
941 keywords_[i].kind = token; 942 keywords_[i].kind = token;
942 keywords_[i].keyword_chars = Token::Str(token); 943 keywords_[i].keyword_chars = Token::Str(token);
943 keywords_[i].keyword_len = strlen(Token::Str(token)); 944 keywords_[i].keyword_len = strlen(Token::Str(token));
944 keywords_[i].keyword_symbol = &Symbols::Keyword(token); 945 keywords_[i].keyword_symbol = &Symbols::Keyword(token);
945 } 946 }
946 } 947 }
947 948
948 } // namespace dart 949 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698