Mercurial > hg > RemoteEditor > vim7
comparison runtime/syntax/freebasic.vim @ 0:76efa0be13f1
Initial revision
author | atsuki |
---|---|
date | Sat, 10 Nov 2007 15:07:22 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:76efa0be13f1 |
---|---|
1 " Vim syntax file | |
2 " Language: FreeBasic | |
3 " Maintainer: Mark Manning <markem@airmail.net> | |
4 " Updated: 10/22/2006 | |
5 " | |
6 " Description: | |
7 " | |
8 " Based originally on the work done by Allan Kelly <Allan.Kelly@ed.ac.uk> | |
9 " Updated by Mark Manning <markem@airmail.net> | |
10 " Applied FreeBasic support to the already excellent support | |
11 " for standard basic syntax (like QB). | |
12 " | |
13 " First version based on Micro$soft QBASIC circa | |
14 " 1989, as documented in 'Learn BASIC Now' by | |
15 " Halvorson&Rygmyr. Microsoft Press 1989. This syntax file | |
16 " not a complete implementation yet. Send suggestions to | |
17 " the maintainer. | |
18 " | |
19 " Quit when a (custom) syntax file was already loaded (Taken from c.vim) | |
20 " | |
21 if exists("b:current_syntax") | |
22 finish | |
23 endif | |
24 " | |
25 " Be sure to turn on the "case ignore" since current versions | |
26 " of freebasic support both upper as well as lowercase | |
27 " letters. - MEM 10/1/2006 | |
28 " | |
29 syn case ignore | |
30 " | |
31 " This list of keywords is taken directly from the FreeBasic | |
32 " user's guide as presented by the FreeBasic online site. | |
33 " | |
34 syn keyword freebasicArrays ERASE LBOUND REDIM PRESERVE UBOUND | |
35 | |
36 syn keyword freebasicBitManipulation BIT BITRESET BITSET HIBYTE HIWORD LOBYTE LOWORD SHL SHR | |
37 | |
38 syn keyword freebasicCompilerSwitches DEFBYTE DEFDBL DEFINT DEFLNG DEFLNGINT DEFSHORT DEFSNG DEFSTR | |
39 syn keyword freebasicCompilerSwitches DEFUBYTE DEFUINT DEFULNGINT DEFUSHORT | |
40 syn match freebasicCompilerSwitches "\<option\s+\(BASE\|BYVAL\|DYNAMIC\|ESCAPE\|EXPLICIT\|NOKEYWORD\)\>" | |
41 syn match freebasicCompilerSwitches "\<option\s+\(PRIVATE\|STATIC\)\>" | |
42 | |
43 syn region freebasicConditional start="\son\s+" skip=".*" end="gosub" | |
44 syn region freebasicConditional start="\son\s+" skip=".*" end="goto" | |
45 syn match freebasicConditional "\<select\s+case\>" | |
46 syn keyword freebasicConditional if iif then case else elseif with | |
47 | |
48 syn match freebasicConsole "\<open\s+\(CONS\|ERR\|PIPE\|SCRN\)\>" | |
49 syn keyword freebasicConsole BEEP CLS CSRLIN LOCATE PRINT POS SPC TAB VIEW WIDTH | |
50 | |
51 syn keyword freebasicDataTypes BYTE AS DIM CONST DOUBLE ENUM INTEGER LONG LONGINT SHARED SHORT STRING | |
52 syn keyword freebasicDataTypes SINGLE TYPE UBYTE UINTEGER ULONGINT UNION UNSIGNED USHORT WSTRING ZSTRING | |
53 | |
54 syn keyword freebasicDateTime DATE DATEADD DATEDIFF DATEPART DATESERIAL DATEVALUE DAY HOUR MINUTE | |
55 syn keyword freebasicDateTime MONTH MONTHNAME NOW SECOND SETDATE SETTIME TIME TIMESERIAL TIMEVALUE | |
56 syn keyword freebasicDateTime TIMER YEAR WEEKDAY WEEKDAYNAME | |
57 | |
58 syn keyword freebasicDebug ASSERT STOP | |
59 | |
60 syn keyword freebasicErrorHandling ERR ERL ERROR LOCAL RESUME | |
61 syn match freebasicErrorHandling "\<resume\s+next\>" | |
62 syn match freebasicErrorHandling "\<on\s+error\>" | |
63 | |
64 syn match freebasicFiles "\<get\s+#\>" | |
65 syn match freebasicFiles "\<input\s+#\>" | |
66 syn match freebasicFiles "\<line\s+input\s+#\>" | |
67 syn match freebasicFiles "\<put\s+#\>" | |
68 syn keyword freebasicFiles ACCESS APPEND BINARY BLOAD BSAVE CLOSE EOF FREEFILE INPUT LOC | |
69 syn keyword freebasicFiles LOCK LOF OPEN OUTPUT RANDOM RESET SEEK UNLOCK WRITE | |
70 | |
71 syn keyword freebasicFunctions ALIAS ANY BYREF BYVAL CALL CDECL CONSTRUCTOR DESTRUCTOR | |
72 syn keyword freebasicFunctions DECLARE FUNCTION LIB OVERLOAD PASCAL STATIC SUB STDCALL | |
73 syn keyword freebasicFunctions VA_ARG VA_FIRST VA_NEXT | |
74 | |
75 syn match freebasicGraphics "\<palette\s+get\>" | |
76 syn keyword freebasicGraphics ALPHA CIRCLE CLS COLOR CUSTOM DRAW FLIP GET | |
77 syn keyword freebasicGraphics IMAGECREATE IMAGEDESTROY LINE PAINT PALETTE PCOPY PMAP POINT | |
78 syn keyword freebasicGraphics PRESET PSET PUT RGB RGBA SCREEN SCREENCOPY SCREENINFO SCREENLIST | |
79 syn keyword freebasicGraphics SCREENLOCK SCREENPTR SCREENRES SCREENSET SCREENSYNC SCREENUNLOCK | |
80 syn keyword freebasicGraphics TRANS USING VIEW WINDOW | |
81 | |
82 syn match freebasicHardware "\<open\s+com\>" | |
83 syn keyword freebasicHardware INP OUT WAIT LPT LPOS LPRINT | |
84 | |
85 syn keyword freebasicLogical AND EQV IMP OR NOT XOR | |
86 | |
87 syn keyword freebasicMath ABS ACOS ASIN ATAN2 ATN COS EXP FIX INT LOG MOD RANDOMIZE | |
88 syn keyword freebasicMath RND SGN SIN SQR TAN | |
89 | |
90 syn keyword freebasicMemory ALLOCATE CALLOCATE CLEAR DEALLOCATE FIELD FRE PEEK POKE REALLOCATE | |
91 | |
92 syn keyword freebasicMisc ASM DATA LET TO READ RESTORE SIZEOF SWAP OFFSETOF | |
93 | |
94 syn keyword freebasicModularizing CHAIN COMMON EXPORT EXTERN DYLIBFREE DYLIBLOAD DYLIBSYMBOL | |
95 syn keyword freebasicModularizing PRIVATE PUBLIC | |
96 | |
97 syn keyword freebasicMultithreading MUTEXCREATE MUTEXDESTROY MUTEXLOCK MUTEXUNLOCK THREADCREATE THREADWAIT | |
98 | |
99 syn keyword freebasicShell CHDIR DIR COMMAND ENVIRON EXEC EXEPATH KILL NAME MKDIR RMDIR RUN | |
100 | |
101 syn keyword freebasicEnviron SHELL SYSTEM WINDOWTITLE POINTERS | |
102 | |
103 syn keyword freebasicLoops FOR LOOP WHILE WEND DO CONTINUE STEP UNTIL next | |
104 | |
105 syn match freebasicInclude "\<#\s*\(inclib\|include\)\>" | |
106 syn match freebasicInclude "\<\$\s*include\>" | |
107 | |
108 syn keyword freebasicPointer PROCPTR PTR SADD STRPTR VARPTR | |
109 | |
110 syn keyword freebasicPredefined __DATE__ __FB_DOS__ __FB_LINUX__ __FB_MAIN__ __FB_MIN_VERSION__ | |
111 syn keyword freebasicPredefined __FB_SIGNATURE__ __FB_VERSION__ __FB_WIN32__ __FB_VER_MAJOR__ | |
112 syn keyword freebasicPredefined __FB_VER_MINOR__ __FB_VER_PATCH__ __FILE__ __FUNCTION__ | |
113 syn keyword freebasicPredefined __LINE__ __TIME__ | |
114 | |
115 syn match freebasicPreProcessor "\<^#\s*\(define\|undef\)\>" | |
116 syn match freebasicPreProcessor "\<^#\s*\(ifdef\|ifndef\|else\|elseif\|endif\|if\)\>" | |
117 syn match freebasicPreProcessor "\<#\s*error\>" | |
118 syn match freebasicPreProcessor "\<#\s*\(print\|dynamic\|static\)\>" | |
119 syn keyword freebasicPreProcessor DEFINED ONCE | |
120 | |
121 syn keyword freebasicProgramFlow END EXIT GOSUB GOTO | |
122 syn keyword freebasicProgramFlow IS RETURN SCOPE SLEEP | |
123 | |
124 syn keyword freebasicString INSTR LCASE LEFT LEN LSET LTRIM MID RIGHT RSET RTRIM | |
125 syn keyword freebasicString SPACE STRING TRIM UCASE ASC BIN CHR CVD CVI CVL CVLONGINT | |
126 syn keyword freebasicString CVS CVSHORT FORMAT HEX MKD MKI MKL MKLONGINT MKS MKSHORT | |
127 syn keyword freebasicString OCT STR VAL VALLNG VALINT VALUINT VALULNG | |
128 | |
129 syn keyword freebasicTypeCasting CAST CBYTE CDBL CINT CLNG CLNGINT CPTR CSHORT CSIGN CSNG | |
130 syn keyword freebasicTypeCasting CUBYTE CUINT CULNGINT CUNSG CURDIR CUSHORT | |
131 | |
132 syn match freebasicUserInput "\<line\s+input\>" | |
133 syn keyword freebasicUserInput GETJOYSTICK GETKEY GETMOUSE INKEY INPUT MULTIKEY SETMOUSE | |
134 " | |
135 " Do the Basic variables names first. This is because it | |
136 " is the most inclusive of the tests. Later on we change | |
137 " this so the identifiers are split up into the various | |
138 " types of identifiers like functions, basic commands and | |
139 " such. MEM 9/9/2006 | |
140 " | |
141 syn match freebasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" | |
142 syn match freebasicGenericFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-1 | |
143 " | |
144 " Function list | |
145 " | |
146 syn keyword freebasicTodo contained TODO | |
147 " | |
148 " Catch errors caused by wrong parenthesis | |
149 " | |
150 syn region freebasicParen transparent start='(' end=')' contains=ALLBUT,@freebasicParenGroup | |
151 syn match freebasicParenError ")" | |
152 syn match freebasicInParen contained "[{}]" | |
153 syn cluster freebasicParenGroup contains=freebasicParenError,freebasicSpecial,freebasicTodo,freebasicUserCont,freebasicUserLabel,freebasicBitField | |
154 " | |
155 " Integer number, or floating point number without a dot and with "f". | |
156 " | |
157 syn region freebasicHex start="&h" end="\W" | |
158 syn region freebasicHexError start="&h\x*[g-zG-Z]" end="\W" | |
159 syn match freebasicInteger "\<\d\+\(u\=l\=\|lu\|f\)\>" | |
160 " | |
161 " Floating point number, with dot, optional exponent | |
162 " | |
163 syn match freebasicFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" | |
164 " | |
165 " Floating point number, starting with a dot, optional exponent | |
166 " | |
167 syn match freebasicFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" | |
168 " | |
169 " Floating point number, without dot, with exponent | |
170 " | |
171 syn match freebasicFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" | |
172 " | |
173 " Hex number | |
174 " | |
175 syn case match | |
176 syn match freebasicOctal "\<0\o*\>" | |
177 syn match freebasicOctalError "\<0\o*[89]" | |
178 " | |
179 " String and Character contstants | |
180 " | |
181 syn region freebasicString start='"' end='"' contains=freebasicSpecial,freebasicTodo | |
182 syn region freebasicString start="'" end="'" contains=freebasicSpecial,freebasicTodo | |
183 " | |
184 " Comments | |
185 " | |
186 syn match freebasicSpecial contained "\\." | |
187 syn region freebasicComment start="^rem" end="$" contains=freebasicSpecial,freebasicTodo | |
188 syn region freebasicComment start=":\s*rem" end="$" contains=freebasicSpecial,freebasicTodo | |
189 syn region freebasicComment start="\s*'" end="$" contains=freebasicSpecial,freebasicTodo | |
190 syn region freebasicComment start="^'" end="$" contains=freebasicSpecial,freebasicTodo | |
191 " | |
192 " Now do the comments and labels | |
193 " | |
194 syn match freebasicLabel "^\d" | |
195 syn match freebasicLabel "\<^\w+:\>" | |
196 syn region freebasicLineNumber start="^\d" end="\s" | |
197 " | |
198 " Create the clusters | |
199 " | |
200 syn cluster freebasicNumber contains=freebasicHex,freebasicOctal,freebasicInteger,freebasicFloat | |
201 syn cluster freebasicError contains=freebasicHexError,freebasicOctalError | |
202 " | |
203 " Used with OPEN statement | |
204 " | |
205 syn match freebasicFilenumber "#\d\+" | |
206 syn match freebasicMathOperator "[\+\-\=\|\*\/\>\<\%\()[\]]" contains=freebasicParen | |
207 " | |
208 " The default methods for highlighting. Can be overridden later | |
209 " | |
210 hi def link freebasicArrays StorageClass | |
211 hi def link freebasicBitManipulation Operator | |
212 hi def link freebasicCompilerSwitches PreCondit | |
213 hi def link freebasicConsole Special | |
214 hi def link freebasicDataTypes Type | |
215 hi def link freebasicDateTime Type | |
216 hi def link freebasicDebug Special | |
217 hi def link freebasicErrorHandling Special | |
218 hi def link freebasicFiles Special | |
219 hi def link freebasicFunctions Function | |
220 hi def link freebasicGraphics Function | |
221 hi def link freebasicHardware Special | |
222 hi def link freebasicLogical Conditional | |
223 hi def link freebasicMath Function | |
224 hi def link freebasicMemory Function | |
225 hi def link freebasicMisc Special | |
226 hi def link freebasicModularizing Special | |
227 hi def link freebasicMultithreading Special | |
228 hi def link freebasicShell Special | |
229 hi def link freebasicEnviron Special | |
230 hi def link freebasicPointer Special | |
231 hi def link freebasicPredefined PreProc | |
232 hi def link freebasicPreProcessor PreProc | |
233 hi def link freebasicProgramFlow Statement | |
234 hi def link freebasicString String | |
235 hi def link freebasicTypeCasting Type | |
236 hi def link freebasicUserInput Statement | |
237 hi def link freebasicComment Comment | |
238 hi def link freebasicConditional Conditional | |
239 hi def link freebasicError Error | |
240 hi def link freebasicIdentifier Identifier | |
241 hi def link freebasicInclude Include | |
242 hi def link freebasicGenericFunction Function | |
243 hi def link freebasicLabel Label | |
244 hi def link freebasicLineNumber Label | |
245 hi def link freebasicMathOperator Operator | |
246 hi def link freebasicNumber Number | |
247 hi def link freebasicSpecial Special | |
248 hi def link freebasicTodo Todo | |
249 | |
250 let b:current_syntax = "freebasic" | |
251 | |
252 " vim: ts=8 |