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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 bool ns_esc16Bit() => ns_escNBit(LETTER_U, 4); | 626 bool ns_esc16Bit() => ns_escNBit(LETTER_U, 4); |
627 | 627 |
628 // 61 | 628 // 61 |
629 bool ns_esc32Bit() => ns_escNBit(LETTER_CAP_U, 8); | 629 bool ns_esc32Bit() => ns_escNBit(LETTER_CAP_U, 8); |
630 | 630 |
631 // Helper method for 59 - 61 | 631 // Helper method for 59 - 61 |
632 bool ns_escNBit(int char, int digits) { | 632 bool ns_escNBit(int char, int digits) { |
633 if (!captureAs('', () => consumeChar(char))) return false; | 633 if (!captureAs('', () => consumeChar(char))) return false; |
634 var captured = captureAndTransform( | 634 var captured = captureAndTransform( |
635 () => nAtOnce(digits, (c, _) => isHexDigit(c)), | 635 () => nAtOnce(digits, (c, _) => isHexDigit(c)), |
636 (hex) => new String.fromCharCodes([Math.parseInt("0x$hex")])); | 636 (hex) => new String.fromCharCodes([int.parse("0x$hex")])); |
637 return expect(captured, "$digits hexidecimal digits"); | 637 return expect(captured, "$digits hexidecimal digits"); |
638 } | 638 } |
639 | 639 |
640 // 62 | 640 // 62 |
641 bool c_ns_escChar() => context('escape sequence', () => transaction(() { | 641 bool c_ns_escChar() => context('escape sequence', () => transaction(() { |
642 if (!truth(c_escape())) return false; | 642 if (!truth(c_escape())) return false; |
643 return truth(or([ | 643 return truth(or([ |
644 ns_escNull, ns_escBell, ns_escBackspace, ns_escHorizontalTab, | 644 ns_escNull, ns_escBell, ns_escBackspace, ns_escHorizontalTab, |
645 ns_escLineFeed, ns_escVerticalTab, ns_escFormFeed, ns_escCarriageReturn, | 645 ns_escLineFeed, ns_escVerticalTab, ns_escFormFeed, ns_escCarriageReturn, |
646 ns_escEscape, ns_escSpace, ns_escDoubleQuote, ns_escSlash, | 646 ns_escEscape, ns_escSpace, ns_escDoubleQuote, ns_escSlash, |
(...skipping 1283 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 |