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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 | 1630 |
1631 // 186 | 1631 // 186 |
1632 _Node ns_l_compactSequence(int indent) => context('sequence', () { | 1632 _Node ns_l_compactSequence(int indent) => context('sequence', () { |
1633 var first = c_l_blockSeqEntry(indent); | 1633 var first = c_l_blockSeqEntry(indent); |
1634 if (!truth(first)) return null; | 1634 if (!truth(first)) return null; |
1635 | 1635 |
1636 var content = zeroOrMore(() => transaction(() { | 1636 var content = zeroOrMore(() => transaction(() { |
1637 if (!truth(s_indent(indent))) return null; | 1637 if (!truth(s_indent(indent))) return null; |
1638 return c_l_blockSeqEntry(indent); | 1638 return c_l_blockSeqEntry(indent); |
1639 })); | 1639 })); |
1640 content.insertRange(0, 1, first); | 1640 content.insert(0, first); |
1641 | 1641 |
1642 return new _SequenceNode("?", content); | 1642 return new _SequenceNode("?", content); |
1643 }); | 1643 }); |
1644 | 1644 |
1645 // 187 | 1645 // 187 |
1646 _Node l_blockMapping(int indent) => context('mapping', () { | 1646 _Node l_blockMapping(int indent) => context('mapping', () { |
1647 var additionalIndent = countIndentation() - indent; | 1647 var additionalIndent = countIndentation() - indent; |
1648 if (additionalIndent <= 0) return null; | 1648 if (additionalIndent <= 0) return null; |
1649 | 1649 |
1650 var pairs = oneOrMore(() => transaction(() { | 1650 var pairs = oneOrMore(() => transaction(() { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 | 1713 |
1714 // 195 | 1714 // 195 |
1715 _Node ns_l_compactMapping(int indent) => context('mapping', () { | 1715 _Node ns_l_compactMapping(int indent) => context('mapping', () { |
1716 var first = ns_l_blockMapEntry(indent); | 1716 var first = ns_l_blockMapEntry(indent); |
1717 if (!truth(first)) return null; | 1717 if (!truth(first)) return null; |
1718 | 1718 |
1719 var pairs = zeroOrMore(() => transaction(() { | 1719 var pairs = zeroOrMore(() => transaction(() { |
1720 if (!truth(s_indent(indent))) return null; | 1720 if (!truth(s_indent(indent))) return null; |
1721 return ns_l_blockMapEntry(indent); | 1721 return ns_l_blockMapEntry(indent); |
1722 })); | 1722 })); |
1723 pairs.insertRange(0, 1, first); | 1723 pairs.insert(0, first); |
1724 | 1724 |
1725 return map(pairs); | 1725 return map(pairs); |
1726 }); | 1726 }); |
1727 | 1727 |
1728 // 196 | 1728 // 196 |
1729 _Node s_l_blockNode(int indent, int ctx) => or([ | 1729 _Node s_l_blockNode(int indent, int ctx) => or([ |
1730 () => s_l_blockInBlock(indent, ctx), | 1730 () => s_l_blockInBlock(indent, ctx), |
1731 () => s_l_flowInBlock(indent) | 1731 () => s_l_flowInBlock(indent) |
1732 ]); | 1732 ]); |
1733 | 1733 |
(...skipping 196 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 |