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