annotate runtime/syntax/ibasic.vim @ 33380:7ba7c38a9914

Added tag v9.0.1948 for changeset 7c9124711f997a267b94de49a7051f2f3294055c
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Sep 2023 22:30:04 +0200
parents e63691e7c504
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
1 " Vim syntax file
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
2 " Language: ibasic
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
3 " Maintainer: Mark Manning <markem@airmail.net>
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
4 " Originator: Allan Kelly <Allan.Kelly@ed.ac.uk>
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
5 " Created: 10/1/2006
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
6 " Updated: 10/21/2006
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
7 " Description: A vim file to handle the IBasic file format.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
8 " Notes:
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
9 " Updated by Mark Manning <markem@airmail.net>
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
10 " Applied IBasic support to the already excellent support for standard
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
11 " basic syntax (like QB).
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
12 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
13 " First version based on Micro$soft QBASIC circa 1989, as documented in
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
14 " 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
15 " This syntax file not a complete implementation yet.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
16 " Send suggestions to the maintainer.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
17 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
18 " This version is based upon the commands found in IBasic (www.pyxia.com).
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
19 " MEM 10/6/2006
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
20 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
21 " Quit when a (custom) syntax file was already loaded (Taken from c.vim)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
22 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
23 if exists("b:current_syntax")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
24 finish
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
25 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
26 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
27 " Be sure to turn on the "case ignore" since current versions of basic
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
28 " support both upper as well as lowercase letters.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
29 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
30 syn case ignore
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
31 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
32 " A bunch of useful BASIC keywords
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
33 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
34 syn keyword ibasicStatement beep bload bsave call absolute chain chdir circle
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
35 syn keyword ibasicStatement clear close cls color com common const data
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
36 syn keyword ibasicStatement loop draw end environ erase error exit field
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
37 syn keyword ibasicStatement files function get gosub goto
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
38 syn keyword ibasicStatement input input# ioctl key kill let line locate
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
39 syn keyword ibasicStatement lock unlock lprint using lset mkdir name
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
40 syn keyword ibasicStatement on error open option base out paint palette pcopy
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
41 syn keyword ibasicStatement pen play pmap poke preset print print# using pset
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
42 syn keyword ibasicStatement put randomize read redim reset restore resume
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
43 syn keyword ibasicStatement return rmdir rset run seek screen
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
44 syn keyword ibasicStatement shared shell sleep sound static stop strig sub
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
45 syn keyword ibasicStatement swap system timer troff tron type unlock
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
46 syn keyword ibasicStatement view wait width window write
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
47 syn keyword ibasicStatement date$ mid$ time$
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
48 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
49 " Do the basic variables names first. This is because it
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
50 " is the most inclusive of the tests. Later on we change
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
51 " this so the identifiers are split up into the various
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
52 " types of identifiers like functions, basic commands and
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
53 " such. MEM 9/9/2006
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
54 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
55 syn match ibasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
56 syn match ibasicGenericFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
57 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
58 " Function list
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
59 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
60 syn keyword ibasicBuiltInFunction abs asc atn cdbl cint clng cos csng csrlin cvd cvdmbf
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
61 syn keyword ibasicBuiltInFunction cvi cvl cvs cvsmbf eof erdev erl err exp fileattr
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
62 syn keyword ibasicBuiltInFunction fix fre freefile inp instr lbound len loc lof
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
63 syn keyword ibasicBuiltInFunction log lpos mod peek pen point pos rnd sadd screen seek
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
64 syn keyword ibasicBuiltInFunction setmem sgn sin spc sqr stick strig tab tan ubound
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
65 syn keyword ibasicBuiltInFunction val valptr valseg varptr varseg
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
66 syn keyword ibasicBuiltInFunction chr\$ command$ date$ environ$ erdev$ hex$ inkey$
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
67 syn keyword ibasicBuiltInFunction input$ ioctl$ lcases$ laft$ ltrim$ mid$ mkdmbf$ mkd$
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
68 syn keyword ibasicBuiltInFunction mki$ mkl$ mksmbf$ mks$ oct$ right$ rtrim$ space$
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
69 syn keyword ibasicBuiltInFunction str$ string$ time$ ucase$ varptr$
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
70 syn keyword ibasicTodo contained TODO
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
71 syn cluster ibasicFunctionCluster contains=ibasicBuiltInFunction,ibasicGenericFunction
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
72
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
73 syn keyword Conditional if else then elseif endif select case endselect
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
74 syn keyword Repeat for do while next enddo endwhile wend
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
75
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
76 syn keyword ibasicTypeSpecifier single double defdbl defsng
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
77 syn keyword ibasicTypeSpecifier int integer uint uinteger int64 uint64 defint deflng
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
78 syn keyword ibasicTypeSpecifier byte char string istring defstr
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
79 syn keyword ibasicDefine dim def declare
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
80 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
81 "catch errors caused by wrong parenthesis
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
82 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
83 syn cluster ibasicParenGroup contains=ibasicParenError,ibasicIncluded,ibasicSpecial,ibasicTodo,ibasicUserCont,ibasicUserLabel,ibasicBitField
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
84 syn region ibasicParen transparent start='(' end=')' contains=ALLBUT,@bParenGroup
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
85 syn match ibasicParenError ")"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
86 syn match ibasicInParen contained "[{}]"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
87 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
88 "integer number, or floating point number without a dot and with "f".
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
89 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
90 syn region ibasicHex start="&h" end="\W"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
91 syn region ibasicHexError start="&h\x*[g-zG-Z]" end="\W"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
92 syn match ibasicInteger "\<\d\+\(u\=l\=\|lu\|f\)\>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
93 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
94 "floating point number, with dot, optional exponent
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
95 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
96 syn match ibasicFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
97 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
98 "floating point number, starting with a dot, optional exponent
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
99 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
100 syn match ibasicFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
101 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
102 "floating point number, without dot, with exponent
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
103 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
104 syn match ibasicFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
105 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
106 "hex number
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
107 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
108 syn match ibasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
109 syn match ibasicFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
110 syn case match
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
111 syn match ibasicOctalError "\<0\o*[89]"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
112 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
113 " String and Character contstants
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
114 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
115 syn region ibasicString start='"' end='"' contains=ibasicSpecial,ibasicTodo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
116 syn region ibasicString start="'" end="'" contains=ibasicSpecial,ibasicTodo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
117 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
118 " Comments
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
119 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
120 syn match ibasicSpecial contained "\\."
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
121 syn region ibasicComment start="^rem" end="$" contains=ibasicSpecial,ibasicTodo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
122 syn region ibasicComment start=":\s*rem" end="$" contains=ibasicSpecial,ibasicTodo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
123 syn region ibasicComment start="\s*'" end="$" contains=ibasicSpecial,ibasicTodo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
124 syn region ibasicComment start="^'" end="$" contains=ibasicSpecial,ibasicTodo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
125 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
126 " Now do the comments and labels
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
127 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
128 syn match ibasicLabel "^\d"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
129 syn region ibasicLineNumber start="^\d" end="\s"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
130 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
131 " Pre-compiler options : FreeBasic
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
132 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
133 syn region ibasicPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=ibasicString,ibasicCharacter,ibasicNumber,ibasicCommentError,ibasicSpaceError
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
134 syn match ibasicInclude "^\s*#\s*include\s*"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
135 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
136 " Create the clusters
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
137 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
138 syn cluster ibasicNumber contains=ibasicHex,ibasicInteger,ibasicFloat
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
139 syn cluster ibasicError contains=ibasicHexError
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
140 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
141 " Used with OPEN statement
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
142 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
143 syn match ibasicFilenumber "#\d\+"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
144 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
145 "syn sync ccomment ibasicComment
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
146 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
147 syn match ibasicMathOperator "[\+\-\=\|\*\/\>\<\%\()[\]]" contains=ibasicParen
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
148 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
149 " The default methods for highlighting. Can be overridden later
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
150 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
151 hi def link ibasicLabel Label
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
152 hi def link ibasicConditional Conditional
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
153 hi def link ibasicRepeat Repeat
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
154 hi def link ibasicHex Number
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
155 hi def link ibasicInteger Number
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
156 hi def link ibasicFloat Number
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
157 hi def link ibasicError Error
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
158 hi def link ibasicHexError Error
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
159 hi def link ibasicStatement Statement
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
160 hi def link ibasicString String
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
161 hi def link ibasicComment Comment
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
162 hi def link ibasicLineNumber Comment
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
163 hi def link ibasicSpecial Special
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
164 hi def link ibasicTodo Todo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
165 hi def link ibasicGenericFunction Function
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
166 hi def link ibasicBuiltInFunction Function
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
167 hi def link ibasicTypeSpecifier Type
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
168 hi def link ibasicDefine Type
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
169 hi def link ibasicInclude Include
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
170 hi def link ibasicIdentifier Identifier
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
171 hi def link ibasicFilenumber ibasicTypeSpecifier
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
172 hi def link ibasicMathOperator Operator
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
173
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
174 let b:current_syntax = "ibasic"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
175
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
176 " vim: ts=8