view runtime/syntax/testdir/input/vim_ex_syntax.vim @ 34613:b0d91b836400

runtime(java): Recognise the {@snippet} documentation tag (#14271) Commit: https://github.com/vim/vim/commit/3e72bf10a0a2fc34f01ff9663ed3324c2a140228 Author: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com> Date: Fri Mar 22 21:32:48 2024 +0300 runtime(java): Recognise the {@snippet} documentation tag (https://github.com/vim/vim/issues/14271) Remember that ?code fragments are typically Java source code, but they may also be fragments of properties files, source code in other languages, or plain text.? Therefore, with these changes, markup tags are highlighted in the Java source files (as external snippets) and in the {@snippet} tags. Also: - Improve matching of the multi-line {@code} documentation tag with any contained balanced braces. - Recognise the {@literal} documentation tag. - Highlight stray blanks in comments. Related to an enhancement proposal for PCRE-like callouts discussed at https://github.com/vim/vim/issues/11217. References: https://openjdk.org/jeps/413 https://docs.oracle.com/en/java/javase/21/docs/specs/javadoc/doc-comment-spec.html Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 22 Mar 2024 19:45:04 +0100
parents 7375d8465b7e
children
line wrap: on
line source

" Vim :syntax command

syn match testMatch "pattern" contained " tail comment
" NOTE: comments not currently supported
syn keyword testKeyword keyword contained " tail comment
syn region testRegion start="start-pattern" skip="skip-pattern" end="end-pattern" contained " tail comment

" Multiline commands

syn keyword testKeyword
      "\ OPTIONS
      "\ conceal option
      \ conceal
      "\ cchar option
      \ cchar=&
      "\ contained option
      \ contained
      "\ containedin option
      \ containedin=testContainer
      "\ nextgroup option
      \ nextgroup=testNext0,@testCluster
      "\ transparent option
      \ transparent
      "\ skipwhite option
      \ skipwhite
      "\ skipempty option
      \ skipempty
      "\ skipnl option
      \ skipnl
      "\ KEYWORDS LIST
      "\ keyword 1
      \ keyword1
      "\ keyword 2
      \ keyword2
      "\ keyword 3
      \ keyword3

syn match testMatch
      "\ MATCH PATTERN
      "\ pattern start
      \ /
      "\ part 1 description
      \pat1a .* pat1b
      "\ part 2 description
      \pat2a .* pat2b
      "\ part 3 description
      \pat3a .* pat3b
      "\ pattern end
      \/
      "\ OPTIONS
      "\ conceal option
      \ conceal
      "\ cchar option
      \ cchar=&
      "\ contained option
      \ contained
      "\ containedin option
      \ containedin=testContainer
      "\ nextgroup option
      \ nextgroup=testNext0,@testCluster
      "\ transparent option
      \ transparent
      "\ skipwhite option
      \ skipwhite
      "\ skipempty option
      \ skipempty
      "\ skipnl option
      \ skipnl
      "\ contains option
      \ contains=testContained1,testContained2
      "\ fold option
      \ fold
      "\ display option
      \ display
      "\ extend option
      \ extend
      "\ excludenl option
      \ excludenl
      "\ keepend option
      \ keepend

syn region testRegion
      "\ OPTIONS
      "\ start option
      \ start="start-pattern"
      "\ skip option
      \ skip="skip-pattern"
      "\ end option
      \ end="end-pattern"
      "\ conceal option
      \ conceal
      "\ cchar option
      \ cchar=&
      "\ contained option
      \ contained
      "\ containedin option
      \ containedin=testContainer
      "\ nextgroup option
      \ nextgroup=testNext0,@testCluster
      "\ transparent option
      \ transparent
      "\ skipwhite option
      \ skipwhite
      "\ skipempty option
      \ skipempty
      "\ skipnl option
      \ skipnl
      "\ contains option
      \ contains=testContained1,testContained2
      "\ oneline option
      \ oneline
      "\ fold option
      \ fold
      "\ display option
      \ display
      "\ extend option
      \ extend
      "\ concealends option
      \ concealends
      "\ excludenl option
      \ excludenl
      "\ keepend option
      \ keepend

syn cluster testCluster
      "\ OPTIONS
      "\ contains option
      \ contains=testContained1,testContained2,testContained3

syn cluster testCluster
      "\ OPTIONS
      "\ add option
      \ add=testAdd
      "\ remove option
      \ remove=testRemove


" multiline group list

syn keyword testNext0 keyword
syn keyword testNext1 keyword
syn keyword testNext2 keyword
syn keyword testNext3 keyword
syn keyword testNext4 keyword
syn keyword testNext5 keyword
syn keyword testNext6 keyword
syn keyword testNext7 keyword
syn keyword testNext8 keyword
syn keyword testNext9 keyword

syn keyword testKeyword
      "\ nextgroup option
      \ nextgroup=
      "\ a comment
      \ testNext0 , testNext1 , 
      "\ a comment
      \ testNext[2-8].* , 
      "\ a comment
      \ testNext9 , @testCluster skipwhite
      "\ KEYWORDS LIST
      \ keyword4
      \ keyword5
      \ keyword6


" leaking contained groups

" Example: runtime/syntax/zsh.vim
"   "cluster" should not be highlighted outside of :syntax commands

function! s:ContainedGroup()
  " ...
  for cluster in ['markdownHighlight_zsh', 'zsh']
    " ...
  endfor
  " ...
endfunction