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

Side by Side Diff: utils/template/tokenizer_base.dart

Issue 10399010: Fixed breakage in template utility now that statics aren't inherited. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix to calculator and template UI tests. Created 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Generated by scripts/tokenizer_gen.py. 4 // Generated by scripts/tokenizer_gen.py.
5 5
6 6
7 interface TokenSource { 7 interface TokenSource {
8 Token next(); 8 Token next();
9 } 9 }
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 if (_skipWhitespace) { 152 if (_skipWhitespace) {
153 return next(); 153 return next();
154 } else { 154 } else {
155 return _finishToken(TokenKind.COMMENT); 155 return _finishToken(TokenKind.COMMENT);
156 } 156 }
157 } 157 }
158 158
159 void eatDigits() { 159 void eatDigits() {
160 while (_index < _text.length) { 160 while (_index < _text.length) {
161 if (isDigit(_text.charCodeAt(_index))) { 161 if (TokenizerHelpers.isDigit(_text.charCodeAt(_index))) {
162 _index++; 162 _index++;
163 } else { 163 } else {
164 return; 164 return;
165 } 165 }
166 } 166 }
167 } 167 }
168 168
169 static int _hexDigit(int c) { 169 static int _hexDigit(int c) {
170 if(c >= 48/*0*/ && c <= 57/*9*/) { 170 if(c >= 48/*0*/ && c <= 57/*9*/) {
171 return c - 48; 171 return c - 48;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 return result; 209 return result;
210 } 210 }
211 211
212 Token finishNumber() { 212 Token finishNumber() {
213 eatDigits(); 213 eatDigits();
214 214
215 if (_peekChar() == 46/*.*/) { 215 if (_peekChar() == 46/*.*/) {
216 // Handle the case of 1.toString(). 216 // Handle the case of 1.toString().
217 _nextChar(); 217 _nextChar();
218 if (isDigit(_peekChar())) { 218 if (TokenizerHelpers.isDigit(_peekChar())) {
219 eatDigits(); 219 eatDigits();
220 return finishNumberExtra(TokenKind.DOUBLE); 220 return finishNumberExtra(TokenKind.DOUBLE);
221 } else { 221 } else {
222 _index--; 222 _index--;
223 } 223 }
224 } 224 }
225 225
226 return finishNumberExtra(TokenKind.INTEGER); 226 return finishNumberExtra(TokenKind.INTEGER);
227 } 227 }
228 228
229 Token finishNumberExtra(int kind) { 229 Token finishNumberExtra(int kind) {
230 if (_maybeEatChar(101/*e*/) || _maybeEatChar(69/*E*/)) { 230 if (_maybeEatChar(101/*e*/) || _maybeEatChar(69/*E*/)) {
231 kind = TokenKind.DOUBLE; 231 kind = TokenKind.DOUBLE;
232 _maybeEatChar(45/*-*/); 232 _maybeEatChar(45/*-*/);
233 _maybeEatChar(43/*+*/); 233 _maybeEatChar(43/*+*/);
234 eatDigits(); 234 eatDigits();
235 } 235 }
236 if (_peekChar() != 0 && isIdentifierStart(_peekChar())) { 236 if (_peekChar() != 0 && TokenizerHelpers.isIdentifierStart(_peekChar())) {
237 _nextChar(); 237 _nextChar();
238 return _errorToken("illegal character in number"); 238 return _errorToken("illegal character in number");
239 } 239 }
240 240
241 return _finishToken(kind); 241 return _finishToken(kind);
242 } 242 }
243 243
244 Token _makeStringToken(List<int> buf, bool isPart) { 244 Token _makeStringToken(List<int> buf, bool isPart) {
245 final s = new String.fromCharCodes(buf); 245 final s = new String.fromCharCodes(buf);
246 final kind = isPart ? TokenKind.STRING_PART : TokenKind.STRING; 246 final kind = isPart ? TokenKind.STRING_PART : TokenKind.STRING;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 return hexValue; 421 return hexValue;
422 } else if (hexValue <= 0x10FFFF){ 422 } else if (hexValue <= 0x10FFFF){
423 world.fatal('unicode values greater than 2 bytes not implemented yet'); 423 world.fatal('unicode values greater than 2 bytes not implemented yet');
424 return -1; 424 return -1;
425 } else { 425 } else {
426 return -1; 426 return -1;
427 } 427 }
428 } 428 }
429 429
430 Token finishDot() { 430 Token finishDot() {
431 if (isDigit(_peekChar())) { 431 if (TokenizerHelpers.isDigit(_peekChar())) {
432 eatDigits(); 432 eatDigits();
433 return finishNumberExtra(TokenKind.DOUBLE); 433 return finishNumberExtra(TokenKind.DOUBLE);
434 } else { 434 } else {
435 return _finishToken(TokenKind.DOT); 435 return _finishToken(TokenKind.DOT);
436 } 436 }
437 } 437 }
438 438
439 Token finishIdentifier() { 439 Token finishIdentifier() {
440 if (_interpStack != null && _interpStack.depth == -1) { 440 if (_interpStack != null && _interpStack.depth == -1) {
441 _interpStack.depth = 0; 441 _interpStack.depth = 0;
442 while (_index < _text.length) { 442 while (_index < _text.length) {
443 if (!isInterpIdentifierPart(_text.charCodeAt(_index++))) { 443 if (!TokenizerHelpers.isInterpIdentifierPart(
444 _text.charCodeAt(_index++))) {
444 _index--; 445 _index--;
445 break; 446 break;
446 } 447 }
447 } 448 }
448 } else { 449 } else {
449 while (_index < _text.length) { 450 while (_index < _text.length) {
450 if (!isIdentifierPart(_text.charCodeAt(_index++))) { 451 if (!TokenizerHelpers.isIdentifierPart(_text.charCodeAt(_index++))) {
451 _index--; 452 _index--;
452 break; 453 break;
453 } 454 }
454 } 455 }
455 } 456 }
456 int kind = getIdentifierKind(); 457 int kind = getIdentifierKind();
457 if (kind == TokenKind.IDENTIFIER) { 458 if (kind == TokenKind.IDENTIFIER) {
458 return _finishToken(TokenKind.IDENTIFIER); 459 return _finishToken(TokenKind.IDENTIFIER);
459 } else { 460 } else {
460 return _finishToken(kind); 461 return _finishToken(kind);
461 } 462 }
462 } 463 }
463 } 464 }
464 465
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698