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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/scanner/Scanner.java

Issue 56933002: Version 0.8.10.1 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. 2 * Copyright (c) 2012, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 InstrumentationBuilder instrumentation = Instrumentation.builder("dart.engin e.AbstractScanner.tokenize"); 163 InstrumentationBuilder instrumentation = Instrumentation.builder("dart.engin e.AbstractScanner.tokenize");
164 int tokenCounter = 0; 164 int tokenCounter = 0;
165 try { 165 try {
166 int next = reader.advance(); 166 int next = reader.advance();
167 while (next != -1) { 167 while (next != -1) {
168 tokenCounter++; 168 tokenCounter++;
169 next = bigSwitch(next); 169 next = bigSwitch(next);
170 } 170 }
171 appendEofToken(); 171 appendEofToken();
172 instrumentation.metric("tokensCount", tokenCounter); 172 instrumentation.metric("tokensCount", tokenCounter);
173 return firstToken(); 173 return getFirstToken();
174 } finally { 174 } finally {
175 instrumentation.log(2); //Log if over 1ms 175 instrumentation.log(2); //Log if over 1ms
176 } 176 }
177 } 177 }
178 178
179 /** 179 /**
180 * Append the given token to the end of the token stream being scanned. This m ethod is intended to 180 * Append the given token to the end of the token stream being scanned. This m ethod is intended to
181 * be used by subclasses that copy existing tokens and should not normally be used because it will 181 * be used by subclasses that copy existing tokens and should not normally be used because it will
182 * fail to correctly associate any comments with the token being passed in. 182 * fail to correctly associate any comments with the token being passed in.
183 * 183 *
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 reportError(ScannerErrorCode.ILLEGAL_CHARACTER, Integer.valueOf(next)); 364 reportError(ScannerErrorCode.ILLEGAL_CHARACTER, Integer.valueOf(next));
365 return reader.advance(); 365 return reader.advance();
366 } 366 }
367 367
368 /** 368 /**
369 * Return the first token in the token stream that was scanned. 369 * Return the first token in the token stream that was scanned.
370 * 370 *
371 * @return the first token in the token stream that was scanned 371 * @return the first token in the token stream that was scanned
372 */ 372 */
373 protected Token firstToken() { 373 protected Token getFirstToken() {
374 return tokens.getNext(); 374 return tokens.getNext();
375 } 375 }
376 376
377 /** 377 /**
378 * Return the last token that was scanned. 378 * Return the last token that was scanned.
379 * 379 *
380 * @return the last token that was scanned 380 * @return the last token that was scanned
381 */ 381 */
382 protected Token getTail() { 382 protected Token getTail() {
383 return tail; 383 return tail;
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 // ~ ~/ ~/= 1152 // ~ ~/ ~/=
1153 next = reader.advance(); 1153 next = reader.advance();
1154 if (next == '/') { 1154 if (next == '/') {
1155 return select('=', TokenType.TILDE_SLASH_EQ, TokenType.TILDE_SLASH); 1155 return select('=', TokenType.TILDE_SLASH_EQ, TokenType.TILDE_SLASH);
1156 } else { 1156 } else {
1157 appendToken(TokenType.TILDE); 1157 appendToken(TokenType.TILDE);
1158 return next; 1158 return next;
1159 } 1159 }
1160 } 1160 }
1161 } 1161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698