Merged from the latest developing branch.
[MacVim/jjgod.git] / runtime / syntax / rebol.vim
blobe6395758f3f98884e29919b798da83de2e38efad
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
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
17 " Rebol is case insensitive
18 syn case ignore
20 " As per current users documentation
21 if version < 600
22   set isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~
23 else
24   setlocal isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~
25 endif
27 " Yer TODO highlighter
28 syn keyword     rebolTodo       contained TODO
30 " Comments
31 syn match       rebolComment    ";.*$" contains=rebolTodo
33 " Words
34 syn match       rebolWord       "\a\k*"
35 syn match       rebolWordPath   "[^[:space:]]/[^[:space]]"ms=s+1,me=e-1
37 " Booleans
38 syn keyword     rebolBoolean    true false on off yes no
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,}"
82 " Characters
83 syn match       rebolSpecialCharacter contained "\^[^[:space:][]"
84 syn match       rebolSpecialCharacter contained "%\d\+"
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?
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?
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
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?
126 " Context
127 syn keyword     rebolStatement  alias bind use
129 " Object
130 syn keyword     rebolStatement  import make make-object rebol info?
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?
137 " Debug statement
138 syn keyword     rebolStatement  help probe trace
140 " Misc statements
141 syn keyword     rebolStatement  func function free
143 " Constants
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")
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
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
205   delcommand HiLink
206 endif
208 if exists("my_rebol_file")
209   if file_readable(expand(my_rebol_file))
210     execute "source " . my_rebol_file
211   endif
212 endif
214 let b:current_syntax = "rebol"
216 " vim: ts=8