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

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

Issue 10456060: Eliminate unary plus with hex literals (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « no previous file | tests/co19/co19-leg.status » ('j') | 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/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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 switch (c0_) { 625 switch (c0_) {
626 case '\0': 626 case '\0':
627 current_token_.kind = Token::kEOS; 627 current_token_.kind = Token::kEOS;
628 break; 628 break;
629 629
630 case '+': // + ++ += 630 case '+': // + ++ +=
631 ReadChar(); 631 ReadChar();
632 current_token_.kind = 632 current_token_.kind =
633 IsNumberStart(c0_) ? Token::kTIGHTADD : Token::kADD; 633 IsNumberStart(c0_) ? Token::kTIGHTADD : Token::kADD;
634 if (c0_ == '+') { 634 // Unary + is not allowed for hexadecimal integers, so treat the
635 // + as a binary operator.
636 if ((c0_ == '0') &&
637 ((LookaheadChar(1) == 'x') || (LookaheadChar(1) == 'X'))) {
638 current_token_.kind = Token::kADD;
639 } else if (c0_ == '+') {
635 Recognize(Token::kINCR); 640 Recognize(Token::kINCR);
636 } else if (c0_ == '=') { 641 } else if (c0_ == '=') {
637 Recognize(Token::kASSIGN_ADD); 642 Recognize(Token::kASSIGN_ADD);
638 } 643 }
639 break; 644 break;
640 645
641 case '-': // - -- -= 646 case '-': // - -- -=
642 Recognize(Token::kSUB); 647 Recognize(Token::kSUB);
643 if (c0_ == '-') { 648 if (c0_ == '-') {
644 Recognize(Token::kDECR); 649 Recognize(Token::kDECR);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 "%c%"PRIxPTR, kPrivateKeySeparator, key_value); 925 "%c%"PRIxPTR, kPrivateKeySeparator, key_value);
921 const String& result = String::Handle(String::New(private_key)); 926 const String& result = String::Handle(String::New(private_key));
922 return result.raw(); 927 return result.raw();
923 } 928 }
924 929
925 930
926 void Scanner::InitOnce() { 931 void Scanner::InitOnce() {
927 } 932 }
928 933
929 } // namespace dart 934 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698