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