3 " Maintainer: Mike Williams <mrw@eandem.co.uk>
5 " Last Change: 27th June 2002
6 " URL: http://www.eandem.co.uk/mrw/vim
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
17 " Rebol is case insensitive
20 " As per current users documentation
22 set isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~
24 setlocal isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~
27 " Yer TODO highlighter
28 syn keyword rebolTodo contained TODO
31 syn match rebolComment ";.*$" contains=rebolTodo
34 syn match rebolWord "\a\k*"
35 syn match rebolWordPath "[^[:space:]]/[^[:space]]"ms=s+1,me=e-1
38 syn keyword rebolBoolean true false on off yes no
42 syn match rebolInteger "\<[+-]\=\d\+\('\d*\)*\>"
44 syn match rebolDecimal "[+-]\=\(\d\+\('\d*\)*\)\=[,.]\d*\(e[+-]\=\d\+\)\="
45 syn match rebolDecimal "[+-]\=\d\+\('\d*\)*\(e[+-]\=\d\+\)\="
47 syn match rebolTime "[+-]\=\(\d\+\('\d*\)*\:\)\{1,2}\d\+\('\d*\)*\([.,]\d\+\)\=\([AP]M\)\=\>"
48 syn match rebolTime "[+-]\=:\d\+\([.,]\d*\)\=\([AP]M\)\=\>"
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}\>"
57 syn match rebolDate "\d\{4}-\d\{1,2}-\d\{1,2}\>"
59 syn match rebolDate "\d\{1,2}\.\d\{1,2}\.\d\{4}\>"
61 syn match rebolMoney "\a*\$\d\+\('\d*\)*\([,.]\d\+\)\="
63 syn region rebolString oneline start=+"+ skip=+^"+ end=+"+ contains=rebolSpecialCharacter
64 syn region rebolString start=+[^#]{+ end=+}+ skip=+{[^}]*}+ contains=rebolSpecialCharacter
66 syn region rebolBinary start=+\d*#{+ end=+}+ contains=rebolComment
68 syn match rebolEmail "\<\k\+@\(\k\+\.\)*\k\+\>"
70 syn match rebolFile "%\(\k\+/\)*\k\+[/]\=" contains=rebolSpecialCharacter
71 syn region rebolFile oneline start=+%"+ end=+"+ contains=rebolSpecialCharacter
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\+\)*"
78 syn match rebolIssue "#\(\d\+-\)*\d\+"
80 syn match rebolTuple "\(\d\+\.\)\{2,}"
83 syn match rebolSpecialCharacter contained "\^[^[:space:][]"
84 syn match rebolSpecialCharacter contained "%\d\+"
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
95 syn keyword rebolBinaryOperator complement and or xor ~
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?
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?
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
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?
127 syn keyword rebolStatement alias bind use
130 syn keyword rebolStatement import make make-object rebol info?
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?
138 syn keyword rebolStatement help probe trace
141 syn keyword rebolStatement func function free
144 syn keyword rebolConstant none
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")
152 let did_rebol_syntax_inits = 1
153 command -nargs=+ HiLink hi link <args>
155 command -nargs=+ HiLink hi def link <args>
158 HiLink rebolTodo Todo
160 HiLink rebolStatement Statement
161 HiLink rebolLabel Label
162 HiLink rebolConditional Conditional
163 HiLink rebolRepeat Repeat
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
173 HiLink rebolType Type
174 HiLink rebolTypeFunction rebolOperator
176 HiLink rebolWord Identifier
177 HiLink rebolWordPath rebolWord
178 HiLink rebolFunction Function
180 HiLink rebolCharacter Character
181 HiLink rebolSpecialCharacter SpecialChar
182 HiLink rebolString String
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
199 HiLink rebolConstant Constant
201 HiLink rebolComment Comment
203 HiLink rebolError Error
208 if exists("my_rebol_file")
209 if file_readable(expand(my_rebol_file))
210 execute "source " . my_rebol_file
214 let b:current_syntax = "rebol"