itchyny | cc7597c | 2024-04-01 14:54:36 +0200 | [diff] [blame] | 1 | %YAML 1.2 |
| 2 | %TAG ! tag:yaml.org,2002: # primary tag handle |
| 3 | %TAG !! tag:yaml.org,2002: # secondary tag handle |
| 4 | %TAG !yaml! tag:yaml.org,2002: # named tag handle |
| 5 | --- |
| 6 | - !str 0 # primary tag handle |
| 7 | - !!str 0 # secondary tag handle |
| 8 | - !yaml!str 0 # named tag handle |
| 9 | --- |
| 10 | |
| 11 | boolean: [false, true, FALSE, TRUE, False, True] |
| 12 | null: [null, ~,] |
| 13 | integer: [12345, -12_345, +12_345] |
| 14 | float: [ |
| 15 | 12345.15, -12_345.15, +12_345.15, 1.23015e+3, |
| 16 | -12_345.15e+10, +12_345.15e-10, 1.234_515e-10 |
| 17 | ] |
| 18 | binary: [0b101010, -0b1010_1010, +0b1010_1010] |
| 19 | octal: [0777, 0o777, +0777, -0o777] |
| 20 | hexadecimal: [0xFEFF_0000, -0xabcd_ef00, +0x1234_5678] |
| 21 | sexagesimal: [10:20:30, -19:29:39, +19:29:39] |
| 22 | infinity: [.inf, -.Inf, +.INF] |
| 23 | not a number: [.nan, .NaN, .NAN] |
| 24 | |
| 25 | plain strings: |
| 26 | - a b c |
| 27 | - a * b & c @ d# e : f # comment |
| 28 | - {{ f(' ') }} #8234 |
| 29 | double quoted strings: |
| 30 | - "" |
| 31 | - "a b c": "d e f" # comment |
| 32 | - "\\\"\a\b\f\n\r\t\v\0\_\ \N\L\P\x41\u0041\U00000041" |
| 33 | single quoted strings: |
| 34 | - '' |
| 35 | - 'a b c': 'd e f' # comment |
| 36 | - 'a''b''c' |
| 37 | |
| 38 | block folded string: > |
| 39 | foo |
| 40 | bar: 1 |
| 41 | |
| 42 | baz: null |
| 43 | |
| 44 | "qux" |
| 45 | block literal string: | |
| 46 | foo |
| 47 | bar: 1 |
| 48 | |
| 49 | baz: null |
| 50 | |
| 51 | 'qux' |
| 52 | |
| 53 | chomping strings: |
| 54 | - block folded string: >- # comment |
| 55 | foo |
| 56 | bar: 1 |
| 57 | - block literal string: |+ # comment |
| 58 | foo |
| 59 | bar: 1 |
| 60 | - |- #11517 |
| 61 | foo "\" |
| 62 | bar: 1 |
| 63 | block indentation indicator: |
| 64 | - block folded string: >1 # comment |
| 65 | foo |
| 66 | bar: 1 |
| 67 | - block literal string: |1- # comment |
| 68 | foo |
| 69 | bar: 1 |
| 70 | - |-1 # comment |
| 71 | foo |
| 72 | bar: 1 |
| 73 | |
| 74 | flow collection: |
| 75 | empty sequence: [] |
| 76 | empty mapping: {} |
| 77 | flow sequence: [foo, bar, baz] |
| 78 | flow mapping: {foo: bar, baz: qux} |
| 79 | flow string: |
| 80 | foo |
| 81 | bar |
| 82 | baz |
| 83 | "double quoted \" string": " |
| 84 | foo |
| 85 | bar |
| 86 | baz" |
| 87 | 'single quoted '' string': ' |
| 88 | foo |
| 89 | bar |
| 90 | baz' |
| 91 | inside block mapping: |
| 92 | foo: {bar: baz} |
| 93 | bar: ["foo": {baz: qux}] |
| 94 | flow collection: [foo # comment |
| 95 | , {bar: [{ # comment |
| 96 | baz: ' |
| 97 | qux # not comment |
| 98 | ' # comment |
| 99 | }]}] |
| 100 | |
| 101 | explicit mapping: |
| 102 | ? foo # comment |
| 103 | : bar # comment |
| 104 | ? - foo |
| 105 | - bar |
| 106 | : - baz |
| 107 | - qux |
| 108 | ? [1, 2, 3] |
| 109 | : ? 1 |
| 110 | : one |
| 111 | ? 2 |
| 112 | : - ? 3 |
| 113 | : three |
| 114 | - {?4: four, ? 5: five, ? # comment |
| 115 | 6: # comment |
| 116 | {7:seven}} |
| 117 | |
| 118 | mapping merge: |
| 119 | foo: &foo |
| 120 | bar: baz |
| 121 | bar: |
| 122 | <<: *foo |
| 123 | baz: &bar |
| 124 | foo: [*foo] |
| 125 | qux: |
| 126 | <<: [*foo, *bar] |
| 127 | baz: {<<: *foo, qux: [{<< : *foo}]} |