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

Side by Side Diff: utils/pub/yaml/model.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/yaml/composer.dart ('k') | utils/tests/pub/test_pub.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 // This file contains the node classes for the internal representations of YAML 5 // This file contains the node classes for the internal representations of YAML
6 // documents. These nodes are used for both the serialization tree and the 6 // documents. These nodes are used for both the serialization tree and the
7 // representation graph. 7 // representation graph.
8 8
9 /** A tag that indicates the type of a YAML node. */ 9 /** A tag that indicates the type of a YAML node. */
10 class _Tag { 10 class _Tag {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // 20 is the maximum value for this argument, which we use since YAML 146 // 20 is the maximum value for this argument, which we use since YAML
147 // doesn't specify a maximum. 147 // doesn't specify a maximum.
148 return value.toStringAsExponential(20). 148 return value.toStringAsExponential(20).
149 replaceFirst(const RegExp("0+e"), "e"); 149 replaceFirst(const RegExp("0+e"), "e");
150 } 150 }
151 151
152 if (value is String) { 152 if (value is String) {
153 // TODO(nweiz): This could be faster if we used a RegExp to check for 153 // TODO(nweiz): This could be faster if we used a RegExp to check for
154 // special characters and short-circuited if they didn't exist. 154 // special characters and short-circuited if they didn't exist.
155 155
156 var escapedValue = value.charCodes().map((c) { 156 var escapedValue = value.charCodes.map((c) {
157 switch (c) { 157 switch (c) {
158 case _Parser.TAB: return "\\t"; 158 case _Parser.TAB: return "\\t";
159 case _Parser.LF: return "\\n"; 159 case _Parser.LF: return "\\n";
160 case _Parser.CR: return "\\r"; 160 case _Parser.CR: return "\\r";
161 case _Parser.DOUBLE_QUOTE: return '\\"'; 161 case _Parser.DOUBLE_QUOTE: return '\\"';
162 case _Parser.NULL: return "\\0"; 162 case _Parser.NULL: return "\\0";
163 case _Parser.BELL: return "\\a"; 163 case _Parser.BELL: return "\\a";
164 case _Parser.BACKSPACE: return "\\b"; 164 case _Parser.BACKSPACE: return "\\b";
165 case _Parser.VERTICAL_TAB: return "\\v"; 165 case _Parser.VERTICAL_TAB: return "\\v";
166 case _Parser.FORM_FEED: return "\\f"; 166 case _Parser.FORM_FEED: return "\\f";
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 String toString() { 229 String toString() {
230 var strContent = Strings.join(content.getKeys(). 230 var strContent = Strings.join(content.getKeys().
231 map((k) => '${k}: ${content[k]}'), ', '); 231 map((k) => '${k}: ${content[k]}'), ', ');
232 return '$tag {$strContent}'; 232 return '$tag {$strContent}';
233 } 233 }
234 234
235 int get hashCode => super.hashCode ^ _hashCode(content); 235 int get hashCode => super.hashCode ^ _hashCode(content);
236 236
237 visit(_Visitor v) => v.visitMapping(this); 237 visit(_Visitor v) => v.visitMapping(this);
238 } 238 }
OLDNEW
« no previous file with comments | « utils/pub/yaml/composer.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698