runtime(yaml): improve syntax highlighting for YAML

- Recognize block scalar style to avoid unexpected highlighting by `yamlFlowString` (fix #11517)
- Improve performance of `yamlFlowMappingKey` by allowing execution by the NFA engine (fix #10730)
  - It was intentionally disabled before patterns were optimized by `s:SimplifyToAssumeAllPrintable`.
- Fix detection of flow style mapping indicators (fix #8234).
- Enable highlighting of explicit mapping value indicators and node properties in flow style.
- Add syntax highlighting tests

closes: #14354

Signed-off-by: itchyny <itchyny@cybozu.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/input/yaml.yaml b/runtime/syntax/testdir/input/yaml.yaml
new file mode 100644
index 0000000..d87aca2
--- /dev/null
+++ b/runtime/syntax/testdir/input/yaml.yaml
@@ -0,0 +1,127 @@
+%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}]}