OLD | NEW |
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 part of yaml; | 5 part of yaml; |
6 | 6 |
7 /// Translates a string of characters into a YAML serialization tree. | 7 /// Translates a string of characters into a YAML serialization tree. |
8 /// | 8 /// |
9 /// This parser is designed to closely follow the spec. All productions in the | 9 /// This parser is designed to closely follow the spec. All productions in the |
10 /// spec are numbered, and the corresponding methods in the parser have the same | 10 /// spec are numbered, and the corresponding methods in the parser have the same |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // 137 | 1112 // 137 |
1113 _SequenceNode c_flowSequence(int indent, int ctx) => transaction(() { | 1113 _SequenceNode c_flowSequence(int indent, int ctx) => transaction(() { |
1114 if (!truth(c_indicator(C_SEQUENCE_START))) return null; | 1114 if (!truth(c_indicator(C_SEQUENCE_START))) return null; |
1115 zeroOrOne(() => s_separate(indent, ctx)); | 1115 zeroOrOne(() => s_separate(indent, ctx)); |
1116 var content = zeroOrOne(() => ns_s_flowSeqEntries(indent, inFlow(ctx))); | 1116 var content = zeroOrOne(() => ns_s_flowSeqEntries(indent, inFlow(ctx))); |
1117 if (!truth(c_indicator(C_SEQUENCE_END))) return null; | 1117 if (!truth(c_indicator(C_SEQUENCE_END))) return null; |
1118 return new _SequenceNode("?", new List<_Node>.from(content)); | 1118 return new _SequenceNode("?", new List<_Node>.from(content)); |
1119 }); | 1119 }); |
1120 | 1120 |
1121 // 138 | 1121 // 138 |
1122 Collection<_Node> ns_s_flowSeqEntries(int indent, int ctx) { | 1122 Iterable<_Node> ns_s_flowSeqEntries(int indent, int ctx) { |
1123 var first = ns_flowSeqEntry(indent, ctx); | 1123 var first = ns_flowSeqEntry(indent, ctx); |
1124 if (!truth(first)) return new Queue<_Node>(); | 1124 if (!truth(first)) return new Queue<_Node>(); |
1125 zeroOrOne(() => s_separate(indent, ctx)); | 1125 zeroOrOne(() => s_separate(indent, ctx)); |
1126 | 1126 |
1127 var rest; | 1127 var rest; |
1128 if (truth(c_indicator(C_COLLECT_ENTRY))) { | 1128 if (truth(c_indicator(C_COLLECT_ENTRY))) { |
1129 zeroOrOne(() => s_separate(indent, ctx)); | 1129 zeroOrOne(() => s_separate(indent, ctx)); |
1130 rest = zeroOrOne(() => ns_s_flowSeqEntries(indent, ctx)); | 1130 rest = zeroOrOne(() => ns_s_flowSeqEntries(indent, ctx)); |
1131 } | 1131 } |
1132 | 1132 |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 var pair = contents[i]; | 1930 var pair = contents[i]; |
1931 if (pair.first.contains(pos)) return pair.last; | 1931 if (pair.first.contains(pos)) return pair.last; |
1932 } | 1932 } |
1933 return null; | 1933 return null; |
1934 } | 1934 } |
1935 | 1935 |
1936 /// Associates [value] with [range]. | 1936 /// Associates [value] with [range]. |
1937 operator[]=(_Range range, E value) => | 1937 operator[]=(_Range range, E value) => |
1938 contents.add(new _Pair<_Range, E>(range, value)); | 1938 contents.add(new _Pair<_Range, E>(range, value)); |
1939 } | 1939 } |
OLD | NEW |