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