codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: ibasic3" Maintainer: Mark Manning <markem@airmail.net>4" Originator: Allan Kelly <Allan.Kelly@ed.ac.uk>5" Created: 10/1/20066" Updated: 10/21/20067" Description: A vim file to handle the IBasic file format.8" Notes:9" Updated by Mark Manning <markem@airmail.net>10" Applied IBasic support to the already excellent support for standard11" basic syntax (like QB).12"13" First version based on Micro$soft QBASIC circa 1989, as documented in14" 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989.15" This syntax file not a complete implementation yet.16" Send suggestions to the maintainer.17"18" This version is based upon the commands found in IBasic (www.pyxia.com).19" MEM 10/6/200620"21" Quit when a (custom) syntax file was already loaded (Taken from c.vim)22"23if exists("b:current_syntax")24 finish25endif26"27" Be sure to turn on the "case ignore" since current versions of basic28" support both upper as well as lowercase letters.29"30syn case ignore31"32" A bunch of useful BASIC keywords33"34syn keyword ibasicStatement beep bload bsave call absolute chain chdir circle35syn keyword ibasicStatement clear close cls color com common const data36syn keyword ibasicStatement loop draw end environ erase error exit field37syn keyword ibasicStatement files function get gosub goto38syn keyword ibasicStatement input input# ioctl key kill let line locate39syn keyword ibasicStatement lock unlock lprint using lset mkdir name40syn keyword ibasicStatement on error open option base out paint palette pcopy41syn keyword ibasicStatement pen play pmap poke preset print print# using pset42syn keyword ibasicStatement put randomize read redim reset restore resume43syn keyword ibasicStatement return rmdir rset run seek screen44syn keyword ibasicStatement shared shell sleep sound static stop strig sub45syn keyword ibasicStatement swap system timer troff tron type unlock46syn keyword ibasicStatement view wait width window write47syn keyword ibasicStatement date$ mid$ time$48"49" Do the basic variables names first. This is because it50" is the most inclusive of the tests. Later on we change51" this so the identifiers are split up into the various52" types of identifiers like functions, basic commands and53" such. MEM 9/9/200654"55syn match ibasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"56syn match ibasicGenericFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-157"58" Function list59"60syn keyword ibasicBuiltInFunction abs asc atn cdbl cint clng cos csng csrlin cvd cvdmbf61syn keyword ibasicBuiltInFunction cvi cvl cvs cvsmbf eof erdev erl err exp fileattr62syn keyword ibasicBuiltInFunction fix fre freefile inp instr lbound len loc lof63syn keyword ibasicBuiltInFunction log lpos mod peek pen point pos rnd sadd screen seek64syn keyword ibasicBuiltInFunction setmem sgn sin spc sqr stick strig tab tan ubound65syn keyword ibasicBuiltInFunction val valptr valseg varptr varseg66syn keyword ibasicBuiltInFunction chr\$ command$ date$ environ$ erdev$ hex$ inkey$67syn keyword ibasicBuiltInFunction input$ ioctl$ lcases$ laft$ ltrim$ mid$ mkdmbf$ mkd$68syn keyword ibasicBuiltInFunction mki$ mkl$ mksmbf$ mks$ oct$ right$ rtrim$ space$69syn keyword ibasicBuiltInFunction str$ string$ time$ ucase$ varptr$70syn keyword ibasicTodo contained TODO71syn cluster ibasicFunctionCluster contains=ibasicBuiltInFunction,ibasicGenericFunction72 73syn keyword Conditional if else then elseif endif select case endselect74syn keyword Repeat for do while next enddo endwhile wend75 76syn keyword ibasicTypeSpecifier single double defdbl defsng77syn keyword ibasicTypeSpecifier int integer uint uinteger int64 uint64 defint deflng78syn keyword ibasicTypeSpecifier byte char string istring defstr79syn keyword ibasicDefine dim def declare80"81"catch errors caused by wrong parenthesis82"83syn cluster ibasicParenGroup contains=ibasicParenError,ibasicIncluded,ibasicSpecial,ibasicTodo,ibasicUserCont,ibasicUserLabel,ibasicBitField84syn region ibasicParen transparent start='(' end=')' contains=ALLBUT,@bParenGroup85syn match ibasicParenError ")"86syn match ibasicInParen contained "[{}]"87"88"integer number, or floating point number without a dot and with "f".89"90syn region ibasicHex start="&h" end="\W"91syn region ibasicHexError start="&h\x*[g-zG-Z]" end="\W"92syn match ibasicInteger "\<\d\+\(u\=l\=\|lu\|f\)\>"93"94"floating point number, with dot, optional exponent95"96syn match ibasicFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"97"98"floating point number, starting with a dot, optional exponent99"100syn match ibasicFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"101"102"floating point number, without dot, with exponent103"104syn match ibasicFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"105"106"hex number107"108syn match ibasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"109syn match ibasicFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-1110syn case match111syn match ibasicOctalError "\<0\o*[89]"112"113" String and Character contstants114"115syn region ibasicString start='"' end='"' contains=ibasicSpecial,ibasicTodo116syn region ibasicString start="'" end="'" contains=ibasicSpecial,ibasicTodo117"118" Comments119"120syn match ibasicSpecial contained "\\."121syn region ibasicComment start="^rem" end="$" contains=ibasicSpecial,ibasicTodo122syn region ibasicComment start=":\s*rem" end="$" contains=ibasicSpecial,ibasicTodo123syn region ibasicComment start="\s*'" end="$" contains=ibasicSpecial,ibasicTodo124syn region ibasicComment start="^'" end="$" contains=ibasicSpecial,ibasicTodo125"126" Now do the comments and labels127"128syn match ibasicLabel "^\d"129syn region ibasicLineNumber start="^\d" end="\s"130"131" Pre-compiler options : FreeBasic132"133syn region ibasicPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=ibasicString,ibasicCharacter,ibasicNumber,ibasicCommentError,ibasicSpaceError134syn match ibasicInclude "^\s*#\s*include\s*"135"136" Create the clusters137"138syn cluster ibasicNumber contains=ibasicHex,ibasicInteger,ibasicFloat139syn cluster ibasicError contains=ibasicHexError140"141" Used with OPEN statement142"143syn match ibasicFilenumber "#\d\+"144"145"syn sync ccomment ibasicComment146"147syn match ibasicMathOperator "[\+\-\=\|\*\/\>\<\%\()[\]]" contains=ibasicParen148"149" The default methods for highlighting. Can be overridden later150"151hi def link ibasicLabel Label152hi def link ibasicConditional Conditional153hi def link ibasicRepeat Repeat154hi def link ibasicHex Number155hi def link ibasicInteger Number156hi def link ibasicFloat Number157hi def link ibasicError Error158hi def link ibasicHexError Error159hi def link ibasicStatement Statement160hi def link ibasicString String161hi def link ibasicComment Comment162hi def link ibasicLineNumber Comment163hi def link ibasicSpecial Special164hi def link ibasicTodo Todo165hi def link ibasicGenericFunction Function166hi def link ibasicBuiltInFunction Function167hi def link ibasicTypeSpecifier Type168hi def link ibasicDefine Type169hi def link ibasicInclude Include170hi def link ibasicIdentifier Identifier171hi def link ibasicFilenumber ibasicTypeSpecifier172hi def link ibasicMathOperator Operator173 174let b:current_syntax = "ibasic"175 176" vim: ts=8177 