home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / runtime / syntax / basic.vim < prev    next >
Encoding:
Text File  |  2012-05-31  |  8.3 KB  |  180 lines

  1. " Vim syntax file
  2. " Language:    BASIC
  3. " Maintainer:    Allan Kelly <allan@fruitloaf.co.uk>
  4. " Last Change:  2011 Dec 25 by Thilo Six
  5.  
  6. " First version based on Micro$soft QBASIC circa 1989, as documented in
  7. " 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989.
  8. " This syntax file not a complete implementation yet.  Send suggestions to the
  9. " maintainer.
  10.  
  11. " For version 5.x: Clear all syntax items
  12. " For version 6.x: Quit when a syntax file was already loaded
  13. if version < 600
  14.   syntax clear
  15. elseif exists("b:current_syntax")
  16.   finish
  17. endif
  18.  
  19. let s:cpo_save = &cpo
  20. set cpo&vim
  21.  
  22. " A bunch of useful BASIC keywords
  23. syn keyword basicStatement    BEEP beep Beep BLOAD bload Bload BSAVE bsave Bsave
  24. syn keyword basicStatement    CALL call Call ABSOLUTE absolute Absolute
  25. syn keyword basicStatement    CHAIN chain Chain CHDIR chdir Chdir
  26. syn keyword basicStatement    CIRCLE circle Circle CLEAR clear Clear
  27. syn keyword basicStatement    CLOSE close Close CLS cls Cls COLOR color Color
  28. syn keyword basicStatement    COM com Com COMMON common Common
  29. syn keyword basicStatement    CONST const Const DATA data Data
  30. syn keyword basicStatement    DECLARE declare Declare DEF def Def
  31. syn keyword basicStatement    DEFDBL defdbl Defdbl DEFINT defint Defint
  32. syn keyword basicStatement    DEFLNG deflng Deflng DEFSNG defsng Defsng
  33. syn keyword basicStatement    DEFSTR defstr Defstr DIM dim Dim
  34. syn keyword basicStatement    DO do Do LOOP loop Loop
  35. syn keyword basicStatement    DRAW draw Draw END end End
  36. syn keyword basicStatement    ENVIRON environ Environ ERASE erase Erase
  37. syn keyword basicStatement    ERROR error Error EXIT exit Exit
  38. syn keyword basicStatement    FIELD field Field FILES files Files
  39. syn keyword basicStatement    FOR for For NEXT next Next
  40. syn keyword basicStatement    FUNCTION function Function GET get Get
  41. syn keyword basicStatement    GOSUB gosub Gosub GOTO goto Goto
  42. syn keyword basicStatement    IF if If THEN then Then ELSE else Else
  43. syn keyword basicStatement    INPUT input Input INPUT# input# Input#
  44. syn keyword basicStatement    IOCTL ioctl Ioctl KEY key Key
  45. syn keyword basicStatement    KILL kill Kill LET let Let
  46. syn keyword basicStatement    LINE line Line LOCATE locate Locate
  47. syn keyword basicStatement    LOCK lock Lock UNLOCK unlock Unlock
  48. syn keyword basicStatement    LPRINT lprint Lprint USING using Using
  49. syn keyword basicStatement    LSET lset Lset MKDIR mkdir Mkdir
  50. syn keyword basicStatement    NAME name Name ON on On
  51. syn keyword basicStatement    ERROR error Error OPEN open Open
  52. syn keyword basicStatement    OPTION option Option BASE base Base
  53. syn keyword basicStatement    OUT out Out PAINT paint Paint
  54. syn keyword basicStatement    PALETTE palette Palette PCOPY pcopy Pcopy
  55. syn keyword basicStatement    PEN pen Pen PLAY play Play
  56. syn keyword basicStatement    PMAP pmap Pmap POKE poke Poke
  57. syn keyword basicStatement    PRESET preset Preset PRINT print Print
  58. syn keyword basicStatement    PRINT# print# Print# USING using Using
  59. syn keyword basicStatement    PSET pset Pset PUT put Put
  60. syn keyword basicStatement    RANDOMIZE randomize Randomize READ read Read
  61. syn keyword basicStatement    REDIM redim Redim RESET reset Reset
  62. syn keyword basicStatement    RESTORE restore Restore RESUME resume Resume
  63. syn keyword basicStatement    RETURN return Return RMDIR rmdir Rmdir
  64. syn keyword basicStatement    RSET rset Rset RUN run Run
  65. syn keyword basicStatement    SEEK seek Seek SELECT select Select
  66. syn keyword basicStatement    CASE case Case SHARED shared Shared
  67. syn keyword basicStatement    SHELL shell Shell SLEEP sleep Sleep
  68. syn keyword basicStatement    SOUND sound Sound STATIC static Static
  69. syn keyword basicStatement    STOP stop Stop STRIG strig Strig
  70. syn keyword basicStatement    SUB sub Sub SWAP swap Swap
  71. syn keyword basicStatement    SYSTEM system System TIMER timer Timer
  72. syn keyword basicStatement    TROFF troff Troff TRON tron Tron
  73. syn keyword basicStatement    TYPE type Type UNLOCK unlock Unlock
  74. syn keyword basicStatement    VIEW view View WAIT wait Wait
  75. syn keyword basicStatement    WHILE while While WEND wend Wend
  76. syn keyword basicStatement    WIDTH width Width WINDOW window Window
  77. syn keyword basicStatement    WRITE write Write DATE$ date$ Date$
  78. syn keyword basicStatement    MID$ mid$ Mid$ TIME$ time$ Time$
  79.  
  80. syn keyword basicFunction    ABS abs Abs ASC asc Asc
  81. syn keyword basicFunction    ATN atn Atn CDBL cdbl Cdbl
  82. syn keyword basicFunction    CINT cint Cint CLNG clng Clng
  83. syn keyword basicFunction    COS cos Cos CSNG csng Csng
  84. syn keyword basicFunction    CSRLIN csrlin Csrlin CVD cvd Cvd
  85. syn keyword basicFunction    CVDMBF cvdmbf Cvdmbf CVI cvi Cvi
  86. syn keyword basicFunction    CVL cvl Cvl CVS cvs Cvs
  87. syn keyword basicFunction    CVSMBF cvsmbf Cvsmbf EOF eof Eof
  88. syn keyword basicFunction    ERDEV erdev Erdev ERL erl Erl
  89. syn keyword basicFunction    ERR err Err EXP exp Exp
  90. syn keyword basicFunction    FILEATTR fileattr Fileattr FIX fix Fix
  91. syn keyword basicFunction    FRE fre Fre FREEFILE freefile Freefile
  92. syn keyword basicFunction    INP inp Inp INSTR instr Instr
  93. syn keyword basicFunction    INT int Int LBOUND lbound Lbound
  94. syn keyword basicFunction    LEN len Len LOC loc Loc
  95. syn keyword basicFunction    LOF lof Lof LOG log Log
  96. syn keyword basicFunction    LPOS lpos Lpos PEEK peek Peek
  97. syn keyword basicFunction    PEN pen Pen POINT point Point
  98. syn keyword basicFunction    POS pos Pos RND rnd Rnd
  99. syn keyword basicFunction    SADD sadd Sadd SCREEN screen Screen
  100. syn keyword basicFunction    SEEK seek Seek SETMEM setmem Setmem
  101. syn keyword basicFunction    SGN sgn Sgn SIN sin Sin
  102. syn keyword basicFunction    SPC spc Spc SQR sqr Sqr
  103. syn keyword basicFunction    STICK stick Stick STRIG strig Strig
  104. syn keyword basicFunction    TAB tab Tab TAN tan Tan
  105. syn keyword basicFunction    UBOUND ubound Ubound VAL val Val
  106. syn keyword basicFunction    VALPTR valptr Valptr VALSEG valseg Valseg
  107. syn keyword basicFunction    VARPTR varptr Varptr VARSEG varseg Varseg
  108. syn keyword basicFunction    CHR$ Chr$ chr$ COMMAND$ command$ Command$
  109. syn keyword basicFunction    DATE$ date$ Date$ ENVIRON$ environ$ Environ$
  110. syn keyword basicFunction    ERDEV$ erdev$ Erdev$ HEX$ hex$ Hex$
  111. syn keyword basicFunction    INKEY$ inkey$ Inkey$ INPUT$ input$ Input$
  112. syn keyword basicFunction    IOCTL$ ioctl$ Ioctl$ LCASES$ lcases$ Lcases$
  113. syn keyword basicFunction    LAFT$ laft$ Laft$ LTRIM$ ltrim$ Ltrim$
  114. syn keyword basicFunction    MID$ mid$ Mid$ MKDMBF$ mkdmbf$ Mkdmbf$
  115. syn keyword basicFunction    MKD$ mkd$ Mkd$ MKI$ mki$ Mki$
  116. syn keyword basicFunction    MKL$ mkl$ Mkl$ MKSMBF$ mksmbf$ Mksmbf$
  117. syn keyword basicFunction    MKS$ mks$ Mks$ OCT$ oct$ Oct$
  118. syn keyword basicFunction    RIGHT$ right$ Right$ RTRIM$ rtrim$ Rtrim$
  119. syn keyword basicFunction    SPACE$ space$ Space$ STR$ str$ Str$
  120. syn keyword basicFunction    STRING$ string$ String$ TIME$ time$ Time$
  121. syn keyword basicFunction    UCASE$ ucase$ Ucase$ VARPTR$ varptr$ Varptr$
  122. syn keyword basicTodo contained    TODO
  123.  
  124. "integer number, or floating point number without a dot.
  125. syn match  basicNumber        "\<\d\+\>"
  126. "floating point number, with dot
  127. syn match  basicNumber        "\<\d\+\.\d*\>"
  128. "floating point number, starting with a dot
  129. syn match  basicNumber        "\.\d\+\>"
  130.  
  131. " String and Character contstants
  132. syn match   basicSpecial contained "\\\d\d\d\|\\."
  133. syn region  basicString          start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=basicSpecial
  134.  
  135. syn region  basicComment    start="REM" end="$" contains=basicTodo
  136. syn region  basicComment    start="^[ \t]*'" end="$" contains=basicTodo
  137. syn region  basicLineNumber    start="^\d" end="\s"
  138. syn match   basicTypeSpecifier  "[a-zA-Z0-9][\$%&!#]"ms=s+1
  139. " Used with OPEN statement
  140. syn match   basicFilenumber  "#\d\+"
  141. "syn sync ccomment basicComment
  142. " syn match   basicMathsOperator "[<>+\*^/\\=-]"
  143. syn match   basicMathsOperator   "-\|=\|[:<>+\*^/\\]\|AND\|OR"
  144.  
  145. " Define the default highlighting.
  146. " For version 5.7 and earlier: only when not done already
  147. " For version 5.8 and later: only when an item doesn't have highlighting yet
  148. if version >= 508 || !exists("did_basic_syntax_inits")
  149.   if version < 508
  150.     let did_basic_syntax_inits = 1
  151.     command -nargs=+ HiLink hi link <args>
  152.   else
  153.     command -nargs=+ HiLink hi def link <args>
  154.   endif
  155.  
  156.   HiLink basicLabel        Label
  157.   HiLink basicConditional    Conditional
  158.   HiLink basicRepeat        Repeat
  159.   HiLink basicLineNumber    Comment
  160.   HiLink basicNumber        Number
  161.   HiLink basicError        Error
  162.   HiLink basicStatement    Statement
  163.   HiLink basicString        String
  164.   HiLink basicComment        Comment
  165.   HiLink basicSpecial        Special
  166.   HiLink basicTodo        Todo
  167.   HiLink basicFunction        Identifier
  168.   HiLink basicTypeSpecifier Type
  169.   HiLink basicFilenumber basicTypeSpecifier
  170.   "hi basicMathsOperator term=bold cterm=bold gui=bold
  171.  
  172.   delcommand HiLink
  173. endif
  174.  
  175. let b:current_syntax = "basic"
  176.  
  177. let &cpo = s:cpo_save
  178. unlet s:cpo_save
  179. " vim: ts=8
  180.