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