vim/runtime/syntax/testdir/input/yaml.yaml
itchyny aa495124f8
runtime(yaml): Fix flow mapping key detection
fixes: #15196
closes: #15313

Signed-off-by: itchyny <itchyny@cybozu.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-21 09:21:20 +02:00

128 lines
2.3 KiB
YAML

%YAML 1.2
%TAG ! tag:yaml.org,2002: # primary tag handle
%TAG !! tag:yaml.org,2002: # secondary tag handle
%TAG !yaml! tag:yaml.org,2002: # named tag handle
---
- !str 0 # primary tag handle
- !!str 0 # secondary tag handle
- !yaml!str 0 # named tag handle
---
boolean: [false, true, FALSE, TRUE, False, True]
null: [null, ~,]
integer: [12345, -12_345, +12_345]
float: [
12345.15, -12_345.15, +12_345.15, 1.23015e+3,
-12_345.15e+10, +12_345.15e-10, 1.234_515e-10
]
binary: [0b101010, -0b1010_1010, +0b1010_1010]
octal: [0777, 0o777, +0777, -0o777]
hexadecimal: [0xFEFF_0000, -0xabcd_ef00, +0x1234_5678]
sexagesimal: [10:20:30, -19:29:39, +19:29:39]
infinity: [.inf, -.Inf, +.INF]
not a number: [.nan, .NaN, .NAN]
plain strings:
- a b c
- a:b & c @ d# e * f # comment
- {{ f(' ') }} #8234
double quoted strings:
- ""
- "a b c": "d e f" # comment
- "\\\"\a\b\f\n\r\t\v\0\_\ \N\L\P\x41\u0041\U00000041"
single quoted strings:
- ''
- 'a b c': 'd e f' # comment
- 'a''b''c'
block folded string: >
foo
bar: 1
baz: null
"qux"
block literal string: |
foo
bar: 1
baz: null
'qux'
chomping strings:
- block folded string: >- # comment
foo
bar: 1
- block literal string: |+ # comment
foo
bar: 1
- |- #11517
foo "\"
bar: 1
block indentation indicator:
- block folded string: >1 # comment
foo
bar: 1
- block literal string: |1- # comment
foo
bar: 1
- |-1 # comment
foo
bar: 1
flow collection:
empty sequence: []
empty mapping: {}
flow sequence: [foo, bar, baz]
flow mapping: {foo: bar, baz: qux}
flow string:
foo
bar
baz
"double quoted \" string": "
foo
bar
baz"
'single quoted '' string': '
foo
bar
baz'
inside block mapping:
foo: {bar: baz}
bar: ["foo": {baz: qux}]
flow:collection: [foo # comment
, {bar: [{ # comment
baz:
'
qux # not comment
' # comment
}]}]
explicit mapping:
? foo # comment
: bar # comment
? - foo
- bar
: - baz
- qux
? [1, 2, 3]
: ? 1
: one
? 2
: - ? 3
: three
- {?4: four, ? 5: five, ? # comment
6: # comment
{7:seven}}
mapping merge:
foo: &foo
bar: baz
bar:
<<: *foo
baz: &bar
foo: [*foo]
qux:
<<: [*foo, *bar]
baz: {<<: *foo, qux: [{<< : *foo}]}