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

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

Issue 11312203: "Reverting 14829-14832" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « utils/pub/version.dart ('k') | utils/pub/yaml/model.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 c10e5e818c6ed17bb752237db3fa8e998b096498..9558443991aa293cbf2b9277a693657680d3d24d 100644
--- a/utils/pub/yaml/composer.dart
+++ b/utils/pub/yaml/composer.dart
@@ -106,13 +106,13 @@ class _Composer extends _Visitor {
/** Parses a null scalar. */
_ScalarNode parseNull(String content) {
- if (!new RegExp("^(null|Null|NULL|~|)\$").hasMatch(content)) return null;
+ if (!const RegExp("^(null|Null|NULL|~|)\$").hasMatch(content)) return null;
return new _ScalarNode(_Tag.yaml("null"), value: null);
}
/** Parses a boolean scalar. */
_ScalarNode parseBool(String content) {
- var match = new RegExp("^(?:(true|True|TRUE)|(false|False|FALSE))\$").
+ var match = const RegExp("^(?:(true|True|TRUE)|(false|False|FALSE))\$").
firstMatch(content);
if (match == null) return null;
return new _ScalarNode(_Tag.yaml("bool"), value: match.group(1) != null);
@@ -120,13 +120,13 @@ class _Composer extends _Visitor {
/** Parses an integer scalar. */
_ScalarNode parseInt(String content) {
- var match = new RegExp("^[-+]?[0-9]+\$").firstMatch(content);
+ var match = const RegExp("^[-+]?[0-9]+\$").firstMatch(content);
if (match != null) {
return new _ScalarNode(_Tag.yaml("int"),
value: Math.parseInt(match.group(0)));
}
- match = new RegExp("^0o([0-7]+)\$").firstMatch(content);
+ match = const RegExp("^0o([0-7]+)\$").firstMatch(content);
if (match != null) {
// TODO(nweiz): clean this up when Dart can parse an octal string
var n = 0;
@@ -137,7 +137,7 @@ class _Composer extends _Visitor {
return new _ScalarNode(_Tag.yaml("int"), value: n);
}
- match = new RegExp("^0x[0-9a-fA-F]+\$").firstMatch(content);
+ match = const RegExp("^0x[0-9a-fA-F]+\$").firstMatch(content);
if (match != null) {
return new _ScalarNode(_Tag.yaml("int"),
value: Math.parseInt(match.group(0)));
@@ -148,7 +148,7 @@ class _Composer extends _Visitor {
/** Parses a floating-point scalar. */
_ScalarNode parseFloat(String content) {
- var match = new RegExp(
+ var match = const RegExp(
"^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?\$").
firstMatch(content);
if (match != null) {
@@ -159,14 +159,14 @@ class _Composer extends _Visitor {
value: Math.parseDouble(matchStr));
}
- match = new RegExp("^([+-]?)\.(inf|Inf|INF)\$").firstMatch(content);
+ 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(infinityStr));
}
- match = new RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content);
+ match = const RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content);
if (match != null) {
return new _ScalarNode(_Tag.yaml("float"),
value: Math.parseDouble("NaN"));
« no previous file with comments | « utils/pub/version.dart ('k') | utils/pub/yaml/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698