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