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

Side by Side Diff: dart/pkg/polymer_expressions/lib/tokenizer.dart

Issue 336013003: Version 1.5.0-dev.4.14 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library polymer_expressions.tokenizer; 5 library polymer_expressions.tokenizer;
6 6
7 const int _TAB = 9; 7 const int _TAB = 9;
8 const int _LF = 10; 8 const int _LF = 10;
9 const int _VTAB = 11; 9 const int _VTAB = 11;
10 const int _FF = 12; 10 const int _FF = 12;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 '?': 1, 71 '?': 1,
72 '||': 2, 72 '||': 2,
73 '&&': 3, 73 '&&': 3,
74 '|': 4, 74 '|': 4,
75 '^': 5, 75 '^': 5,
76 '&': 6, 76 '&': 6,
77 77
78 // equality 78 // equality
79 '!=': 7, 79 '!=': 7,
80 '==': 7, 80 '==': 7,
81 '!==': 7,
82 '===': 7,
81 83
82 // relational 84 // relational
83 '>=': 8, 85 '>=': 8,
84 '>': 8, 86 '>': 8,
85 '<=': 8, 87 '<=': 8,
86 '<': 8, 88 '<': 8,
87 89
88 // additive 90 // additive
89 '+': 9, 91 '+': 9,
90 '-': 9, 92 '-': 9,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 tokenizeOperator() { 273 tokenizeOperator() {
272 int startChar = _next; 274 int startChar = _next;
273 _advance(); 275 _advance();
274 var op; 276 var op;
275 // check for 2 character operators 277 // check for 2 character operators
276 if (isOperator(_next)) { 278 if (isOperator(_next)) {
277 var op2 = new String.fromCharCodes([startChar, _next]); 279 var op2 = new String.fromCharCodes([startChar, _next]);
278 if (_TWO_CHAR_OPS.contains(op2)) { 280 if (_TWO_CHAR_OPS.contains(op2)) {
279 op = op2; 281 op = op2;
280 _advance(); 282 _advance();
283 // kind of hacky check for === and !===, could be better / more general
284 if (_next == _EQ && (startChar == _BANG || startChar == _EQ)) {
285 op = op2 + '=';
286 _advance();
287 }
281 } else { 288 } else {
282 op = new String.fromCharCode(startChar); 289 op = new String.fromCharCode(startChar);
283 } 290 }
284 } else { 291 } else {
285 op = new String.fromCharCode(startChar); 292 op = new String.fromCharCode(startChar);
286 } 293 }
287 _tokens.add(new Token(OPERATOR_TOKEN, op, _PRECEDENCE[op])); 294 _tokens.add(new Token(OPERATOR_TOKEN, op, _PRECEDENCE[op]));
288 } 295 }
289 296
290 tokenizeGrouper() { 297 tokenizeGrouper() {
291 var value = new String.fromCharCode(_next); 298 var value = new String.fromCharCode(_next);
292 _tokens.add(new Token(GROUPER_TOKEN, value, _PRECEDENCE[value])); 299 _tokens.add(new Token(GROUPER_TOKEN, value, _PRECEDENCE[value]));
293 _advance(); 300 _advance();
294 } 301 }
295 } 302 }
296 303
297 class ParseException implements Exception { 304 class ParseException implements Exception {
298 final String message; 305 final String message;
299 ParseException(this.message); 306 ParseException(this.message);
300 String toString() => "ParseException: $message"; 307 String toString() => "ParseException: $message";
301 } 308 }
OLDNEW
« no previous file with comments | « dart/pkg/polymer_expressions/lib/polymer_expressions.dart ('k') | dart/pkg/polymer_expressions/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698