annotate runtime/syntax/r.vim @ 882:6b89fd4ffcc6 v7.0.008

updated for version 7.0-008
author vimboss
date Sat, 13 May 2006 11:33:27 +0000
parents 8cd729851562
children 7d8af31066c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: R (GNU S)
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
3 " Maintainer: Vaidotas Zemlys <zemlys@gmail.com>
856
8cd729851562 updated for version 7.0g
vimboss
parents: 625
diff changeset
4 " Last Change: 2006 Apr 30
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
5 " Filenames: *.R *.Rout *.r *.Rhistory *.Rt *.Rout.save *.Rout.fail
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
6 " URL: http://uosis.mif.vu.lt/~zemlys/vim-syntax/r.vim
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
7
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
8 " First maintainer Tom Payne <tom@tompayne.org>
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
9 " Modified to make syntax less colourful and added the highlighting of
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
10 " R assignment arrow
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 if version >= 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 setlocal iskeyword=@,48-57,_,.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 set iskeyword=@,48-57,_,.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 syn match rComment /\#.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " string enclosed in double quotes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn region rString start=/"/ skip=/\\\\\|\\"/ end=/"/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " string enclosed in single quotes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syn region rString start=/'/ skip=/\\\\\|\\'/ end=/'/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " number with no fractional part or exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn match rNumber /\d\+/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " floating point number with integer and fractional parts and optional exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 syn match rFloat /\d\+\.\d*\([Ee][-+]\=\d\+\)\=/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " floating point number with no integer part and optional exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn match rFloat /\.\d\+\([Ee][-+]\=\d\+\)\=/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " floating point number with no fractional part and optional exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn match rFloat /\d\+[Ee][-+]\=\d\+/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 " Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 " identifier with leading letter and optional following keyword characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match rIdentifier /\a\k*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 " identifier with leading period, one or more digits, and at least one non-digit keyword character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match rIdentifier /\.\d*\K\k*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 syn keyword rStatement break next return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn keyword rConditional if else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn keyword rRepeat for in repeat while
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 " Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 syn keyword rConstant LETTERS letters month.ab month.name pi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 syn keyword rConstant NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 syn keyword rBoolean FALSE TRUE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 syn keyword rNumber NA
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
61 syn match rArrow /<\{1,2}-/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " Type
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
64 syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 " Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn match rDelimiter /[,;:]/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 syn match rError /[)\]}]/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 syn match rBraceError /[)}]/ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 syn match rCurlyError /[)\]]/ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 syn match rParenError /[\]}]/ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 if version >= 508 || !exists("did_r_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 let did_r_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 HiLink rComment Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 HiLink rConstant Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 HiLink rString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 HiLink rNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 HiLink rBoolean Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 HiLink rFloat Float
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 HiLink rStatement Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 HiLink rConditional Conditional
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 HiLink rRepeat Repeat
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
97 HiLink rIdentifier Normal
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
98 HiLink rArrow Statement
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
99 HiLink rType Type
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 HiLink rDelimiter Delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 HiLink rError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 HiLink rBraceError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 HiLink rCurlyError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 HiLink rParenError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 let b:current_syntax="r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 " vim: ts=8 sw=2
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 7
diff changeset
111