xref: /vim-8.2.3635/runtime/syntax/reva.vim (revision 5be4ceec)
13577c6faSBram Moolenaar" Vim syntax file
23577c6faSBram Moolenaar" Language:	Reva Forth
3db7207e6SBram Moolenaar" Version:	2011.2
4*5be4ceecSBram Moolenaar" Last Change:	2019 Sep 27
53577c6faSBram Moolenaar" Maintainer:	Ron Aaron <[email protected]>
63577c6faSBram Moolenaar" URL:		http://ronware.org/reva/
73577c6faSBram Moolenaar" Filetypes:	*.rf *.frt
83577c6faSBram Moolenaar" NOTE: 	You should also have the ftplugin/reva.vim file to set 'isk'
93577c6faSBram Moolenaar
1089bcfda6SBram Moolenaar" quit when a syntax file was already loaded
1189bcfda6SBram Moolenaarif exists("b:current_syntax")
123577c6faSBram Moolenaar   finish
133577c6faSBram Moolenaarendif
143577c6faSBram Moolenaar
15db7207e6SBram Moolenaarlet s:cpo_save = &cpo
16db7207e6SBram Moolenaarset cpo&vim
17db7207e6SBram Moolenaar
183577c6faSBram Moolenaarsyn clear
193577c6faSBram Moolenaar
203577c6faSBram Moolenaar" Synchronization method
213577c6faSBram Moolenaarsyn sync ccomment
223577c6faSBram Moolenaarsyn sync maxlines=100
233577c6faSBram Moolenaar
243577c6faSBram Moolenaar
253577c6faSBram Moolenaarsyn case ignore
263577c6faSBram Moolenaar" Some special, non-FORTH keywords
273577c6faSBram Moolenaar"syn keyword revaTodo contained todo fixme bugbug todo: bugbug: note:
283577c6faSBram Moolenaarsyn match revaTodo contained '\(todo\|fixme\|bugbug\|note\)[:]*'
293577c6faSBram Moolenaarsyn match revaTodo contained 'copyright\(\s(c)\)\=\(\s[0-9]\{2,4}\)\='
303577c6faSBram Moolenaar
313577c6faSBram Moolenaarsyn match revaHelpDesc '\S.*' contained
323577c6faSBram Moolenaarsyn match revaHelpStuff '\<\(def\|stack\|ctx\|ver\|os\|related\):\s.*'
333577c6faSBram Moolenaarsyn region revaHelpStuff start='\<desc:\>' end='^\S' contains=revaHelpDesc
343577c6faSBram Moolenaarsyn region revaEOF start='\<|||\>' end='{$}' contains=revaHelpStuff
353577c6faSBram Moolenaar
363577c6faSBram Moolenaar
373577c6faSBram Moolenaarsyn case match
383577c6faSBram Moolenaar" basic mathematical and logical operators
393577c6faSBram Moolenaarsyn keyword revaoperators + - * / mod /mod negate abs min max umin umax
403577c6faSBram Moolenaarsyn keyword revaoperators and or xor not invert 1+ 1-
413577c6faSBram Moolenaarsyn keyword revaoperators m+ */ */mod m* um* m*/ um/mod fm/mod sm/rem
423577c6faSBram Moolenaarsyn keyword revaoperators d+ d- dnegate dabs dmin dmax > < = >> << u< <>
433577c6faSBram Moolenaar
443577c6faSBram Moolenaar
453577c6faSBram Moolenaar" stack manipulations
463577c6faSBram Moolenaarsyn keyword revastack drop nip dup over tuck swap rot -rot ?dup pick roll
473577c6faSBram Moolenaarsyn keyword revastack 2drop 2nip 2dup 2over 2swap 2rot 3drop
483577c6faSBram Moolenaarsyn keyword revastack >r r> r@ rdrop
493577c6faSBram Moolenaar" syn keyword revastack sp@ sp! rp@ rp!
503577c6faSBram Moolenaar
513577c6faSBram Moolenaar" address operations
523577c6faSBram Moolenaarsyn keyword revamemory @ ! +! c@ c! 2@ 2! align aligned allot allocate here free resize
533577c6faSBram Moolenaarsyn keyword revaadrarith chars char+ cells cell+ cell cell- 2cell+ 2cell- 3cell+ 4cell+
543577c6faSBram Moolenaarsyn keyword revamemblks move fill
553577c6faSBram Moolenaar
563577c6faSBram Moolenaar" conditionals
573577c6faSBram Moolenaarsyn keyword revacond if else then =if >if <if <>if if0  ;; catch throw
583577c6faSBram Moolenaar
593577c6faSBram Moolenaar" iterations
603577c6faSBram Moolenaarsyn keyword revaloop while repeat until again
613577c6faSBram Moolenaarsyn keyword revaloop do loop i j leave  unloop skip more
623577c6faSBram Moolenaar
633577c6faSBram Moolenaar" new words
643577c6faSBram Moolenaarsyn match revaColonDef '\<noname:\|\<:\s+' contains=revaComment
653577c6faSBram Moolenaarsyn keyword revaEndOfColonDef ; ;inline
663577c6faSBram Moolenaarsyn keyword revadefine constant constant, variable create variable,
673577c6faSBram Moolenaarsyn keyword revadefine user value to +to defer! defer@ defer is does> immediate
683577c6faSBram Moolenaarsyn keyword revadefine compile literal ' [']
693577c6faSBram Moolenaar
703577c6faSBram Moolenaar" Built in words
713577c6faSBram Moolenaarcom! -nargs=+ Builtin syn keyword revaBuiltin <args>
723577c6faSBram MoolenaarBuiltin execute ahead interp bye >body here pad words make
733577c6faSBram MoolenaarBuiltin accept close cr creat delete ekey emit fsize ioerr key?
743577c6faSBram MoolenaarBuiltin mtime open/r open/rw read rename seek space spaces stat
753577c6faSBram MoolenaarBuiltin tell type type_ write (seek) (argv) (save) 0; 0drop;
763577c6faSBram MoolenaarBuiltin >class >lz >name >xt alias alias: appname argc asciiz, asciizl,
773577c6faSBram MoolenaarBuiltin body> clamp depth disassemble findprev fnvhash getenv here,
783577c6faSBram MoolenaarBuiltin iterate last! last@ later link lz> lzmax os parse/ peek
793577c6faSBram MoolenaarBuiltin peek-n pop prior push put rp@ rpick save setenv slurp
803577c6faSBram MoolenaarBuiltin stack-empty? stack-iterate stack-size stack: THROW_BADFUNC
813577c6faSBram MoolenaarBuiltin THROW_BADLIB THROW_GENERIC used xt>size z,
823577c6faSBram MoolenaarBuiltin +lplace +place -chop /char /string bounds c+lplace c+place
833577c6faSBram MoolenaarBuiltin chop cmp cmpi count lc lcount lplace place quote rsplit search split
843577c6faSBram MoolenaarBuiltin zcount zt \\char
853577c6faSBram MoolenaarBuiltin chdir g32 k32 u32 getcwd getpid hinst osname stdin stdout
863577c6faSBram MoolenaarBuiltin (-lib) (bye) (call) (else) (find) (func) (here) (if (lib) (s0) (s^)
873577c6faSBram MoolenaarBuiltin (to~) (while) >in >rel ?literal appstart cold compiling? context? d0 default_class
883577c6faSBram MoolenaarBuiltin defer? dict dolstr dostr find-word h0 if) interp isa onexit
893577c6faSBram MoolenaarBuiltin onstartup pdoes pop>ebx prompt rel> rp0 s0 src srcstr state str0 then,> then> tib
903577c6faSBram MoolenaarBuiltin tp vector vector! word? xt? .ver revaver revaver# && '' 'constant 'context
913577c6faSBram MoolenaarBuiltin 'create 'defer 'does 'forth 'inline 'macro 'macront 'notail 'value 'variable
923577c6faSBram MoolenaarBuiltin (.r) (context) (create) (header) (hide) (inline) (p.r) (words~) (xfind)
933577c6faSBram MoolenaarBuiltin ++ -- , -2drop -2nip -link -swap . .2x .classes .contexts .funcs .libs .needs .r
943577c6faSBram MoolenaarBuiltin .rs .x 00; 0do 0if 1, 2, 3, 2* 2/ 2constant 2variable 3dup 4dup ;then >base >defer
953577c6faSBram MoolenaarBuiltin >rr ? ?do @execute @rem appdir argv as back base base! between chain cleanup-libs
963577c6faSBram MoolenaarBuiltin cmove> context?? ctrl-c ctx>name data: defer: defer@def dictgone do_cr eleave
973577c6faSBram MoolenaarBuiltin endcase endof eval exception exec false find func: header heapgone help help/
983577c6faSBram MoolenaarBuiltin hex# hide inline{ last lastxt lib libdir literal, makeexename mnotail ms ms@
993577c6faSBram MoolenaarBuiltin newclass noop nosavedict notail nul of off on p: padchar parse parseln
1003577c6faSBram MoolenaarBuiltin parsews rangeof rdepth remains reset reva revaused rol8 rr> scratch setclass sp
1013577c6faSBram MoolenaarBuiltin strof super> temp time&date true turnkey? undo vfunc: w! w@
1023577c6faSBram MoolenaarBuiltin xchg xchg2 xfind xt>name xwords { {{ }} }  _+ _1+ _1- pathsep case \||
1033577c6faSBram Moolenaar" p[ [''] [ [']
1043577c6faSBram Moolenaar
1053577c6faSBram Moolenaar
1063577c6faSBram Moolenaar" debugging
1073577c6faSBram Moolenaarsyn keyword revadebug .s dump see
1083577c6faSBram Moolenaar
1093577c6faSBram Moolenaar" basic character operations
1103577c6faSBram Moolenaar" syn keyword revaCharOps (.) CHAR EXPECT FIND WORD TYPE -TRAILING EMIT KEY
1113577c6faSBram Moolenaar" syn keyword revaCharOps KEY? TIB CR
1123577c6faSBram Moolenaar" syn match revaCharOps '\<char\s\S\s'
1133577c6faSBram Moolenaar" syn match revaCharOps '\<\[char\]\s\S\s'
1143577c6faSBram Moolenaar" syn region revaCharOps start=+."\s+ skip=+\\"+ end=+"+
1153577c6faSBram Moolenaar
1163577c6faSBram Moolenaar" char-number conversion
1173577c6faSBram Moolenaarsyn keyword revaconversion s>d >digit digit> >single >double >number >float
1183577c6faSBram Moolenaar
1193577c6faSBram Moolenaar" contexts
1203577c6faSBram Moolenaarsyn keyword revavocs forth macro inline
1213577c6faSBram Moolenaarsyn keyword revavocs context:
1223577c6faSBram Moolenaarsyn match revavocs /\<\~[^~ ]*/
1233577c6faSBram Moolenaarsyn match revavocs /[^~ ]*\~\>/
1243577c6faSBram Moolenaar
1253577c6faSBram Moolenaar" numbers
1263577c6faSBram Moolenaarsyn keyword revamath decimal hex base binary octal
1273577c6faSBram Moolenaarsyn match revainteger '\<-\=[0-9.]*[0-9.]\+\>'
1283577c6faSBram Moolenaar" recognize hex and binary numbers, the '$' and '%' notation is for greva
1293577c6faSBram Moolenaarsyn match revainteger '\<\$\x*\x\+\>' " *1* --- dont't mess
1303577c6faSBram Moolenaarsyn match revainteger '\<\x*\d\x*\>'  " *2* --- this order!
1313577c6faSBram Moolenaarsyn match revainteger '\<%[0-1]*[0-1]\+\>'
1323577c6faSBram Moolenaarsyn match revainteger "\<'.\>"
1333577c6faSBram Moolenaar
1343577c6faSBram Moolenaar" Strings
1353577c6faSBram Moolenaar" syn region revaString start=+\.\?\"+ end=+"+ end=+$+
1363577c6faSBram Moolenaarsyn region revaString start=/"/ skip=/\\"/ end=/"/
1373577c6faSBram Moolenaar
1383577c6faSBram Moolenaar" Comments
1393577c6faSBram Moolenaarsyn region revaComment start='\\S\s' end='.*' contains=revaTodo
1403577c6faSBram Moolenaarsyn match revaComment '\.(\s[^)]\{-})' contains=revaTodo
1413577c6faSBram Moolenaarsyn region revaComment start='(\s' skip='\\)' end=')' contains=revaTodo
1423577c6faSBram Moolenaarsyn match revaComment '(\s[^\-]*\-\-[^\-]\{-})' contains=revaTodo
1433577c6faSBram Moolenaarsyn match revaComment '\<|\s.*$' contains=revaTodo
1443577c6faSBram Moolenaarsyn match revaColonDef '\<:m\?\s*[^ \t]\+\>' contains=revaComment
1453577c6faSBram Moolenaar
1463577c6faSBram Moolenaar" Include files
1473577c6faSBram Moolenaarsyn match revaInclude '\<\(include\|needs\)\s\+\S\+'
1483577c6faSBram Moolenaar
1493577c6faSBram Moolenaar
1503577c6faSBram Moolenaar" Define the default highlighting.
1513577c6faSBram Moolenaarif !exists("did_reva_syntax_inits")
1523577c6faSBram Moolenaar    let did_reva_syntax_inits=1
153*5be4ceecSBram Moolenaar    " The default methods for highlighting. Can be overridden later.
1543577c6faSBram Moolenaar    hi def link revaEOF cIf0
1553577c6faSBram Moolenaar    hi def link revaHelpStuff  special
1563577c6faSBram Moolenaar    hi def link revaHelpDesc Comment
1573577c6faSBram Moolenaar    hi def link revaTodo Todo
1583577c6faSBram Moolenaar    hi def link revaOperators Operator
1593577c6faSBram Moolenaar    hi def link revaMath Number
1603577c6faSBram Moolenaar    hi def link revaInteger Number
1613577c6faSBram Moolenaar    hi def link revaStack Special
1623577c6faSBram Moolenaar    hi def link revaFStack Special
1633577c6faSBram Moolenaar    hi def link revaSP Special
1643577c6faSBram Moolenaar    hi def link revaMemory Operator
1653577c6faSBram Moolenaar    hi def link revaAdrArith Function
1663577c6faSBram Moolenaar    hi def link revaMemBlks Function
1673577c6faSBram Moolenaar    hi def link revaCond Conditional
1683577c6faSBram Moolenaar    hi def link revaLoop Repeat
1693577c6faSBram Moolenaar    hi def link revaColonDef Define
1703577c6faSBram Moolenaar    hi def link revaEndOfColonDef Define
1713577c6faSBram Moolenaar    hi def link revaDefine Define
1723577c6faSBram Moolenaar    hi def link revaDebug Debug
1733577c6faSBram Moolenaar    hi def link revaCharOps Character
1743577c6faSBram Moolenaar    hi def link revaConversion String
1753577c6faSBram Moolenaar    hi def link revaForth Statement
1763577c6faSBram Moolenaar    hi def link revaVocs Statement
1773577c6faSBram Moolenaar    hi def link revaString String
1783577c6faSBram Moolenaar    hi def link revaComment Comment
1793577c6faSBram Moolenaar    hi def link revaClassDef Define
1803577c6faSBram Moolenaar    hi def link revaEndOfClassDef Define
1813577c6faSBram Moolenaar    hi def link revaObjectDef Define
1823577c6faSBram Moolenaar    hi def link revaEndOfObjectDef Define
1833577c6faSBram Moolenaar    hi def link revaInclude Include
1843577c6faSBram Moolenaar    hi def link revaBuiltin Keyword
1853577c6faSBram Moolenaarendif
1863577c6faSBram Moolenaar
1873577c6faSBram Moolenaarlet b:current_syntax = "reva"
188db7207e6SBram Moolenaarlet &cpo = s:cpo_save
189db7207e6SBram Moolenaarunlet s:cpo_save
1903577c6faSBram Moolenaar
1913577c6faSBram Moolenaar" vim: ts=8:sw=4:nocindent:smartindent:
192