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

Unified Diff: utils/pub/yaml/composer.dart

Issue 10377186: Support a much larger subset of YAML. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review chagnes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/pub/yaml/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/yaml/composer.dart
diff --git a/utils/pub/yaml/composer.dart b/utils/pub/yaml/composer.dart
index ada81267d8c453120cd7f45035b72085b8656d54..d915294660833f15014156d230bf35400aeda73b 100644
--- a/utils/pub/yaml/composer.dart
+++ b/utils/pub/yaml/composer.dart
@@ -152,14 +152,18 @@ class _Composer extends _Visitor {
"^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?\$").
firstMatch(content);
if (match != null) {
+ // YAML allows floats of the form "0.", but Dart does not. Fix up those
+ // floats by removing the trailing dot.
+ var matchStr = match.group(0).replaceAll(new RegExp(@"\.$"), "");
return new _ScalarNode(_Tag.yaml("float"),
- value: Math.parseDouble(match.group(0)));
+ value: Math.parseDouble(matchStr));
}
match = const RegExp("^([+-]?)\.(inf|Inf|INF)\$").firstMatch(content);
if (match != null) {
+ var infinityStr = match.group(1) == "-" ? "-Infinity" : "Infinity";
return new _ScalarNode(_Tag.yaml("float"),
- value: Math.parseDouble("${match.group(1)}Infinity"));
+ value: Math.parseDouble(infinityStr));
}
match = const RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content);
« no previous file with comments | « no previous file | utils/pub/yaml/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698