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

Side by Side Diff: pkg/yaml/lib/src/model.dart

Issue 342943006: Make YamlException inherit from SpanFormatException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
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 library yaml.model; 8 library yaml.model;
9 9
10 import 'package:source_maps/source_maps.dart'; 10 import 'package:source_maps/source_maps.dart';
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } else if (c >= 0x10000) { 201 } else if (c >= 0x10000) {
202 return "\\u${zeroPad(c.toRadixString(16).toUpperCase(), 8)}"; 202 return "\\u${zeroPad(c.toRadixString(16).toUpperCase(), 8)}";
203 } else { 203 } else {
204 return new String.fromCharCodes([c]); 204 return new String.fromCharCodes([c]);
205 } 205 }
206 } 206 }
207 }); 207 });
208 return '"${escapedValue.join()}"'; 208 return '"${escapedValue.join()}"';
209 } 209 }
210 210
211 throw new YamlException('Unknown scalar value: "$value".'); 211 throw new YamlException('Unknown scalar value.', span);
212 } 212 }
213 213
214 String toString() => '$tag "$content"'; 214 String toString() => '$tag "$content"';
215 215
216 /// Left-pads [str] with zeros so that it's at least [length] characters 216 /// Left-pads [str] with zeros so that it's at least [length] characters
217 /// long. 217 /// long.
218 String zeroPad(String str, int length) { 218 String zeroPad(String str, int length) {
219 assert(length >= str.length); 219 assert(length >= str.length);
220 var prefix = new List.filled(length - str.length, '0'); 220 var prefix = new List.filled(length - str.length, '0');
221 return '${prefix.join()}$str'; 221 return '${prefix.join()}$str';
(...skipping 28 matching lines...) Expand all
250 var strContent = content.keys 250 var strContent = content.keys
251 .map((k) => '${k}: ${content[k]}') 251 .map((k) => '${k}: ${content[k]}')
252 .join(', '); 252 .join(', ');
253 return '$tag {$strContent}'; 253 return '$tag {$strContent}';
254 } 254 }
255 255
256 int get hashCode => super.hashCode ^ deepHashCode(content); 256 int get hashCode => super.hashCode ^ deepHashCode(content);
257 257
258 visit(Visitor v) => v.visitMapping(this); 258 visit(Visitor v) => v.visitMapping(this);
259 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698