comparison runtime/syntax/qb64.vim @ 27459:5825405e4e2c

Update runtime files Commit: https://github.com/vim/vim/commit/f10911e5db16f1fe6ab519c5d091ad0c1df0d063 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 29 22:20:48 2022 +0000 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 Jan 2022 23:30:04 +0100
parents
children
comparison
equal deleted inserted replaced
27458:2a7fc102cb91 27459:5825405e4e2c
1 " Vim syntax file
2 " Language: QB64
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
4 " Last Change: 2022 Jan 21
5
6 " Prelude {{{1
7 if exists("b:current_syntax")
8 finish
9 endif
10
11 let s:cpo_save = &cpo
12 set cpo&vim
13
14 " syn iskeyword set after sourcing of basic.vim
15
16 syn case ignore
17
18 let s:prefix = search('\c^\s*$NOPREFIX\>', 'n') ? '_\=' : '_'
19
20 " Statements {{{1
21
22 let s:statements =<< trim EOL " {{{2
23 acceptfiledrop
24 allowfullscreen
25 assert
26 console
27 consolecursor
28 consolefont
29 consoletitle
30 continue
31 copypalette
32 define
33 delay
34 depthbuffer
35 displayorder
36 dontblend
37 echo
38 exit\s\+\%(select\|case\)
39 finishdrop
40 freefont
41 freeimage
42 icon
43 keyclear
44 limit
45 maptriangle
46 memcopy
47 memfill
48 memfree
49 memput
50 mousehide
51 mousemove
52 mouseshow
53 printimage
54 printstring
55 putimage
56 screenclick
57 screenhide
58 screenmove
59 screenprint
60 screenshow
61 setalpha
62 sndbal
63 sndclose
64 sndlimit
65 sndloop
66 sndpause
67 sndplay
68 sndplaycopy
69 sndplayfile
70 sndraw
71 sndrawdone
72 sndsetpos
73 sndstop
74 sndvol
75 title
76 EOL
77 " }}}
78
79 for s in s:statements
80 exe 'syn match qb64Statement "\<' .. s:prefix .. s .. '\>" contained contains=qb64Underscore'
81 endfor
82
83 " Functions {{{1
84
85 let s:functions =<< trim EOL " {{{2
86 acos
87 acosh
88 alpha
89 alpha32
90 arccot
91 arccsc
92 arcsec
93 asin
94 asinh
95 atan2
96 atanh
97 axis
98 backgroundcolor
99 blue
100 blue32
101 button
102 buttonchange
103 ceil
104 cinp
105 commandcount
106 connected
107 connectionaddress
108 connectionaddress$
109 consoleinput
110 copyimage
111 cot
112 coth
113 cosh
114 csc
115 csch
116 cv
117 cwd$
118 d2g
119 d2r
120 defaultcolor
121 deflate$
122 desktopheight
123 desktopwidth
124 device$
125 deviceinput
126 devices
127 dir$
128 direxists
129 droppedfile
130 droppedfile$
131 errorline
132 errormessage$
133 exit
134 fileexists
135 fontheight
136 fontwidth
137 freetimer
138 g2d
139 g2r
140 green
141 green32
142 height
143 hypot
144 inclerrorfile$
145 inclerrorline
146 inflate$
147 instrrev
148 keyhit
149 keydown
150 lastaxis
151 lastbutton
152 lastwheel
153 loadfont
154 loadimage
155 mem
156 memelement
157 memexists
158 memimage
159 memnew
160 memsound
161 mk$
162 mousebutton
163 mouseinput
164 mousemovementx
165 mousemovementy
166 mousepipeopen
167 mousewheel
168 mousex
169 mousey
170 newimage
171 offset
172 openclient
173 os$
174 pi
175 pixelsize
176 printwidth
177 r2d
178 r2g
179 red
180 red32
181 readbit
182 resetbit
183 resizeheight
184 resizewidth
185 rgb
186 rgb32
187 rgba
188 rgba32
189 round
190 sec
191 sech
192 screenexists
193 screenimage
194 screenx
195 screeny
196 setbit
197 shellhide
198 shl
199 shr
200 sinh
201 sndcopy
202 sndgetpos
203 sndlen
204 sndopen
205 sndopenraw
206 sndpaused
207 sndplaying
208 sndrate
209 sndrawlen
210 startdir$
211 strcmp
212 stricmp
213 tanh
214 title$
215 togglebit
216 totaldroppedfiles
217 trim$
218 wheel
219 width
220 windowhandle
221 windowhasfocus
222 EOL
223 " }}}
224
225 for f in s:functions
226 exe 'syn match qb64Function "\<' .. s:prefix .. f .. '\>" contains=qb64Underscore'
227 endfor
228
229 " Functions and statements (same name) {{{1
230
231 let s:common =<< trim EOL " {{{2
232 autodisplay
233 blend
234 blink
235 capslock
236 clearcolor
237 clipboard$
238 clipboardimage
239 controlchr
240 dest
241 display
242 font
243 fullscreen
244 mapunicode
245 memget
246 numlock
247 palettecolor
248 printmode
249 resize
250 screenicon
251 scrolllock
252 source
253 EOL
254 " }}}
255
256 for c in s:common
257 exe 'syn match qb64Statement "\<' .. s:prefix .. c .. '\>" contains=qb64Underscore contained'
258 exe 'syn match qb64Function "\<' .. s:prefix .. c .. '\>" contains=qb64Underscore'
259 endfor
260
261 " Keywords {{{1
262
263 " Non-prefixed keywords {{{2
264 " TIMER FREE
265 " _DEPTH_BUFFER LOCK
266 syn keyword qb64Keyword free lock
267
268 let s:keywords =<< trim EOL " {{{2
269 all
270 anticlockwise
271 behind
272 clear
273 clip
274 console
275 dontwait
276 explicit
277 explicitarray
278 fillbackground
279 hardware
280 hardware1
281 hide
282 keepbackground
283 middle
284 none
285 off
286 only
287 onlybackground
288 ontop
289 openconnection
290 openhost
291 preserve
292 seamless
293 smooth
294 smoothshrunk
295 smoothstretched
296 software
297 squarepixels
298 stretch
299 toggle
300 EOL
301 " }}}
302
303 for k in s:keywords
304 exe 'syn match qb64Keyword "\<' .. s:prefix .. k .. '\>" contains=qb64Underscore'
305 endfor
306
307 syn match qb64Underscore "\<_" contained conceal transparent
308
309 " Source QuickBASIC syntax {{{1
310 runtime! syntax/basic.vim
311
312 " add after the BASIC syntax file is sourced so cluster already exists
313 syn cluster basicStatements add=qb64Statement,qb64Metacommand,qb64IfMetacommand
314 syn cluster basicLineIdentifier add=qb64LineLabel
315 syn cluster qb64NotTop contains=@basicNotTop,qb64Metavariable
316
317 syn iskeyword @,48-57,.,_,!,#,$,%,&,`
318
319 " Unsupported QuickBASIC features {{{1
320 " TODO: add linux only missing features
321 syn keyword qb64Unsupported alias any byval calls cdecl erdev erdev$ fileattr
322 syn keyword qb64Unsupported fre ioctl ioctl$ pen play setmem signal uevent
323 syn keyword qb64Unsupported tron troff
324 syn match qb64Unsupported "\<declare\%(\s\+\%(sub\|function\)\>\)\@="
325 syn match qb64Unsupported "\<\%(date\|time\)$\ze\s*=" " statements only
326 syn match qb64Unsupported "\<def\zs\s\+FN"
327 syn match qb64Unsupported "\<\%(exit\|end\)\s\+def\>"
328 syn match qb64Unsupported "\<width\s\+lprint\>"
329
330 " Types {{{1
331 syn keyword qb64Type _BIT _BYTE _FLOAT _INTEGER64 _MEM _OFFSET _UNSIGNED
332
333 " Type suffixes {{{1
334 if exists("basic_type_suffixes")
335 " TODO: handle leading word boundary and __+ prefix
336 syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\~\=`\%(\d\+\)\="
337 syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\~\=\%(%\|%%\|&\|&&\|%&\)"
338 syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\%(!\|##\|#\)"
339 syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=$\%(\d\+\)\="
340 endif
341
342 " Numbers {{{1
343
344 " Integers
345 syn match qb64Number "-\=&b[01]\+&\>\="
346
347 syn match qb64Number "-\=\<[01]\~\=`\>"
348 syn match qb64Number "-\=\<\d\+`\d\+\>"
349
350 syn match qb64Number "-\=\<\d\+\%(%%\|&&\|%&\)\>"
351 syn match qb64Number "\<\d\+\~\%(%%\|&&\|%&\)\>"
352
353 syn match qb64Number "-\=\<&b[01]\+\%(%%\|&&\|%&\)\>"
354 syn match qb64Number "\<&b[01]\+\~\%(%%\|&&\|%&\)\>"
355
356 syn match qb64Number "-\=\<&o\=\o\+\%(%%\|&&\|%&\)\>"
357 syn match qb64Number "\<&o\=\o\+\~\%(%%\|&&\|%&\)\>"
358
359 syn match qb64Number "-\=\<&h\x\+\%(%%\|&&\|%&\)\>"
360 syn match qb64Number "\<&h\x\+\~\%(%%\|&&\|%&\)\>"
361
362 " Floats
363 syn match qb64Float "-\=\<\d\+\.\=\d*##\>"
364 syn match qb64Float "-\=\<\.\d\+##\>"
365
366 " Line numbers and labels {{{1
367 syn match qb64LineLabel "\%(_\{2,}\)\=\a[[:alnum:]._]*[[:alnum:]]\ze\s*:" nextgroup=@basicStatements skipwhite contained
368
369 " Metacommands {{{1
370 syn match qb64Metacommand contained "$NOPREFIX\>"
371 syn match qb64Metacommand contained "$ASSERTS\%(:CONSOLE\)\=\>"
372 syn match qb64Metacommand contained "$CHECKING:\%(ON\|OFF\)\>"
373 syn match qb64Metacommand contained "$COLOR:\%(0\|32\)\>"
374 syn match qb64Metacommand contained "$CONSOLE\%(:ONLY\)\=\>"
375 syn match qb64Metacommand contained "$EXEICON\s*:\s*'[^']\+'"
376 syn match qb64Metacommand contained "$ERROR\>"
377 syn match qb64Metacommand contained "$LET\>"
378 syn match qb64Metacommand contained "$RESIZE:\%(ON\|OFF\|STRETCH\|SMOOTH\)\>"
379 syn match qb64Metacommand contained "$SCREEN\%(HIDE\|SHOW\)\>"
380 syn match qb64Metacommand contained "$VERSIONINFO\s*:.*"
381 syn match qb64Metacommand contained "$VIRTUALKEYBOARD:\%(ON\|OFF\)\>"
382
383 syn region qb64IfMetacommand contained matchgroup=qb64Metacommand start="$\%(IF\|ELSEIF\)\>" end="\<THEN\>" oneline transparent contains=qb64Metavariable
384 syn match qb64Metacommand contained "$\%(ELSE\|END\s*IF\)\>"
385
386 syn keyword qb64Metavariable contained defined undefined
387 syn keyword qb64Metavariable contained windows win linux mac maxosx
388 syn keyword qb64Metavariable contained 32bit 64bit version
389
390 " Default Highlighting {{{1
391 hi def link qb64Float basicFloat
392 hi def link qb64Function Function
393 hi def link qb64Keyword Keyword
394 hi def link qb64LineLabel basicLineLabel
395 hi def link qb64Metacommand PreProc
396 hi def link qb64Metavariable Identifier
397 hi def link qb64Number basicNumber
398 hi def link qb64Statement Statement
399 hi def link qb64TypeSuffix basicTypeSuffix
400 hi def link qb64Type Type
401 hi def link qb64Unsupported Error
402
403 " Postscript {{{1
404 let b:current_syntax = "qb64"
405
406 let &cpo = s:cpo_save
407 unlet s:cpo_save
408
409 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: