| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library yaml.parser; | 5 library yaml.parser; |
| 6 | 6 |
| 7 import 'package:source_span/source_span.dart'; | 7 import 'package:source_span/source_span.dart'; |
| 8 import 'package:string_scanner/string_scanner.dart'; | 8 import 'package:string_scanner/string_scanner.dart'; |
| 9 | 9 |
| 10 import 'event.dart'; | 10 import 'event.dart'; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 if (token is AliasToken) { | 254 if (token is AliasToken) { |
| 255 _scanner.scan(); | 255 _scanner.scan(); |
| 256 _state = _states.removeLast(); | 256 _state = _states.removeLast(); |
| 257 return new AliasEvent(token.span, token.name); | 257 return new AliasEvent(token.span, token.name); |
| 258 } | 258 } |
| 259 | 259 |
| 260 var anchor; | 260 var anchor; |
| 261 var tagToken; | 261 var tagToken; |
| 262 var span = token.span.start.pointSpan(); | 262 var span = token.span.start.pointSpan(); |
| 263 parseAnchor() { | 263 parseAnchor(token) { |
| 264 anchor = token.name; | 264 anchor = token.name; |
| 265 span = span.expand(token.span); | 265 span = span.expand(token.span); |
| 266 token = _scanner.advance(); | 266 return _scanner.advance(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 parseTag() { | 269 parseTag(token) { |
| 270 tagToken = token; | 270 tagToken = token; |
| 271 span = span.expand(token.span); | 271 span = span.expand(token.span); |
| 272 token = _scanner.advance(); | 272 return _scanner.advance(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 if (token is AnchorToken) { | 275 if (token is AnchorToken) { |
| 276 parseAnchor(); | 276 token = parseAnchor(token); |
| 277 if (token is TagToken) parseTag(); | 277 if (token is TagToken) token = parseTag(token); |
| 278 } else if (token is TagToken) { | 278 } else if (token is TagToken) { |
| 279 parseTag(); | 279 token = parseTag(token); |
| 280 if (token is AnchorToken) parseAnchor(); | 280 if (token is AnchorToken) token = parseAnchor(token); |
| 281 } | 281 } |
| 282 | 282 |
| 283 var tag; | 283 var tag; |
| 284 if (tagToken != null) { | 284 if (tagToken != null) { |
| 285 if (tagToken.handle == null) { | 285 if (tagToken.handle == null) { |
| 286 tag = tagToken.suffix; | 286 tag = tagToken.suffix; |
| 287 } else { | 287 } else { |
| 288 var tagDirective = _tagDirectives[tagToken.handle]; | 288 var tagDirective = _tagDirectives[tagToken.handle]; |
| 289 if (tagDirective == null) { | 289 if (tagDirective == null) { |
| 290 throw new YamlException("Undefined tag handle.", tagToken.span); | 290 throw new YamlException("Undefined tag handle.", tagToken.span); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 807 |
| 808 /// Expect nothing. | 808 /// Expect nothing. |
| 809 static const END = const _State("END"); | 809 static const END = const _State("END"); |
| 810 | 810 |
| 811 final String name; | 811 final String name; |
| 812 | 812 |
| 813 const _State(this.name); | 813 const _State(this.name); |
| 814 | 814 |
| 815 String toString() => name; | 815 String toString() => name; |
| 816 } | 816 } |
| OLD | NEW |