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

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

Issue 23458017: Add null literals to polymer expressions (Closed) Base URL: http://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/eval.dart ('k') | pkg/polymer_expressions/test/eval_test.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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 Expression _parseInvokeOrIdentifier() { 190 Expression _parseInvokeOrIdentifier() {
191 if (_token.value == 'true') { 191 if (_token.value == 'true') {
192 _advance(); 192 _advance();
193 return _astFactory.literal(true); 193 return _astFactory.literal(true);
194 } 194 }
195 if (_token.value == 'false') { 195 if (_token.value == 'false') {
196 _advance(); 196 _advance();
197 return _astFactory.literal(false); 197 return _astFactory.literal(false);
198 } 198 }
199 if (_token.value == 'null') {
200 _advance();
201 return _astFactory.literal(null);
202 }
199 var identifier = _parseIdentifier(); 203 var identifier = _parseIdentifier();
200 var args = _parseArguments(); 204 var args = _parseArguments();
201 if (args == null) { 205 if (args == null) {
202 return identifier; 206 return identifier;
203 } else { 207 } else {
204 return _astFactory.invoke(identifier, null, args); 208 return _astFactory.invoke(identifier, null, args);
205 } 209 }
206 } 210 }
207 211
208 Invoke _parseInvoke() { 212 Invoke _parseInvoke() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return value; 270 return value;
267 } 271 }
268 272
269 Literal<double> _parseDecimal([String prefix = '']) { 273 Literal<double> _parseDecimal([String prefix = '']) {
270 var value = _astFactory.literal(double.parse('$prefix${_token.value}')); 274 var value = _astFactory.literal(double.parse('$prefix${_token.value}'));
271 _advance(); 275 _advance();
272 return value; 276 return value;
273 } 277 }
274 278
275 } 279 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/eval_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698