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

Side by Side Diff: compiler/java/com/google/dart/compiler/parser/DartScanner.java

Issue 10692198: Cache model elements for compiler elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove debug output, tweak for caching Created 8 years, 5 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
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 package com.google.dart.compiler.parser; 5 package com.google.dart.compiler.parser;
6 6
7 import com.google.dart.compiler.metrics.DartEventType; 7 import com.google.dart.compiler.metrics.DartEventType;
8 import com.google.dart.compiler.metrics.Tracer; 8 import com.google.dart.compiler.metrics.Tracer;
9 import com.google.dart.compiler.metrics.Tracer.TraceEvent; 9 import com.google.dart.compiler.metrics.Tracer.TraceEvent;
10 import com.google.dart.compiler.parser.DartScanner.InternalState.Mode;
10 11
11 import java.util.ArrayList; 12 import java.util.ArrayList;
12 import java.util.List; 13 import java.util.List;
13 import java.util.Stack; 14 import java.util.Stack;
14 15
15 /** 16 /**
16 * The Dart scanner. Should normally be used only by {@link DartParser}. 17 * The Dart scanner. Should normally be used only by {@link DartParser}.
17 */ 18 */
18 public class DartScanner { 19 public class DartScanner {
19 20
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 int start = currPos - 1; 1316 int start = currPos - 1;
1316 advance(); 1317 advance();
1317 while (!isEos() && !isLineTerminator(lookahead(0))) 1318 while (!isEos() && !isLineTerminator(lookahead(0)))
1318 advance(); 1319 advance();
1319 int stop = internalState.lookaheadPos[0]; 1320 int stop = internalState.lookaheadPos[0];
1320 commentLocation(start, stop); 1321 commentLocation(start, stop);
1321 return Token.COMMENT; 1322 return Token.COMMENT;
1322 } 1323 }
1323 1324
1324 private void skipWhiteSpace() { 1325 private void skipWhiteSpace() {
1325 if ((internalState.getMode() != InternalState.Mode.DEFAULT) 1326 Mode mode = internalState.getMode();
1326 && (internalState.getMode() != InternalState.Mode.IN_STRING_EMBEDDED_EXP RESSION)) { 1327 if ((mode != InternalState.Mode.DEFAULT)
1328 && (mode != InternalState.Mode.IN_STRING_EMBEDDED_EXPRESSION)) {
1327 return; 1329 return;
1328 } 1330 }
1329 while (true) { 1331 while (true) {
1330 if (isLineTerminator(lookahead(0))) { 1332 int c = lookahead(0);
1331 } else if (!isWhiteSpace(lookahead(0))) { 1333 if (isLineTerminator(c)) {
1334 } else if (!isWhiteSpace(c)) {
1332 break; 1335 break;
1333 } 1336 }
1334 advance(); 1337 advance();
1335 } 1338 }
1336 } 1339 }
1337 } 1340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698