| 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 /** | 5 /** |
| 6 * Translates a string of characters into a YAML serialization tree. | 6 * Translates a string of characters into a YAML serialization tree. |
| 7 * | 7 * |
| 8 * This parser is designed to closely follow the spec. All productions in the | 8 * 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 | 9 * 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 | 10 * numbers. This is certainly not the most efficient way of parsing YAML, but it |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 case CHOMPING_CLIP: | 1441 case CHOMPING_CLIP: |
| 1442 l_stripEmpty(indent); | 1442 l_stripEmpty(indent); |
| 1443 break; | 1443 break; |
| 1444 case CHOMPING_KEEP: | 1444 case CHOMPING_KEEP: |
| 1445 l_keepEmpty(indent); | 1445 l_keepEmpty(indent); |
| 1446 break; | 1446 break; |
| 1447 } | 1447 } |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 // 167 | 1450 // 167 |
| 1451 void l_stripEmpty(int indent) => captureAs('', () { | 1451 void l_stripEmpty(int indent) { |
| 1452 zeroOrMore(() => transaction(() { | 1452 captureAs('', () { |
| 1453 if (!truth(s_indentLessThanOrEqualTo(indent))) return false; | 1453 zeroOrMore(() => transaction(() { |
| 1454 return b_nonContent(); | 1454 if (!truth(s_indentLessThanOrEqualTo(indent))) return false; |
| 1455 })); | 1455 return b_nonContent(); |
| 1456 zeroOrOne(() => l_trailComments(indent)); | 1456 })); |
| 1457 return true; | 1457 zeroOrOne(() => l_trailComments(indent)); |
| 1458 }); | 1458 return true; |
| 1459 }); |
| 1460 } |
| 1459 | 1461 |
| 1460 // 168 | 1462 // 168 |
| 1461 void l_keepEmpty(int indent) { | 1463 void l_keepEmpty(int indent) { |
| 1462 zeroOrMore(() => captureAs('\n', () => l_empty(indent, BLOCK_IN))); | 1464 zeroOrMore(() => captureAs('\n', () => l_empty(indent, BLOCK_IN))); |
| 1463 zeroOrOne(() => captureAs('', () => l_trailComments(indent))); | 1465 zeroOrOne(() => captureAs('', () => l_trailComments(indent))); |
| 1464 } | 1466 } |
| 1465 | 1467 |
| 1466 // 169 | 1468 // 169 |
| 1467 bool l_trailComments(int indent) => transaction(() { | 1469 bool l_trailComments(int indent) => transaction(() { |
| 1468 if (!truth(s_indentLessThanOrEqualTo(indent))) return false; | 1470 if (!truth(s_indentLessThanOrEqualTo(indent))) return false; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 | 1891 |
| 1890 /** The information in the header for a block scalar. */ | 1892 /** The information in the header for a block scalar. */ |
| 1891 class _BlockHeader { | 1893 class _BlockHeader { |
| 1892 final int additionalIndent; | 1894 final int additionalIndent; |
| 1893 final int chomping; | 1895 final int chomping; |
| 1894 | 1896 |
| 1895 _BlockHeader(this.additionalIndent, this.chomping); | 1897 _BlockHeader(this.additionalIndent, this.chomping); |
| 1896 | 1898 |
| 1897 bool get autoDetectIndent() => additionalIndent == null; | 1899 bool get autoDetectIndent() => additionalIndent == null; |
| 1898 } | 1900 } |
| OLD | NEW |