diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 7b91ff23ef..9b46afd50a 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -351,7 +351,7 @@ Vim9 syn match vimAugroup "\\ze\s*\%([#|]\|$\)" skipwhite nextgro " Operators: {{{2 " ========= -syn cluster vimOperGroup contains=@vimContinue,@vimExprList,vim9Comment,vimContinueString +syn cluster vimOperGroup contains=@vimContinue,@vimExprList,vim9Comment,vim9LineComment,vimContinueString syn match vimOper "\a\@\+0#e000e06&| +0#0000000&|a|r|g|2| @62 @75 @75 -|#+0#0000e05&| +0#0000000&|I+0#e000e06&|s@1|u|e|:| +0#0000e05&|#|1|3|0|4|7| +0#0000000&@59 +|#+0#0000e05&| |E|x|p|r|e|s@1|i|o|n| |c|o|m@1|e|n|t|s| +0#0000000&@53 @75 -|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|e+0#00e0e07&|x|i|s|t|s|(+0#e000e06&|"+0#e000002&|:|D|i|f@1|O|r|i|g|"|)+0#e000e06&| +0#0000000&@51 -@2|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|D|i|f@1|O|r|i|g| |v+0#af5f00255&|e|r|t| +0#0000000&|n+0#af5f00255&|e|w| +0#0000000&||| |s+0#af5f00255&|e|t| +0#0000000&|b+0#e000e06&|t|=+0#af5f00255&|n+0#0000000&|o|f|i|l|e| ||| |r+0#af5f00255&| +0#0000000&|++0#af5f00255&@1|e+0#00e0e07&|d|i|t| +0#0000000&|%+0#af5f00255&@1| +0#0000000&||| |0+0#e000002&|d+0#0000000&|_| ||| |d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000& -@18|\+0#e000e06&| +0#0000000&||| |w+0#af5f00255&|i|n|c|m|d| +0#0000000&|p+0#af5f00255&| +0#0000000&||| |d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000&@33 -|e+0#af5f00255&|n|d|i|f| +0#0000000&@69 +|v+0#af5f00255&|a|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53 +@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63 +@2|b+0#00e0e07&|a|r|:+0#0000000&| |4+0#e000002&|2|,+0#0000000&| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@54 +@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63 +@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63 +@2|b+0#00e0e07&|a|z|:+0#0000000&| |4+0#e000002&|2| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@55 +@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63 +|}+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@63 @75 -@75 -|#+0#0000e05&| +0#0000000&|I+0#e000e06&|s@1|u|e|:| +0#0000e05&|#|1@1|3|0|7| |a|n|d| |#|1@1|5|6|0| +0#0000000&@48 -@75 -|#+0#0000e05&| |T|h|i|s| |i|s| |w|h|a|t| |w|e| |c|a|l@1| |"| |b|l|a|h| +0#0000000&@45 -@57|5@1|,|7| @9|B|o|t| +@57|5@1|,|7| @9|6|7|%| diff --git a/runtime/syntax/testdir/dumps/vim9_comment_04.dump b/runtime/syntax/testdir/dumps/vim9_comment_04.dump new file mode 100644 index 0000000000..42900217c0 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim9_comment_04.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@74 +@75 +|#+0#0000e05&| +0#0000000&|I+0#e000e06&|s@1|u|e|:| +0#0000e05&|#|1|3|0|4|7| +0#0000000&@59 +@75 +|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|e+0#00e0e07&|x|i|s|t|s|(+0#e000e06&|"+0#e000002&|:|D|i|f@1|O|r|i|g|"|)+0#e000e06&| +0#0000000&@51 +@2>c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|D|i|f@1|O|r|i|g| |v+0#af5f00255&|e|r|t| +0#0000000&|n+0#af5f00255&|e|w| +0#0000000&||| |s+0#af5f00255&|e|t| +0#0000000&|b+0#e000e06&|t|=+0#af5f00255&|n+0#0000000&|o|f|i|l|e| ||| |r+0#af5f00255&| +0#0000000&|++0#af5f00255&@1|e+0#00e0e07&|d|i|t| +0#0000000&|%+0#af5f00255&@1| +0#0000000&||| |0+0#e000002&|d+0#0000000&|_| ||| |d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000& +@18|\+0#e000e06&| +0#0000000&||| |w+0#af5f00255&|i|n|c|m|d| +0#0000000&|p+0#af5f00255&| +0#0000000&||| |d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000&@33 +|e+0#af5f00255&|n|d|i|f| +0#0000000&@69 +@75 +@75 +|#+0#0000e05&| +0#0000000&|I+0#e000e06&|s@1|u|e|:| +0#0000e05&|#|1@1|3|0|7| |a|n|d| |#|1@1|5|6|0| +0#0000000&@48 +@75 +|#+0#0000e05&| |T|h|i|s| |i|s| |w|h|a|t| |w|e| |c|a|l@1| |"| |b|l|a|h| +0#0000000&@45 +@75 +@75 +|#+0#0000e05&| +0#0000000&|P+0#e000e06&|R|:| +0#0000e05&|#|1|4|9|7|5| +0#0000000&@62 +|#+0#0000e05&| |h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|4|9|7|5|#|i|s@1|u|e|c|o|m@1|e|n|t|-|2|8|3|2|6|4|3|1@1|5| +0#0000000&@11 +@75 +|v+0#af5f00255&|a|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&| +0#0000000&@65 +@57|7|3|,|3| @9|9|1|%| diff --git a/runtime/syntax/testdir/dumps/vim9_comment_05.dump b/runtime/syntax/testdir/dumps/vim9_comment_05.dump new file mode 100644 index 0000000000..34ced4c29f --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim9_comment_05.dump @@ -0,0 +1,20 @@ +|v+0#af5f00255#ffffff0|a|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&| +0#0000000&@65 +@4|a+0#00e0e07&|:| +0#0000000&|0+0#e000002&|,+0#0000000&| @65 +|#+0#0000e05&| |a| |'| |q|u|o|t|e| |{@2| +0#0000000&@59 +|#+0#0000e05&|}@2| +0#0000000&@70 +|b+0#00e0e07&|:| +0#0000000&|0+0#e000002&|,+0#0000000&| @69 +>}+0#e000e06&| +0#0000000&@73 +@75 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|9|1|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/input/vim9_comment.vim b/runtime/syntax/testdir/input/vim9_comment.vim index 7d22f46bbd..590ddd869b 100644 --- a/runtime/syntax/testdir/input/vim9_comment.vim +++ b/runtime/syntax/testdir/input/vim9_comment.vim @@ -55,6 +55,18 @@ echo "TOP" \ arg2 +# Expression comments + +var foo = { # comment + # comment + bar: 42, # comment + # comment + # comment + baz: 42 # comment + # comment +} # comment + + # Issue: #13047 if !exists(":DiffOrig") @@ -66,3 +78,15 @@ endif # Issue: #11307 and #11560 # This is what we call " blah + + +# PR: #14975 +# https://github.com/vim/vim/pull/14975#issuecomment-2832643115 + +var d = { + a: 0, +# a ' quote {{{ +#}}} +b: 0, +} + diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 741ec81349..2bf0f7deae 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -403,7 +403,7 @@ Vim9 syn match vimAugroup "\\ze\s*\%([#|]\|$\)" skipwhite nextgro " Operators: {{{2 " ========= -syn cluster vimOperGroup contains=@vimContinue,@vimExprList,vim9Comment,vimContinueString +syn cluster vimOperGroup contains=@vimContinue,@vimExprList,vim9Comment,vim9LineComment,vimContinueString syn match vimOper "\a\@