comparison runtime/syntax/r.vim @ 24520:5bda4653aced

Update runtime files Commit: https://github.com/vim/vim/commit/11e3c5ba820325b69cb56f70e13c21d7b8808d33 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 21 18:09:37 2021 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Apr 2021 18:15:04 +0200
parents 0ecb909e3249
children b2412874362f
comparison
equal deleted inserted replaced
24519:da748a66a65a 24520:5bda4653aced
3 " Maintainer: Jakson Aquino <jalvesaq@gmail.com> 3 " Maintainer: Jakson Aquino <jalvesaq@gmail.com>
4 " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> 4 " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com>
5 " Tom Payne <tom@tompayne.org> 5 " Tom Payne <tom@tompayne.org>
6 " Contributor: Johannes Ranke <jranke@uni-bremen.de> 6 " Contributor: Johannes Ranke <jranke@uni-bremen.de>
7 " Homepage: https://github.com/jalvesaq/R-Vim-runtime 7 " Homepage: https://github.com/jalvesaq/R-Vim-runtime
8 " Last Change: Wed Aug 01, 2018 10:10PM 8 " Last Change: Sun Mar 28, 2021 01:47PM
9 " Filenames: *.R *.r *.Rhistory *.Rt 9 " Filenames: *.R *.r *.Rhistory *.Rt
10 " 10 "
11 " NOTE: The highlighting of R functions might be defined in 11 " NOTE: The highlighting of R functions might be defined in
12 " runtime files created by a filetype plugin, if installed. 12 " runtime files created by a filetype plugin, if installed.
13 " 13 "
51 " Comment 51 " Comment
52 syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" 52 syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
53 syn match rTodoParen contained "\(BUG\|FIXME\|NOTE\|TODO\)\s*(.\{-})\s*:" contains=rTodoKeyw,rTodoInfo transparent 53 syn match rTodoParen contained "\(BUG\|FIXME\|NOTE\|TODO\)\s*(.\{-})\s*:" contains=rTodoKeyw,rTodoInfo transparent
54 syn keyword rTodoKeyw BUG FIXME NOTE TODO contained 54 syn keyword rTodoKeyw BUG FIXME NOTE TODO contained
55 syn match rTodoInfo "(\zs.\{-}\ze)" contained 55 syn match rTodoInfo "(\zs.\{-}\ze)" contained
56 syn match rComment contains=@Spell,rCommentTodo,rTodoParen,rOBlock "#.*" 56 syn match rComment contains=@Spell,rCommentTodo,rTodoParen "#.*"
57 57
58 " Roxygen 58 " Roxygen
59 if g:r_syntax_hl_roxygen 59 if g:r_syntax_hl_roxygen
60 " A roxygen block can start at the beginning of a file (first version) and 60 " A roxygen block can start at the beginning of a file (first version) and
61 " after a blank line (second version). It ends when a line that does not 61 " after a blank line (second version). It ends when a line appears that does not
62 " contain a roxygen comment. In the following comments, any line containing 62 " contain a roxygen comment. In the following comments, any line containing
63 " a roxygen comment marker (one or two hash signs # followed by a single 63 " a roxygen comment marker (one or two hash signs # followed by a single
64 " quote ' and preceded only by whitespace) is called a roxygen line. A 64 " quote ' and preceded only by whitespace) is called a roxygen line. A
65 " roxygen line containing only a roxygen comment marker, optionally followed 65 " roxygen line containing only a roxygen comment marker, optionally followed
66 " by whitespace is called an empty roxygen line. 66 " by whitespace is called an empty roxygen line.
69 " empty roxygen line ending the title or a tag is found, this will be 69 " empty roxygen line ending the title or a tag is found, this will be
70 " overridden later by the definitions of rOBlock. 70 " overridden later by the definitions of rOBlock.
71 syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag 71 syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
72 syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag 72 syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
73 73
74 " A title as part of a block is always at the beginning of the block, i.e.
75 " either at the start of a file or after a completely empty line.
76 syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
77 syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
78 syn match rOTitleTag contained "@title"
79
74 " When a roxygen block has a title and additional content, the title 80 " When a roxygen block has a title and additional content, the title
75 " consists of one or more roxygen lines (as little as possible are matched), 81 " consists of one or more roxygen lines (as little as possible are matched),
76 " followed either by an empty roxygen line 82 " followed either by an empty roxygen line
77 syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold 83 syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
78 syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold 84 syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
85 syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold 91 syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
86 syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold 92 syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
87 syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold 93 syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
88 syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold 94 syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
89 95
90 " A title as part of a block is always at the beginning of the block, i.e.
91 " either at the start of a file or after a completely empty line.
92 syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
93 syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
94 syn match rOTitleTag contained "@title"
95
96 syn match rOCommentKey "^\s*#\{1,2}'" contained 96 syn match rOCommentKey "^\s*#\{1,2}'" contained
97 syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold 97 syn region rOExamples start="^\s*#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
98 98
99 " rOTag list generated from the lists in 99 " R6 classes may contain roxygen lines independent of roxygen blocks
100 syn region rOR6Class start=/R6Class(/ end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold
101 syn match rOR6Block "#\{1,2}'.*" contains=rOTag,rOExamples,@Spell containedin=rOR6Class contained
102 syn match rOR6Block "^\s*#\{1,2}'.*" contains=rOTag,rOExamples,@Spell containedin=rOR6Class contained
103
104 " rOTag list originally generated from the lists that were available in
100 " https://github.com/klutometis/roxygen/R/rd.R and 105 " https://github.com/klutometis/roxygen/R/rd.R and
101 " https://github.com/klutometis/roxygen/R/namespace.R 106 " https://github.com/klutometis/roxygen/R/namespace.R
102 " using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/ 107 " using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/
103 " Plus we need the @include tag 108 " Plus we need the @include tag
104 109
153 syn match rOTag contained "@importMethodsFrom" 158 syn match rOTag contained "@importMethodsFrom"
154 syn match rOTag contained "@rawNamespace" 159 syn match rOTag contained "@rawNamespace"
155 syn match rOTag contained "@S3method" 160 syn match rOTag contained "@S3method"
156 syn match rOTag contained "@useDynLib" 161 syn match rOTag contained "@useDynLib"
157 " other 162 " other
163 syn match rOTag contained "@eval"
158 syn match rOTag contained "@include" 164 syn match rOTag contained "@include"
165 syn match rOTag contained "@includeRmd"
166 syn match rOTag contained "@order"
159 endif 167 endif
160 168
161 169
162 if &filetype == "rhelp" 170 if &filetype == "rhelp"
163 " string enclosed in double quotes 171 " string enclosed in double quotes
183 " Unicode characters 191 " Unicode characters
184 syn match rSpecial display contained "\\u\x\{1,4}" 192 syn match rSpecial display contained "\\u\x\{1,4}"
185 syn match rSpecial display contained "\\U\x\{1,8}" 193 syn match rSpecial display contained "\\U\x\{1,8}"
186 syn match rSpecial display contained "\\u{\x\{1,4}}" 194 syn match rSpecial display contained "\\u{\x\{1,4}}"
187 syn match rSpecial display contained "\\U{\x\{1,8}}" 195 syn match rSpecial display contained "\\U{\x\{1,8}}"
196
197 " Raw string
198 syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\)(/ end=/)\z2\z1/ keepend
199 syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\){/ end=/}\z2\z1/ keepend
200 syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\)\[/ end=/\]\z2\z1/ keepend
188 201
189 " Statement 202 " Statement
190 syn keyword rStatement break next return 203 syn keyword rStatement break next return
191 syn keyword rConditional if else 204 syn keyword rConditional if else
192 syn keyword rRepeat for in repeat while 205 syn keyword rRepeat for in repeat while
352 hi def link rNumber Number 365 hi def link rNumber Number
353 hi def link rOperator Operator 366 hi def link rOperator Operator
354 hi def link rOpError Error 367 hi def link rOpError Error
355 hi def link rParenError Error 368 hi def link rParenError Error
356 hi def link rPreProc PreProc 369 hi def link rPreProc PreProc
370 hi def link rRawString String
371 hi def link rRawStrDelim Delimiter
357 hi def link rRepeat Repeat 372 hi def link rRepeat Repeat
358 hi def link rSpecial SpecialChar 373 hi def link rSpecial SpecialChar
359 hi def link rStatement Statement 374 hi def link rStatement Statement
360 hi def link rString String 375 hi def link rString String
361 hi def link rStrError Error 376 hi def link rStrError Error
364 hi def link rOTitleTag Operator 379 hi def link rOTitleTag Operator
365 hi def link rOTag Operator 380 hi def link rOTag Operator
366 hi def link rOTitleBlock Title 381 hi def link rOTitleBlock Title
367 hi def link rOBlock Comment 382 hi def link rOBlock Comment
368 hi def link rOBlockNoTitle Comment 383 hi def link rOBlockNoTitle Comment
384 hi def link rOR6Block Comment
369 hi def link rOTitle Title 385 hi def link rOTitle Title
370 hi def link rOCommentKey Comment 386 hi def link rOCommentKey Comment
371 hi def link rOExamples SpecialComment 387 hi def link rOExamples SpecialComment
372 endif 388 endif
373 389