rebol.vim 7.0 KB

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