Mercurial > vim
changeset 35767:8ea2151d1ed8
runtime(yaml): Fix flow mapping key detection
Commit: https://github.com/vim/vim/commit/aa495124f80812b9c8c1942e6c4f9ce2242ea01f
Author: itchyny <itchyny@cybozu.co.jp>
Date: Sun Jul 21 09:21:20 2024 +0200
runtime(yaml): Fix flow mapping key detection
fixes: https://github.com/vim/vim/issues/15196
closes: https://github.com/vim/vim/issues/15313
Signed-off-by: itchyny <itchyny@cybozu.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 21 Jul 2024 09:30:11 +0200 |
parents | 37346c9a3cef |
children | 31b224083517 |
files | runtime/syntax/testdir/dumps/yaml_01.dump runtime/syntax/testdir/dumps/yaml_03.dump runtime/syntax/testdir/dumps/yaml_04.dump runtime/syntax/testdir/dumps/yaml_05.dump runtime/syntax/testdir/dumps/yaml_06.dump runtime/syntax/testdir/dumps/yaml_07.dump runtime/syntax/testdir/input/yaml.yaml runtime/syntax/yaml.vim |
diffstat | 8 files changed, 24 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/syntax/testdir/dumps/yaml_01.dump +++ b/runtime/syntax/testdir/dumps/yaml_01.dump @@ -11,10 +11,10 @@ @75 |p+0#00e0e07&|l|a|i|n| |s|t|r|i|n|g|s|:+0#e000e06&| +0#0000000&@60 @2|-+0#af5f00255&| +0#0000000&|a| |b| |c| @65 -@2|-+0#af5f00255&| +0#0000000&|a| |*| |b| |&| |c| |@| |d|#| |e| |:| |f| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@40 +@2|-+0#af5f00255&| +0#0000000&|a|:|b| |&| |c| |@| |d|#| |e| |*| |f| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@42 @2|-+0#af5f00255&| +0#0000000&|{@1| |f|(|'| |'|)| |}@1| +0#0000e05&|#|8|2|3|4| +0#0000000&@52 |d+0#00e0e07&|o|u|b|l|e| |q|u|o|t|e|d| |s|t|r|i|n|g|s|:+0#e000e06&| +0#0000000&@52 @2|-+0#af5f00255&| +0#0000000&|"+0#e000002&@1| +0#0000000&@68 @2|-+0#af5f00255&| +0#0000000&|"+0#e000002&|a| |b| |c|"|:+0#e000e06&| +0#0000000&|"+0#e000002&|d| |e| |f|"| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@44 @2|-+0#af5f00255&| +0#0000000&|"+0#e000002&|\+0#e000e06&@2|"|\|a|\|b|\|f|\|n|\|r|\|t|\|v|\|0|\|_|\| |\|N|\|L|\|P|\|x|4|1|\|u|0@1|4|1|\|U|0@5|4|1|"+0#e000002&| +0#0000000&@18 -@57|1|9|,|1| @9|1|2|%| +@57|1|9|,|1| @9|1@1|%|
--- a/runtime/syntax/testdir/dumps/yaml_03.dump +++ b/runtime/syntax/testdir/dumps/yaml_03.dump @@ -17,4 +17,4 @@ @5|b|a|r|:| |1| @63 @2|-+0#af5f00255&| +0#0000000&|b+0#00e0e07&|l|o|c|k| |l|i|t|e|r|a|l| |s|t|r|i|n|g|:+0#e000e06&| +0#0000000&||+0#e000e06&|1|-| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@35 @5|f|o@1| @66 -@57|5@1|,|7| @9|4|5|%| +@57|5@1|,|7| @9|4@1|%|
--- a/runtime/syntax/testdir/dumps/yaml_04.dump +++ b/runtime/syntax/testdir/dumps/yaml_04.dump @@ -17,4 +17,4 @@ | +0#e000002&@3|f|o@1| +0#0000000&@67 | +0#e000002&@3|b|a|r| +0#0000000&@67 | +0#e000002&@3|b|a|z|"| +0#0000000&@66 -@57|7|3|,|0|-|1| @7|6|2|%| +@57|7|3|,|0|-|1| @7|6|1|%|
--- a/runtime/syntax/testdir/dumps/yaml_05.dump +++ b/runtime/syntax/testdir/dumps/yaml_05.dump @@ -6,9 +6,10 @@ @2>i+0#00e0e07&|n|s|i|d|e| |b|l|o|c|k| |m|a|p@1|i|n|g|:+0#e000e06&| +0#0000000&@51 @4|f+0#00e0e07&|o@1|:+0#e000e06&| +0#0000000&|{+0#e000e06&|b+0#00e0e07&|a|r|:+0#e000e06&| +0#0000000&|b|a|z|}+0#e000e06&| +0#0000000&@55 @4|b+0#00e0e07&|a|r|:+0#e000e06&| +0#0000000&|[+0#e000e06&|"+0#e000002&|f|o@1|"|:+0#e000e06&| +0#0000000&|{+0#e000e06&|b+0#00e0e07&|a|z|:+0#e000e06&| +0#0000000&|q|u|x|}+0#e000e06&|]| +0#0000000&@46 -@2|f+0#00e0e07&|l|o|w| |c|o|l@1|e|c|t|i|o|n|:+0#e000e06&| +0#0000000&|[+0#e000e06&|f+0#0000000&|o@1| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@41 +@2|f+0#00e0e07&|l|o|w|:|c|o|l@1|e|c|t|i|o|n|:+0#e000e06&| +0#0000000&|[+0#e000e06&|f+0#0000000&|o@1| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@41 @4|,| |{+0#e000e06&|b+0#00e0e07&|a|r|:+0#e000e06&| +0#0000000&|[+0#e000e06&|{| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@50 -@6|b+0#00e0e07&|a|z|:+0#e000e06&| +0#0000000&|'+0#e000002&| +0#0000000&@62 +@6|b+0#00e0e07&|a|z|:+0#e000e06&| +0#0000000&@64 +@6|'+0#e000002&| +0#0000000&@67 | +0#e000002&@7|q|u|x| |#| |n|o|t| |c|o|m@1|e|n|t| +0#0000000&@49 | +0#e000002&@5|'| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@57 @4|}+0#e000e06&|]|}|]| +0#0000000&@66 @@ -16,5 +17,4 @@ |e+0#00e0e07&|x|p|l|i|c|i|t| |m|a|p@1|i|n|g|:+0#e000e06&| +0#0000000&@57 @2|?+0#e000e06&| +0#0000000&|f|o@1| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@57 @2|:+0#e000e06&| +0#0000000&|b|a|r| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@57 -@2|?+0#e000e06&| +0#0000000&|-+0#af5f00255&| +0#0000000&|f|o@1| @65 -@57|9|1|,|3| @9|7|8|%| +@57|9|1|,|3| @9|7@1|%|
--- a/runtime/syntax/testdir/dumps/yaml_06.dump +++ b/runtime/syntax/testdir/dumps/yaml_06.dump @@ -1,20 +1,20 @@ -| +0&#ffffff0@1|?+0#e000e06&| +0#0000000&|-+0#af5f00255&| +0#0000000&|f|o@1| @65 +| +0&#ffffff0@1|:+0#e000e06&| +0#0000000&|b|a|r| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@57 +@2|?+0#e000e06&| +0#0000000&|-+0#af5f00255&| +0#0000000&|f|o@1| @65 @4|-+0#af5f00255&| +0#0000000&|b|a|r| @65 @2|:+0#e000e06&| +0#0000000&|-+0#af5f00255&| +0#0000000&|b|a|z| @65 @4|-+0#af5f00255&| +0#0000000&|q|u|x| @65 -@2|?+0#e000e06&| +0#0000000&|[+0#e000e06&|1+0#e000002&|,+0#0000000&| |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&| +0#0000000&@61 -@2>:+0#e000e06&| +0#0000000&|?+0#e000e06&| +0#0000000&|1+0#e000002&| +0#0000000&@67 +@2>?+0#e000e06&| +0#0000000&|[+0#e000e06&|1+0#e000002&|,+0#0000000&| |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&| +0#0000000&@61 +@2|:+0#e000e06&| +0#0000000&|?+0#e000e06&| +0#0000000&|1+0#e000002&| +0#0000000&@67 @4|:+0#e000e06&| +0#0000000&|o|n|e| @65 @4|?+0#e000e06&| +0#0000000&|2+0#e000002&| +0#0000000&@67 @4|:+0#e000e06&| +0#0000000&|-+0#af5f00255&| +0#0000000&|?+0#e000e06&| +0#0000000&|3+0#e000002&| +0#0000000&@63 @8|:+0#e000e06&| +0#0000000&|t|h|r|e@1| @59 @6|-+0#af5f00255&| +0#0000000&|{+0#e000e06&|?|4+0#00e0e07&|:+0#e000e06&| +0#0000000&|f|o|u|r|,| |?+0#e000e06&| +0#0000000&|5+0#00e0e07&|:+0#e000e06&| +0#0000000&|f|i|v|e|,| |?+0#e000e06&| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@33 @8|6+0#00e0e07&|:+0#e000e06&| +0#0000e05&|#| |c|o|m@1|e|n|t| +0#0000000&@54 -@8|{+0#e000e06&|7+0#00e0e07&|:+0#e000e06&|s+0#0000000&|e|v|e|n|}+0#e000e06&@1| +0#0000000&@56 +@8|{+0#e000e06&|7+0#0000000&|:|s|e|v|e|n|}+0#e000e06&@1| +0#0000000&@56 @75 |m+0#00e0e07&|a|p@1|i|n|g| |m|e|r|g|e|:+0#e000e06&| +0#0000000&@60 @2|f+0#00e0e07&|o@1|:+0#e000e06&| +0#0000000&|&+0#00e0003&|f|o@1| +0#0000000&@63 @4|b+0#00e0e07&|a|r|:+0#e000e06&| +0#0000000&|b|a|z| @62 @2|b+0#00e0e07&|a|r|:+0#e000e06&| +0#0000000&@68 -@4|<+0#e000e06&@1|:| +0#0000000&|*+0#00e0003&|f|o@1| +0#0000000&@62 -@57|1|0|9|,|3| @8|9|5|%| +@57|1|0|9|,|3| @8|9|4|%|
--- a/runtime/syntax/testdir/dumps/yaml_07.dump +++ b/runtime/syntax/testdir/dumps/yaml_07.dump @@ -1,9 +1,10 @@ -| +0&#ffffff0@3|<+0#e000e06&@1|:| +0#0000000&|*+0#00e0003&|f|o@1| +0#0000000&@62 +| +0&#ffffff0@1|b+0#00e0e07&|a|r|:+0#e000e06&| +0#0000000&@68 +@4|<+0#e000e06&@1|:| +0#0000000&|*+0#00e0003&|f|o@1| +0#0000000&@62 @4|b+0#00e0e07&|a|z|:+0#e000e06&| +0#0000000&|&+0#00e0003&|b|a|r| +0#0000000&@61 @6|f+0#00e0e07&|o@1|:+0#e000e06&| +0#0000000&|[+0#e000e06&|*+0#00e0003&|f|o@1|]+0#e000e06&| +0#0000000&@57 @4|q+0#00e0e07&|u|x|:+0#e000e06&| +0#0000000&@66 -@6|<+0#e000e06&@1|:| +0#0000000&|[+0#e000e06&|*+0#00e0003&|f|o@1|,+0#0000000&| |*+0#00e0003&|b|a|r|]+0#e000e06&| +0#0000000&@52 -@2>b+0#00e0e07&|a|z|:+0#e000e06&| +0#0000000&|{+0#e000e06&|<@1|:| +0#0000000&|*+0#00e0003&|f|o@1|,+0#0000000&| |q+0#00e0e07&|u|x|:+0#e000e06&| +0#0000000&|[+0#e000e06&|{|<@1| +0#0000000&|:+0#e000e06&| +0#0000000&|*+0#00e0003&|f|o@1|}+0#e000e06&|]|}| +0#0000000&@37 +@6><+0#e000e06&@1|:| +0#0000000&|[+0#e000e06&|*+0#00e0003&|f|o@1|,+0#0000000&| |*+0#00e0003&|b|a|r|]+0#e000e06&| +0#0000000&@52 +@2|b+0#00e0e07&|a|z|:+0#e000e06&| +0#0000000&|{+0#e000e06&|<@1|:| +0#0000000&|*+0#00e0003&|f|o@1|,+0#0000000&| |q+0#00e0e07&|u|x|:+0#e000e06&| +0#0000000&|[+0#e000e06&|{|<@1| +0#0000000&|:+0#e000e06&| +0#0000000&|*+0#00e0003&|f|o@1|}+0#e000e06&|]|}| +0#0000000&@37 |~+0#4040ff13&| @73 |~| @73 |~| @73 @@ -16,5 +17,4 @@ |~| @73 |~| @73 |~| @73 -|~| @73 -| +0#0000000&@56|1|2|7|,|3| @8|B|o|t| +| +0#0000000&@56|1|2|7|,|7| @8|B|o|t|
--- a/runtime/syntax/testdir/input/yaml.yaml +++ b/runtime/syntax/testdir/input/yaml.yaml @@ -24,7 +24,7 @@ not a number: [.nan, .NaN, .NAN] plain strings: - a b c - - a * b & c @ d# e : f # comment + - a:b & c @ d# e * f # comment - {{ f(' ') }} #8234 double quoted strings: - "" @@ -91,9 +91,10 @@ flow collection: inside block mapping: foo: {bar: baz} bar: ["foo": {baz: qux}] - flow collection: [foo # comment + flow:collection: [foo # comment , {bar: [{ # comment - baz: ' + baz: + ' qux # not comment ' # comment }]}]
--- a/runtime/syntax/yaml.vim +++ b/runtime/syntax/yaml.vim @@ -129,7 +129,7 @@ syn region yamlFlowCollection matchgroup execute 'syn match yamlPlainScalar /'.s:ns_plain_out.'/' execute 'syn match yamlPlainScalar contained /'.s:ns_plain_in.'/' -execute 'syn match yamlFlowMappingKey /'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:/ contained '. +execute 'syn match yamlFlowMappingKey /'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:\%(\s\|$\)/ contained '. \'nextgroup=yamlFlowMappingDelimiter skipwhite' syn match yamlFlowMappingKeyStart /?/ contained nextgroup=@yamlFlowNode skipwhite syn match yamlFlowMappingMerge /<<\ze\s*:/ contained nextgroup=yamlFlowMappingDelimiter skipwhite