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