7
|
1 " Vim syntax file
|
|
2 " Language: Rebol
|
|
3 " Maintainer: Mike Williams <mrw@eandem.co.uk>
|
|
4 " Filenames: *.r
|
|
5 " Last Change: 27th June 2002
|
|
6 " URL: http://www.eandem.co.uk/mrw/vim
|
|
7 "
|
|
8
|
|
9 " For version 5.x: Clear all syntax items
|
|
10 " For version 6.x: Quit when a syntax file was already loaded
|
|
11 if version < 600
|
|
12 syntax clear
|
|
13 elseif exists("b:current_syntax")
|
|
14 finish
|
|
15 endif
|
|
16
|
|
17 " Rebol is case insensitive
|
|
18 syn case ignore
|
|
19
|
|
20 " As per current users documentation
|
|
21 if version < 600
|
|
22 set isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~
|
|
23 else
|
|
24 setlocal isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~
|
|
25 endif
|
|
26
|
|
27 " Yer TODO highlighter
|
|
28 syn keyword rebolTodo contained TODO
|
|
29
|
|
30 " Comments
|
|
31 syn match rebolComment ";.*$" contains=rebolTodo
|
|
32
|
|
33 " Words
|
|
34 syn match rebolWord "\a\k*"
|
|
35 syn match rebolWordPath "[^[:space:]]/[^[:space]]"ms=s+1,me=e-1
|
|
36
|
|
37 " Booleans
|
|
38 syn keyword rebolBoolean true false on off yes no
|
|
39
|
|
40 " Values
|
|
41 " Integers
|
|
42 syn match rebolInteger "\<[+-]\=\d\+\('\d*\)*\>"
|
|
43 " Decimals
|
|
44 syn match rebolDecimal "[+-]\=\(\d\+\('\d*\)*\)\=[,.]\d*\(e[+-]\=\d\+\)\="
|
|
45 syn match rebolDecimal "[+-]\=\d\+\('\d*\)*\(e[+-]\=\d\+\)\="
|
|
46 " Time
|
|
47 syn match rebolTime "[+-]\=\(\d\+\('\d*\)*\:\)\{1,2}\d\+\('\d*\)*\([.,]\d\+\)\=\([AP]M\)\=\>"
|
|
48 syn match rebolTime "[+-]\=:\d\+\([.,]\d*\)\=\([AP]M\)\=\>"
|
|
49 " Dates
|
|
50 " DD-MMM-YY & YYYY format
|
|
51 syn match rebolDate "\d\{1,2}\([/-]\)\(Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\|Dec\)\1\(\d\{2}\)\{1,2}\>"
|
|
52 " DD-month-YY & YYYY format
|
|
53 syn match rebolDate "\d\{1,2}\([/-]\)\(January\|February\|March\|April\|May\|June\|July\|August\|September\|October\|November\|December\)\1\(\d\{2}\)\{1,2}\>"
|
|
54 " DD-MM-YY & YY format
|
|
55 syn match rebolDate "\d\{1,2}\([/-]\)\d\{1,2}\1\(\d\{2}\)\{1,2}\>"
|
|
56 " YYYY-MM-YY format
|
|
57 syn match rebolDate "\d\{4}-\d\{1,2}-\d\{1,2}\>"
|
|
58 " DD.MM.YYYY format
|
|
59 syn match rebolDate "\d\{1,2}\.\d\{1,2}\.\d\{4}\>"
|
|
60 " Money
|
|
61 syn match rebolMoney "\a*\$\d\+\('\d*\)*\([,.]\d\+\)\="
|
|
62 " Strings
|
|
63 syn region rebolString oneline start=+"+ skip=+^"+ end=+"+ contains=rebolSpecialCharacter
|
|
64 syn region rebolString start=+[^#]{+ end=+}+ skip=+{[^}]*}+ contains=rebolSpecialCharacter
|
|
65 " Binary
|
|
66 syn region rebolBinary start=+\d*#{+ end=+}+ contains=rebolComment
|
|
67 " Email
|
|
68 syn match rebolEmail "\<\k\+@\(\k\+\.\)*\k\+\>"
|
|
69 " File
|
|
70 syn match rebolFile "%\(\k\+/\)*\k\+[/]\=" contains=rebolSpecialCharacter
|
|
71 syn region rebolFile oneline start=+%"+ end=+"+ contains=rebolSpecialCharacter
|
|
72 " URLs
|
|
73 syn match rebolURL "http://\k\+\(\.\k\+\)*\(:\d\+\)\=\(/\(\k\+/\)*\(\k\+\)\=\)*"
|
|
74 syn match rebolURL "file://\k\+\(\.\k\+\)*/\(\k\+/\)*\k\+"
|
|
75 syn match rebolURL "ftp://\(\k\+:\k\+@\)\=\k\+\(\.\k\+\)*\(:\d\+\)\=/\(\k\+/\)*\k\+"
|
|
76 syn match rebolURL "mailto:\k\+\(\.\k\+\)*@\k\+\(\.\k\+\)*"
|
|
77 " Issues
|
|
78 syn match rebolIssue "#\(\d\+-\)*\d\+"
|
|
79 " Tuples
|
|
80 syn match rebolTuple "\(\d\+\.\)\{2,}"
|
|
81
|
|
82 " Characters
|
|
83 syn match rebolSpecialCharacter contained "\^[^[:space:][]"
|
|
84 syn match rebolSpecialCharacter contained "%\d\+"
|
|
85
|
|
86
|
|
87 " Operators
|
|
88 " Math operators
|
|
89 syn match rebolMathOperator "\(\*\{1,2}\|+\|-\|/\{1,2}\)"
|
|
90 syn keyword rebolMathFunction abs absolute add arccosine arcsine arctangent cosine
|
|
91 syn keyword rebolMathFunction divide exp log-10 log-2 log-e max maximum min
|
|
92 syn keyword rebolMathFunction minimum multiply negate power random remainder sine
|
|
93 syn keyword rebolMathFunction square-root subtract tangent
|
|
94 " Binary operators
|
|
95 syn keyword rebolBinaryOperator complement and or xor ~
|
|
96 " Logic operators
|
|
97 syn match rebolLogicOperator "[<>=]=\="
|
|
98 syn match rebolLogicOperator "<>"
|
|
99 syn keyword rebolLogicOperator not
|
|
100 syn keyword rebolLogicFunction all any
|
|
101 syn keyword rebolLogicFunction head? tail?
|
|
102 syn keyword rebolLogicFunction negative? positive? zero? even? odd?
|
|
103 syn keyword rebolLogicFunction binary? block? char? date? decimal? email? empty?
|
|
104 syn keyword rebolLogicFunction file? found? function? integer? issue? logic? money?
|
|
105 syn keyword rebolLogicFunction native? none? object? paren? path? port? series?
|
|
106 syn keyword rebolLogicFunction string? time? tuple? url? word?
|
|
107 syn keyword rebolLogicFunction exists? input? same? value?
|
|
108
|
|
109 " Datatypes
|
|
110 syn keyword rebolType binary! block! char! date! decimal! email! file!
|
|
111 syn keyword rebolType function! integer! issue! logic! money! native!
|
|
112 syn keyword rebolType none! object! paren! path! port! string! time!
|
|
113 syn keyword rebolType tuple! url! word!
|
|
114 syn keyword rebolTypeFunction type?
|
|
115
|
|
116 " Control statements
|
|
117 syn keyword rebolStatement break catch exit halt reduce return shield
|
|
118 syn keyword rebolConditional if else
|
|
119 syn keyword rebolRepeat for forall foreach forskip loop repeat while until do
|
|
120
|
|
121 " Series statements
|
|
122 syn keyword rebolStatement change clear copy fifth find first format fourth free
|
|
123 syn keyword rebolStatement func function head insert last match next parse past
|
|
124 syn keyword rebolStatement pick remove second select skip sort tail third trim length?
|
|
125
|
|
126 " Context
|
|
127 syn keyword rebolStatement alias bind use
|
|
128
|
|
129 " Object
|
|
130 syn keyword rebolStatement import make make-object rebol info?
|
|
131
|
|
132 " I/O statements
|
|
133 syn keyword rebolStatement delete echo form format import input load mold prin
|
|
134 syn keyword rebolStatement print probe read save secure send write
|
|
135 syn keyword rebolOperator size? modified?
|
|
136
|
|
137 " Debug statement
|
|
138 syn keyword rebolStatement help probe trace
|
|
139
|
|
140 " Misc statements
|
|
141 syn keyword rebolStatement func function free
|
|
142
|
|
143 " Constants
|
|
144 syn keyword rebolConstant none
|
|
145
|
|
146
|
|
147 " Define the default highlighting.
|
|
148 " For version 5.7 and earlier: only when not done already
|
|
149 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
150 if version >= 508 || !exists("did_rebol_syntax_inits")
|
|
151 if version < 508
|
|
152 let did_rebol_syntax_inits = 1
|
|
153 command -nargs=+ HiLink hi link <args>
|
|
154 else
|
|
155 command -nargs=+ HiLink hi def link <args>
|
|
156 endif
|
|
157
|
|
158 HiLink rebolTodo Todo
|
|
159
|
|
160 HiLink rebolStatement Statement
|
|
161 HiLink rebolLabel Label
|
|
162 HiLink rebolConditional Conditional
|
|
163 HiLink rebolRepeat Repeat
|
|
164
|
|
165 HiLink rebolOperator Operator
|
|
166 HiLink rebolLogicOperator rebolOperator
|
|
167 HiLink rebolLogicFunction rebolLogicOperator
|
|
168 HiLink rebolMathOperator rebolOperator
|
|
169 HiLink rebolMathFunction rebolMathOperator
|
|
170 HiLink rebolBinaryOperator rebolOperator
|
|
171 HiLink rebolBinaryFunction rebolBinaryOperator
|
|
172
|
|
173 HiLink rebolType Type
|
|
174 HiLink rebolTypeFunction rebolOperator
|
|
175
|
|
176 HiLink rebolWord Identifier
|
|
177 HiLink rebolWordPath rebolWord
|
|
178 HiLink rebolFunction Function
|
|
179
|
|
180 HiLink rebolCharacter Character
|
|
181 HiLink rebolSpecialCharacter SpecialChar
|
|
182 HiLink rebolString String
|
|
183
|
|
184 HiLink rebolNumber Number
|
|
185 HiLink rebolInteger rebolNumber
|
|
186 HiLink rebolDecimal rebolNumber
|
|
187 HiLink rebolTime rebolNumber
|
|
188 HiLink rebolDate rebolNumber
|
|
189 HiLink rebolMoney rebolNumber
|
|
190 HiLink rebolBinary rebolNumber
|
|
191 HiLink rebolEmail rebolString
|
|
192 HiLink rebolFile rebolString
|
|
193 HiLink rebolURL rebolString
|
|
194 HiLink rebolIssue rebolNumber
|
|
195 HiLink rebolTuple rebolNumber
|
|
196 HiLink rebolFloat Float
|
|
197 HiLink rebolBoolean Boolean
|
|
198
|
|
199 HiLink rebolConstant Constant
|
|
200
|
|
201 HiLink rebolComment Comment
|
|
202
|
|
203 HiLink rebolError Error
|
|
204
|
|
205 delcommand HiLink
|
|
206 endif
|
|
207
|
|
208 if exists("my_rebol_file")
|
|
209 if file_readable(expand(my_rebol_file))
|
|
210 execute "source " . my_rebol_file
|
|
211 endif
|
|
212 endif
|
|
213
|
|
214 let b:current_syntax = "rebol"
|
|
215
|
|
216 " vim: ts=8
|