Mercurial > vim
annotate runtime/syntax/r.vim @ 2639:73dd10c18ec4 v7.3.060
updated for version 7.3.060
Problem: Netbeans: crash when socket is disconnected unexpectedly.
Solution: Don't cleanup when a read fails, put a message in the queue and
disconnect later. (Xavier de Gaye)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 16 Nov 2010 15:49:02 +0100 |
parents | 7d8af31066c8 |
children | 6f63330ec225 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
2 " Language: R (GNU S) |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
3 " Maintainer: Jakson Aquino <jalvesaq@gmail.com> |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
4 " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
5 " Tom Payne <tom@tompayne.org> |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
6 " Last Change: Wed Sep 29, 2010 09:31AM |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
7 " Filenames: *.R *.r *.Rhistory *.Rt |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
8 " |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
9 " NOTE: The highlighting of R functions is defined in the |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
10 " r-plugin/functions.vim, which is part of vim-r-plugin2: |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
11 " http://www.vim.org/scripts/script.php?script_id=2628 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
12 " |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
13 " Some lines of code were borrowed from Zhuojun Chen. |
625 | 14 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
15 if exists("b:current_syntax") |
7 | 16 finish |
17 endif | |
18 | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
19 setlocal iskeyword=@,48-57,_,. |
7 | 20 |
21 syn case match | |
22 | |
23 " Comment | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
24 syn match rComment contains=@Spell "\#.*" |
7 | 25 |
26 " string enclosed in double quotes | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
27 syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ |
7 | 28 " string enclosed in single quotes |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
29 syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
30 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
31 syn match rStrError display contained "\\." |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
32 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
33 " New line, carriage return, tab, backspace, bell, feed, vertical tab, backslash |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
34 syn match rSpecial display contained "\\\(n\|r\|t\|b\|a\|f\|v\|'\|\"\)\|\\\\" |
7 | 35 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
36 " Hexadecimal and Octal digits |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
37 syn match rSpecial display contained "\\\(x\x\{1,2}\|[0-8]\{1,3}\)" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
38 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
39 " Unicode characters |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
40 syn match rSpecial display contained "\\u\x\{1,4}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
41 syn match rSpecial display contained "\\U\x\{1,8}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
42 syn match rSpecial display contained "\\u{\x\{1,4}}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
43 syn match rSpecial display contained "\\U{\x\{1,8}}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
44 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
45 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
46 syn match rDollar "\$" |
7 | 47 |
48 " Statement | |
49 syn keyword rStatement break next return | |
50 syn keyword rConditional if else | |
51 syn keyword rRepeat for in repeat while | |
52 | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
53 " Constant (not really) |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
54 syn keyword rConstant T F LETTERS letters month.ab month.name pi |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
55 syn keyword rConstant R.version.string |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
56 |
7 | 57 " Constant |
58 syn keyword rConstant NULL | |
59 syn keyword rBoolean FALSE TRUE | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
60 syn keyword rNumber NA NA_integer_ NA_real_ NA_complex_ NA_character_ |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
61 syn keyword rNumber Inf NaN |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
62 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
63 " integer |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
64 syn match rInteger "\<\d\+L" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
65 syn match rInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
66 syn match rInteger "\<\d\+[Ee]+\=\d\+L" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
67 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
68 syn match rOperator "[\*\!\&\+\-\<\>\=\^\|\~\`/:@]" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
69 syn match rOperator "%\{2}\|%\*%\|%\/%\|%in%\|%o%\|%x%" |
7 | 70 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
71 syn match rComplex "\<\d\+i" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
72 syn match rComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
73 syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
74 syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
75 syn match rComplex "\<\d\+[Ee][-+]\=\d\+i" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
76 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
77 " number with no fractional part or exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
78 syn match rNumber "\<\d\+\>" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
79 " hexadecimal number |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
80 syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
81 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
82 " floating point number with integer and fractional parts and optional exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
83 syn match rFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
84 " floating point number with no integer part and optional exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
85 syn match rFloat "\<\.\d\+\([Ee][-+]\=\d\+\)\=" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
86 " floating point number with no fractional part and optional exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
87 syn match rFloat "\<\d\+[Ee][-+]\=\d\+" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
88 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
89 syn match rArrow "<\{1,2}-" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
90 syn match rArrow "->\{1,2}" |
7 | 91 |
92 " Special | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
93 syn match rDelimiter "[,;:]" |
7 | 94 |
95 " Error | |
96 syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError | |
97 syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError | |
98 syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
99 syn match rError "[)\]}]" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
100 syn match rBraceError "[)}]" contained |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
101 syn match rCurlyError "[)\]]" contained |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
102 syn match rParenError "[\]}]" contained |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
103 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
104 " Functions that may add new objects |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
105 syn keyword rPreProc library require attach detach source |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
106 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
107 " Type |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
108 syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame |
7 | 109 |
110 " Define the default highlighting. | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
111 hi def link rArrow Statement |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
112 hi def link rBoolean Boolean |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
113 hi def link rBraceError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
114 hi def link rComment Comment |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
115 hi def link rComplex Number |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
116 hi def link rConditional Conditional |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
117 hi def link rConstant Constant |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
118 hi def link rCurlyError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
119 hi def link rDelimiter Delimiter |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
120 hi def link rDollar SpecialChar |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
121 hi def link rError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
122 hi def link rFloat Float |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
123 hi def link rInteger Number |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
124 hi def link rNumber Number |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
125 hi def link rOperator Operator |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
126 hi def link rParenError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
127 hi def link rPreProc PreProc |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
128 hi def link rRepeat Repeat |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
129 hi def link rSpecial SpecialChar |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
130 hi def link rStatement Statement |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
131 hi def link rString String |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
132 hi def link rStrError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
133 hi def link rType Type |
7 | 134 |
135 let b:current_syntax="r" | |
136 | |
137 " vim: ts=8 sw=2 |