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

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

Issue 141703024: Refactor of PolymerExpressions. Adds "as" expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reviewable state. More readable tests. Created 6 years, 10 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 const _OPERATORS = const [_PLUS, _MINUS, _STAR, _SLASH, _BANG, _AMPERSAND, 53 const _OPERATORS = const [_PLUS, _MINUS, _STAR, _SLASH, _BANG, _AMPERSAND,
54 _PERCENT, _LT, _EQ, _GT, _QUESTION, _CARET, _BAR]; 54 _PERCENT, _LT, _EQ, _GT, _QUESTION, _CARET, _BAR];
55 55
56 const _GROUPERS = const [_OPEN_PAREN, _CLOSE_PAREN, 56 const _GROUPERS = const [_OPEN_PAREN, _CLOSE_PAREN,
57 _OPEN_SQUARE_BRACKET, _CLOSE_SQUARE_BRACKET, 57 _OPEN_SQUARE_BRACKET, _CLOSE_SQUARE_BRACKET,
58 _OPEN_CURLY_BRACKET, _CLOSE_CURLY_BRACKET]; 58 _OPEN_CURLY_BRACKET, _CLOSE_CURLY_BRACKET];
59 59
60 const _TWO_CHAR_OPS = const ['==', '!=', '<=', '>=', '||', '&&']; 60 const _TWO_CHAR_OPS = const ['==', '!=', '<=', '>=', '||', '&&'];
61 61
62 const _KEYWORDS = const ['in', 'this']; 62 const _KEYWORDS = const ['as', 'in', 'this'];
63 63
64 const _PRECEDENCE = const { 64 const _PRECEDENCE = const {
65 '!': 0, 65 '!': 0,
66 ':': 0, 66 ':': 0,
67 ',': 0, 67 ',': 0,
68 ')': 0, 68 ')': 0,
69 ']': 0, 69 ']': 0,
70 '}': 0, // ? 70 '}': 0, // ?
71 '?': 1, 71 '?': 1,
72 '||': 2, 72 '||': 2,
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 _tokens.add(new Token(GROUPER_TOKEN, value, _PRECEDENCE[value])); 292 _tokens.add(new Token(GROUPER_TOKEN, value, _PRECEDENCE[value]));
293 _advance(); 293 _advance();
294 } 294 }
295 } 295 }
296 296
297 class ParseException implements Exception { 297 class ParseException implements Exception {
298 final String message; 298 final String message;
299 ParseException(this.message); 299 ParseException(this.message);
300 String toString() => "ParseException: $message"; 300 String toString() => "ParseException: $message";
301 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698