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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 /// Generate an empty scalar event. | 664 /// Generate an empty scalar event. |
665 Event _processEmptyScalar(SourceLocation location) => | 665 Event _processEmptyScalar(SourceLocation location) => |
666 new ScalarEvent(location.pointSpan(), '', ScalarStyle.PLAIN); | 666 new ScalarEvent(location.pointSpan(), '', ScalarStyle.PLAIN); |
667 | 667 |
668 /// Parses directives. | 668 /// Parses directives. |
669 Pair<VersionDirective, List<TagDirective>> _processDirectives() { | 669 Pair<VersionDirective, List<TagDirective>> _processDirectives() { |
670 var token = _scanner.peek(); | 670 var token = _scanner.peek(); |
671 | 671 |
672 var versionDirective; | 672 var versionDirective; |
673 var tagDirectives = []; | 673 var tagDirectives = []; |
674 var reservedDirectives = []; | |
675 while (token.type == TokenType.VERSION_DIRECTIVE || | 674 while (token.type == TokenType.VERSION_DIRECTIVE || |
676 token.type == TokenType.TAG_DIRECTIVE) { | 675 token.type == TokenType.TAG_DIRECTIVE) { |
677 if (token is VersionDirectiveToken) { | 676 if (token is VersionDirectiveToken) { |
678 if (versionDirective != null) { | 677 if (versionDirective != null) { |
679 throw new YamlException("Duplicate %YAML directive.", token.span); | 678 throw new YamlException("Duplicate %YAML directive.", token.span); |
680 } | 679 } |
681 | 680 |
682 if (token.major != 1 || token.minor == 0) { | 681 if (token.major != 1 || token.minor == 0) { |
683 throw new YamlException( | 682 throw new YamlException( |
684 "Incompatible YAML document. This parser only supports YAML 1.1 " | 683 "Incompatible YAML document. This parser only supports YAML 1.1 " |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 807 |
809 /// Expect nothing. | 808 /// Expect nothing. |
810 static const END = const _State("END"); | 809 static const END = const _State("END"); |
811 | 810 |
812 final String name; | 811 final String name; |
813 | 812 |
814 const _State(this.name); | 813 const _State(this.name); |
815 | 814 |
816 String toString() => name; | 815 String toString() => name; |
817 } | 816 } |
OLD | NEW |