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