Chromium Code Reviews| Index: utils/pub/yaml/composer.dart |
| diff --git a/utils/pub/yaml/composer.dart b/utils/pub/yaml/composer.dart |
| index ada81267d8c453120cd7f45035b72085b8656d54..397bb61bf04071c630b936dabd790d43b3ed2c95 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 infStr = match.group(1) == "-" ? "-Infinity" : "Infinity"; |
|
Bob Nystrom
2012/05/18 21:06:30
wflly shrt nm. How about "infinity"?
nweiz
2012/05/18 21:47:04
Done.
|
| return new _ScalarNode(_Tag.yaml("float"), |
| - value: Math.parseDouble("${match.group(1)}Infinity")); |
| + value: Math.parseDouble(infStr)); |
| } |
| match = const RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content); |