4 " Last Change: 2008/01/11
5 " Maintainer: Ron Aaron <ron@ronware.org>
6 " URL: http://ronware.org/reva/
7 " Filetypes: *.rf *.frt
8 " NOTE: You should also have the ftplugin/reva.vim file to set 'isk'
10 " For version 5.x: Clear all syntax items and don't load
11 " For version 6.x: Quit when a syntax file was already loaded
14 echo "Reva syntax file requires version 6.0 or later of vim!"
16 elseif exists("b:current_syntax")
22 " Synchronization method
28 " Some special, non-FORTH keywords
29 "syn keyword revaTodo contained todo fixme bugbug todo: bugbug: note:
30 syn match revaTodo contained '\(todo\|fixme\|bugbug\|note\)[:]*'
31 syn match revaTodo contained 'copyright\(\s(c)\)\=\(\s[0-9]\{2,4}\)\='
33 syn match revaHelpDesc '\S.*' contained
34 syn match revaHelpStuff '\<\(def\|stack\|ctx\|ver\|os\|related\):\s.*'
35 syn region revaHelpStuff start='\<desc:\>' end='^\S' contains=revaHelpDesc
36 syn region revaEOF start='\<|||\>' end='{$}' contains=revaHelpStuff
40 " basic mathematical and logical operators
41 syn keyword revaoperators + - * / mod /mod negate abs min max umin umax
42 syn keyword revaoperators and or xor not invert 1+ 1-
43 syn keyword revaoperators m+ */ */mod m* um* m*/ um/mod fm/mod sm/rem
44 syn keyword revaoperators d+ d- dnegate dabs dmin dmax > < = >> << u< <>
48 syn keyword revastack drop nip dup over tuck swap rot -rot ?dup pick roll
49 syn keyword revastack 2drop 2nip 2dup 2over 2swap 2rot 3drop
50 syn keyword revastack >r r> r@ rdrop
51 " syn keyword revastack sp@ sp! rp@ rp!
54 syn keyword revamemory @ ! +! c@ c! 2@ 2! align aligned allot allocate here free resize
55 syn keyword revaadrarith chars char+ cells cell+ cell cell- 2cell+ 2cell- 3cell+ 4cell+
56 syn keyword revamemblks move fill
59 syn keyword revacond if else then =if >if <if <>if if0 ;; catch throw
62 syn keyword revaloop while repeat until again
63 syn keyword revaloop do loop i j leave unloop skip more
66 syn match revaColonDef '\<noname:\|\<:\s+' contains=revaComment
67 syn keyword revaEndOfColonDef ; ;inline
68 syn keyword revadefine constant constant, variable create variable,
69 syn keyword revadefine user value to +to defer! defer@ defer is does> immediate
70 syn keyword revadefine compile literal ' [']
73 com! -nargs=+ Builtin syn keyword revaBuiltin <args>
74 Builtin execute ahead interp bye >body here pad words make
75 Builtin accept close cr creat delete ekey emit fsize ioerr key?
76 Builtin mtime open/r open/rw read rename seek space spaces stat
77 Builtin tell type type_ write (seek) (argv) (save) 0; 0drop;
78 Builtin >class >lz >name >xt alias alias: appname argc asciiz, asciizl,
79 Builtin body> clamp depth disassemble findprev fnvhash getenv here,
80 Builtin iterate last! last@ later link lz> lzmax os parse/ peek
81 Builtin peek-n pop prior push put rp@ rpick save setenv slurp
82 Builtin stack-empty? stack-iterate stack-size stack: THROW_BADFUNC
83 Builtin THROW_BADLIB THROW_GENERIC used xt>size z,
84 Builtin +lplace +place -chop /char /string bounds c+lplace c+place
85 Builtin chop cmp cmpi count lc lcount lplace place quote rsplit search split
86 Builtin zcount zt \\char
87 Builtin chdir g32 k32 u32 getcwd getpid hinst osname stdin stdout
88 Builtin (-lib) (bye) (call) (else) (find) (func) (here) (if (lib) (s0) (s^)
89 Builtin (to~) (while) >in >rel ?literal appstart cold compiling? context? d0 default_class
90 Builtin defer? dict dolstr dostr find-word h0 if) interp isa onexit
91 Builtin onstartup pdoes pop>ebx prompt rel> rp0 s0 src srcstr state str0 then,> then> tib
92 Builtin tp vector vector! word? xt? .ver revaver revaver# && '' 'constant 'context
93 Builtin 'create 'defer 'does 'forth 'inline 'macro 'macront 'notail 'value 'variable
94 Builtin (.r) (context) (create) (header) (hide) (inline) (p.r) (words~) (xfind)
95 Builtin ++ -- , -2drop -2nip -link -swap . .2x .classes .contexts .funcs .libs .needs .r
96 Builtin .rs .x 00; 0do 0if 1, 2, 3, 2* 2/ 2constant 2variable 3dup 4dup ;then >base >defer
97 Builtin >rr ? ?do @execute @rem appdir argv as back base base! between chain cleanup-libs
98 Builtin cmove> context?? ctrl-c ctx>name data: defer: defer@def dictgone do_cr eleave
99 Builtin endcase endof eval exception exec false find func: header heapgone help help/
100 Builtin hex# hide inline{ last lastxt lib libdir literal, makeexename mnotail ms ms@
101 Builtin newclass noop nosavedict notail nul of off on p: padchar parse parseln
102 Builtin parsews rangeof rdepth remains reset reva revaused rol8 rr> scratch setclass sp
103 Builtin strof super> temp time&date true turnkey? undo vfunc: w! w@
104 Builtin xchg xchg2 xfind xt>name xwords { {{ }} } _+ _1+ _1- pathsep case \||
109 syn keyword revadebug .s dump see
111 " basic character operations
112 " syn keyword revaCharOps (.) CHAR EXPECT FIND WORD TYPE -TRAILING EMIT KEY
113 " syn keyword revaCharOps KEY? TIB CR
114 " syn match revaCharOps '\<char\s\S\s'
115 " syn match revaCharOps '\<\[char\]\s\S\s'
116 " syn region revaCharOps start=+."\s+ skip=+\\"+ end=+"+
118 " char-number conversion
119 syn keyword revaconversion s>d >digit digit> >single >double >number >float
122 syn keyword revavocs forth macro inline
123 syn keyword revavocs context:
124 syn match revavocs /\<\~[^~ ]*/
125 syn match revavocs /[^~ ]*\~\>/
128 syn keyword revamath decimal hex base binary octal
129 syn match revainteger '\<-\=[0-9.]*[0-9.]\+\>'
130 " recognize hex and binary numbers, the '$' and '%' notation is for greva
131 syn match revainteger '\<\$\x*\x\+\>' " *1* --- dont't mess
132 syn match revainteger '\<\x*\d\x*\>' " *2* --- this order!
133 syn match revainteger '\<%[0-1]*[0-1]\+\>'
134 syn match revainteger "\<'.\>"
137 " syn region revaString start=+\.\?\"+ end=+"+ end=+$+
138 syn region revaString start=/"/ skip=/\\"/ end=/"/
141 syn region revaComment start='\\S\s' end='.*' contains=revaTodo
142 syn match revaComment '\.(\s[^)]\{-})' contains=revaTodo
143 syn region revaComment start='(\s' skip='\\)' end=')' contains=revaTodo
144 syn match revaComment '(\s[^\-]*\-\-[^\-]\{-})' contains=revaTodo
145 syn match revaComment '\<|\s.*$' contains=revaTodo
146 syn match revaColonDef '\<:m\?\s*[^ \t]\+\>' contains=revaComment
149 syn match revaInclude '\<\(include\|needs\)\s\+\S\+'
152 " Define the default highlighting.
153 if !exists("did_reva_syntax_inits")
154 let did_reva_syntax_inits=1
155 " The default methods for highlighting. Can be overriden later.
156 hi def link revaEOF cIf0
157 hi def link revaHelpStuff special
158 hi def link revaHelpDesc Comment
159 hi def link revaTodo Todo
160 hi def link revaOperators Operator
161 hi def link revaMath Number
162 hi def link revaInteger Number
163 hi def link revaStack Special
164 hi def link revaFStack Special
165 hi def link revaSP Special
166 hi def link revaMemory Operator
167 hi def link revaAdrArith Function
168 hi def link revaMemBlks Function
169 hi def link revaCond Conditional
170 hi def link revaLoop Repeat
171 hi def link revaColonDef Define
172 hi def link revaEndOfColonDef Define
173 hi def link revaDefine Define
174 hi def link revaDebug Debug
175 hi def link revaCharOps Character
176 hi def link revaConversion String
177 hi def link revaForth Statement
178 hi def link revaVocs Statement
179 hi def link revaString String
180 hi def link revaComment Comment
181 hi def link revaClassDef Define
182 hi def link revaEndOfClassDef Define
183 hi def link revaObjectDef Define
184 hi def link revaEndOfObjectDef Define
185 hi def link revaInclude Include
186 hi def link revaBuiltin Keyword
189 let b:current_syntax = "reva"
191 " vim: ts=8:sw=4:nocindent:smartindent: