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

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

Issue 10054027: Fix for Issue 2367 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | 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/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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return true; 166 return true;
167 } 167 }
168 168
169 169
170 void Scanner::ReadChar() { 170 void Scanner::ReadChar() {
171 if (lookahead_pos_ < source_length_) { 171 if (lookahead_pos_ < source_length_) {
172 if (c0_ == '\n') { 172 if (c0_ == '\n') {
173 newline_seen_ = true; 173 newline_seen_ = true;
174 c0_pos_.line++; 174 c0_pos_.line++;
175 c0_pos_.column = 0; 175 c0_pos_.column = 0;
176 if (source_.CharAt(lookahead_pos_) == '\r') {
177 if (LookaheadChar(1) == '\n') {
178 lookahead_pos_++;
179 }
180 }
176 } 181 }
177 lookahead_pos_++; 182 lookahead_pos_++;
178 c0_pos_.column++; 183 c0_pos_.column++;
179 c0_ = LookaheadChar(0); 184 c0_ = LookaheadChar(0);
180 // Replace '\r' with '\n' and a sequence of 185 // Replace '\r' with '\n' and a sequence of
hausner 2012/04/11 21:43:58 This comment should probably be slightly adjusted,
siva 2012/04/11 22:04:40 Done.
181 // '\r' '\n' with a single '\n'. 186 // '\r' '\n' with a single '\n'.
182 if (c0_ == '\r') { 187 if (c0_ == '\r') {
183 c0_ = '\n'; 188 c0_ = '\n';
184 if (LookaheadChar(1) == '\n') {
185 lookahead_pos_++;
186 }
187 } 189 }
188 } 190 }
189 } 191 }
190 192
191 193
192 // Look ahead 'how_many' characters. Returns the character, or '\0' if 194 // Look ahead 'how_many' characters. Returns the character, or '\0' if
193 // the lookahead position is beyond the end of the string. Does not 195 // the lookahead position is beyond the end of the string. Does not
194 // normalize line end characters into '\n'. 196 // normalize line end characters into '\n'.
195 int32_t Scanner::LookaheadChar(int how_many) { 197 int32_t Scanner::LookaheadChar(int how_many) {
196 ASSERT(how_many >= 0); 198 ASSERT(how_many >= 0);
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 "%c%"PRIxPTR, kPrivateKeySeparator, key_value); 914 "%c%"PRIxPTR, kPrivateKeySeparator, key_value);
913 const String& result = String::Handle(String::New(private_key)); 915 const String& result = String::Handle(String::New(private_key));
914 return result.raw(); 916 return result.raw();
915 } 917 }
916 918
917 919
918 void Scanner::InitOnce() { 920 void Scanner::InitOnce() {
919 } 921 }
920 922
921 } // namespace dart 923 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698