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

Side by Side Diff: utils/pub/yaml/composer.dart

Issue 11263040: Make String.charCodes a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/pub/yaml/model.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Takes a parsed YAML document (what the spec calls the "serialization tree") 6 * Takes a parsed YAML document (what the spec calls the "serialization tree")
7 * and resolves aliases, resolves tags, and parses scalars to produce the 7 * and resolves aliases, resolves tags, and parses scalars to produce the
8 * "representation graph". 8 * "representation graph".
9 */ 9 */
10 class _Composer extends _Visitor { 10 class _Composer extends _Visitor {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 var match = const RegExp("^[-+]?[0-9]+\$").firstMatch(content); 123 var match = const RegExp("^[-+]?[0-9]+\$").firstMatch(content);
124 if (match != null) { 124 if (match != null) {
125 return new _ScalarNode(_Tag.yaml("int"), 125 return new _ScalarNode(_Tag.yaml("int"),
126 value: Math.parseInt(match.group(0))); 126 value: Math.parseInt(match.group(0)));
127 } 127 }
128 128
129 match = const RegExp("^0o([0-7]+)\$").firstMatch(content); 129 match = const RegExp("^0o([0-7]+)\$").firstMatch(content);
130 if (match != null) { 130 if (match != null) {
131 // TODO(nweiz): clean this up when Dart can parse an octal string 131 // TODO(nweiz): clean this up when Dart can parse an octal string
132 var n = 0; 132 var n = 0;
133 for (var c in match.group(1).charCodes()) { 133 for (var c in match.group(1).charCodes) {
134 n *= 8; 134 n *= 8;
135 n += c - 48; 135 n += c - 48;
136 } 136 }
137 return new _ScalarNode(_Tag.yaml("int"), value: n); 137 return new _ScalarNode(_Tag.yaml("int"), value: n);
138 } 138 }
139 139
140 match = const RegExp("^0x[0-9a-fA-F]+\$").firstMatch(content); 140 match = const RegExp("^0x[0-9a-fA-F]+\$").firstMatch(content);
141 if (match != null) { 141 if (match != null) {
142 return new _ScalarNode(_Tag.yaml("int"), 142 return new _ScalarNode(_Tag.yaml("int"),
143 value: Math.parseInt(match.group(0))); 143 value: Math.parseInt(match.group(0)));
(...skipping 28 matching lines...) Expand all
172 value: Math.parseDouble("NaN")); 172 value: Math.parseDouble("NaN"));
173 } 173 }
174 174
175 return null; 175 return null;
176 } 176 }
177 177
178 /** Parses a string scalar. */ 178 /** Parses a string scalar. */
179 _ScalarNode parseString(String content) => 179 _ScalarNode parseString(String content) =>
180 new _ScalarNode(_Tag.yaml("str"), value: content); 180 new _ScalarNode(_Tag.yaml("str"), value: content);
181 } 181 }
OLDNEW
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/pub/yaml/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698