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

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

Issue 23724005: Eliminating some dart2js warnings from polymer_expressions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « pkg/polymer_expressions/lib/expression.dart ('k') | pkg/polymer_expressions/lib/tokenizer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.parser; 5 library polymer_expressions.parser;
6 6
7 import 'tokenizer.dart'; 7 import 'tokenizer.dart';
8 import 'expression.dart'; 8 import 'expression.dart';
9 9
10 const _UNARY_OPERATORS = const ['+', '-', '!']; 10 const _UNARY_OPERATORS = const ['+', '-', '!'];
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 var kind = _token.kind; 127 var kind = _token.kind;
128 switch (kind) { 128 switch (kind) {
129 case KEYWORD_TOKEN: 129 case KEYWORD_TOKEN:
130 var keyword = _token.value; 130 var keyword = _token.value;
131 if (keyword == 'this') { 131 if (keyword == 'this') {
132 _advance(); 132 _advance();
133 // TODO(justin): return keyword node 133 // TODO(justin): return keyword node
134 return _astFactory.identifier('this'); 134 return _astFactory.identifier('this');
135 } else if (keyword == 'in') { 135 } else if (keyword == 'in') {
136 return null; 136 return null;
137 } else {
138 throw new ArgumentError('unrecognized keyword: $keyword');
139 } 137 }
140 break; 138 throw new ArgumentError('unrecognized keyword: $keyword');
141 case IDENTIFIER_TOKEN: 139 case IDENTIFIER_TOKEN:
142 return _parseInvokeOrIdentifier(); 140 return _parseInvokeOrIdentifier();
143 break;
144 case STRING_TOKEN: 141 case STRING_TOKEN:
145 return _parseString(); 142 return _parseString();
146 break;
147 case INTEGER_TOKEN: 143 case INTEGER_TOKEN:
148 return _parseInteger(); 144 return _parseInteger();
149 break;
150 case DECIMAL_TOKEN: 145 case DECIMAL_TOKEN:
151 return _parseDecimal(); 146 return _parseDecimal();
152 break;
153 case GROUPER_TOKEN: 147 case GROUPER_TOKEN:
154 if (_token.value == '(') { 148 if (_token.value == '(') {
155 return _parseParenthesized(); 149 return _parseParenthesized();
156 } else if (_token.value == '{') { 150 } else if (_token.value == '{') {
157 return _parseMapLiteral(); 151 return _parseMapLiteral();
158 } 152 }
159 return null; 153 return null;
160 break;
161 default: 154 default:
162 return null; 155 return null;
163 } 156 }
164 } 157 }
165 158
166 MapLiteral _parseMapLiteral() { 159 MapLiteral _parseMapLiteral() {
167 var entries = []; 160 var entries = [];
168 do { 161 do {
169 _advance(); 162 _advance();
170 if (_token.kind == GROUPER_TOKEN && _token.value == '}') { 163 if (_token.kind == GROUPER_TOKEN && _token.value == '}') {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return value; 266 return value;
274 } 267 }
275 268
276 Literal<double> _parseDecimal([String prefix = '']) { 269 Literal<double> _parseDecimal([String prefix = '']) {
277 var value = _astFactory.literal(double.parse('$prefix${_token.value}')); 270 var value = _astFactory.literal(double.parse('$prefix${_token.value}'));
278 _advance(); 271 _advance();
279 return value; 272 return value;
280 } 273 }
281 274
282 } 275 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/lib/expression.dart ('k') | pkg/polymer_expressions/lib/tokenizer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698