| 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; |
| 6 |
| 5 /** | 7 /** |
| 6 * Translates a string of characters into a YAML serialization tree. | 8 * Translates a string of characters into a YAML serialization tree. |
| 7 * | 9 * |
| 8 * This parser is designed to closely follow the spec. All productions in the | 10 * This parser is designed to closely follow the spec. All productions in the |
| 9 * spec are numbered, and the corresponding methods in the parser have the same | 11 * spec are numbered, and the corresponding methods in the parser have the same |
| 10 * numbers. This is certainly not the most efficient way of parsing YAML, but it | 12 * numbers. This is certainly not the most efficient way of parsing YAML, but it |
| 11 * is the easiest to write and read in the context of the spec. | 13 * is the easiest to write and read in the context of the spec. |
| 12 * | 14 * |
| 13 * Methods corresponding to productions are also named as in the spec, | 15 * Methods corresponding to productions are also named as in the spec, |
| 14 * translating the name of the method (although not the annotation characters) | 16 * translating the name of the method (although not the annotation characters) |
| (...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 // 198 | 1800 // 198 |
| 1799 _Node s_l_blockInBlock(int indent, int ctx) => or([ | 1801 _Node s_l_blockInBlock(int indent, int ctx) => or([ |
| 1800 () => s_l_blockScalar(indent, ctx), | 1802 () => s_l_blockScalar(indent, ctx), |
| 1801 () => s_l_blockCollection(indent, ctx) | 1803 () => s_l_blockCollection(indent, ctx) |
| 1802 ]); | 1804 ]); |
| 1803 | 1805 |
| 1804 // 199 | 1806 // 199 |
| 1805 _Node s_l_blockScalar(int indent, int ctx) => transaction(() { | 1807 _Node s_l_blockScalar(int indent, int ctx) => transaction(() { |
| 1806 if (!truth(s_separate(indent + 1, ctx))) return null; | 1808 if (!truth(s_separate(indent + 1, ctx))) return null; |
| 1807 var props = transaction(() { | 1809 var props = transaction(() { |
| 1808 var props = c_ns_properties(indent + 1, ctx); | 1810 var innerProps = c_ns_properties(indent + 1, ctx); |
| 1809 if (!truth(props)) return null; | 1811 if (!truth(innerProps)) return null; |
| 1810 if (!truth(s_separate(indent + 1, ctx))) return null; | 1812 if (!truth(s_separate(indent + 1, ctx))) return null; |
| 1811 return props; | 1813 return innerProps; |
| 1812 }); | 1814 }); |
| 1813 | 1815 |
| 1814 var node = or([() => c_l_literal(indent), () => c_l_folded(indent)]); | 1816 var node = or([() => c_l_literal(indent), () => c_l_folded(indent)]); |
| 1815 if (!truth(node)) return null; | 1817 if (!truth(node)) return null; |
| 1816 return addProps(node, props); | 1818 return addProps(node, props); |
| 1817 }); | 1819 }); |
| 1818 | 1820 |
| 1819 // 200 | 1821 // 200 |
| 1820 _Node s_l_blockCollection(int indent, int ctx) => transaction(() { | 1822 _Node s_l_blockCollection(int indent, int ctx) => transaction(() { |
| 1821 var props = transaction(() { | 1823 var props = transaction(() { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 var pair = contents[i]; | 1992 var pair = contents[i]; |
| 1991 if (pair.first.contains(pos)) return pair.last; | 1993 if (pair.first.contains(pos)) return pair.last; |
| 1992 } | 1994 } |
| 1993 return null; | 1995 return null; |
| 1994 } | 1996 } |
| 1995 | 1997 |
| 1996 /** Associates [value] with [range]. */ | 1998 /** Associates [value] with [range]. */ |
| 1997 operator[]=(_Range range, E value) => | 1999 operator[]=(_Range range, E value) => |
| 1998 contents.add(new _Pair<_Range, E>(range, value)); | 2000 contents.add(new _Pair<_Range, E>(range, value)); |
| 1999 } | 2001 } |
| OLD | NEW |