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 / mac / vim55rt.sit / runtime / syntax / btm.vim < prev    next >
Encoding:
Text File  |  1999-09-25  |  9.1 KB  |  216 lines  |  [TEXT/VIM!]

  1. " Vim syntax file
  2. " Language:    4Dos batch file
  3. " Maintainer:    John Leo Spetz <jls11@po.cwru.edu>
  4. " Last change:    1999 Jul 02
  5.  
  6. "//Issues to resolve:
  7. "//- Boolean operators surrounded by period are recognized but the
  8. "//  periods are not highlighted.  The only way to do that would
  9. "//  be separate synmatches for each possibility otherwise a more
  10. "//  general \.\i\+\. will highlight anything delimited by dots.
  11. "//- After unary operators like "defined" can assume token type.
  12. "//  Should there be more of these?
  13.  
  14. " Remove any old syntax stuff hanging around
  15. syn clear
  16.  
  17. syn case ignore
  18.  
  19. syn keyword btmStatement    call off
  20. syn keyword btmConditional    if iff endiff then else elseiff not errorlevel
  21. syn keyword btmConditional    gt lt eq ne ge le
  22. syn match btmConditional transparent    "\.\i\+\." contains=btmDotBoolOp
  23. syn keyword btmDotBoolOp contained      and or xor
  24. syn match btmConditional    "=="
  25. syn match btmConditional    "!="
  26. syn keyword btmConditional    defined errorlevel exist isalias
  27. syn keyword btmConditional    isdir direxist isinternal islabel
  28. syn keyword btmRepeat        for in do enddo
  29.  
  30. syn keyword btmTodo contained    TODO
  31.  
  32. " String
  33. syn cluster btmVars contains=btmVariable,btmArgument,btmBIFMatch
  34. syn region  btmString    start=+"+  end=+"+ contains=@btmVars
  35. syn match btmNumber     "\<\d\+\>"
  36.  
  37. "syn match  btmIdentifier    "\<\h\w*\>"
  38.  
  39. " If you don't like tabs
  40. "syn match btmShowTab "\t"
  41. "syn match btmShowTabc "\t"
  42. "syn match  btmComment        "^\ *rem.*$" contains=btmTodo,btmShowTabc
  43.  
  44. " Some people use this as a comment line
  45. " In fact this is a Label
  46. "syn match btmComment        "^\ *:\ \+.*$" contains=btmTodo
  47.  
  48. syn match btmComment        "^\ *rem.*$" contains=btmTodo
  49. syn match btmComment        "^\ *::.*$" contains=btmTodo
  50.  
  51. syn match btmLabelMark        "^\ *:[0-9a-zA-Z_\-]\+\>"
  52. syn match btmLabelMark        "goto [0-9a-zA-Z_\-]\+\>"lc=5
  53. syn match btmLabelMark        "gosub [0-9a-zA-Z_\-]\+\>"lc=6
  54.  
  55. " syn match btmCmdDivider ">[>&][>&]\="
  56. syn match btmCmdDivider ">[>&]*"
  57. syn match btmCmdDivider ">>&>"
  58. syn match btmCmdDivider "|&\="
  59. syn match btmCmdDivider "%+"
  60. syn match btmCmdDivider "\^"
  61.  
  62. syn region btmEcho start="echo" skip="echo" matchgroup=btmCmdDivider end="%+" end="$" end="|&\=" end="\^" end=">[>&]*" contains=@btmEchos oneline
  63. syn cluster btmEchos contains=@btmVars,btmEchoCommand,btmEchoParam
  64. syn keyword btmEchoCommand contained    echo echoerr echos echoserr
  65. syn keyword btmEchoParam contained    on off
  66.  
  67. " this is also a valid Label. I don't use it.
  68. "syn match btmLabelMark        "^\ *:\ \+[0-9a-zA-Z_\-]\+\>"
  69.  
  70. " //Environment variable can be expanded using notation %var in 4DOS
  71. syn match btmVariable        "%[0-9a-z_\-]\+" contains=@btmSpecialVars
  72. " //Environment variable can be expanded using notation %var%
  73. syn match btmVariable        "%[0-9a-z_\-]*%" contains=@btmSpecialVars
  74. " //The following are special variable in 4DOS
  75. syn match btmVariable        "%[=#]" contains=@btmSpecialVars
  76. syn match btmVariable        "%??\=" contains=@btmSpecialVars
  77. " //Environment variable can be expanded using notation %[var] in 4DOS
  78. syn match btmVariable        "%\[[0-9a-z_\-]*\]"
  79. " //After some keywords next word should be an environment variable
  80. syn match btmVariable        "defined\s\i\+"lc=8
  81. syn match btmVariable        "set\s\i\+"lc=4
  82. " //Parameters to batchfiles take the format %<digit>
  83. syn match btmArgument        "%\d\>"
  84. " //4DOS allows format %<digit>& meaning batchfile parameters digit and up
  85. syn match btmArgument        "%\d\>&"
  86. " //Variable used by FOR loops sometimes use %%<letter> in batchfiles
  87. syn match btmArgument        "%%\a\>"
  88.  
  89. " //Show 4DOS built-in functions specially
  90. syn match btmBIFMatch "%@\w\+\["he=e-1 contains=btmBuiltInFunc
  91. syn keyword btmBuiltInFunc contained    alias ascii attrib cdrom
  92. syn keyword btmBuiltInFunc contained    char clip comma convert
  93. syn keyword btmBuiltInFunc contained    date day dec descript
  94. syn keyword btmBuiltInFunc contained    device diskfree disktotal
  95. syn keyword btmBuiltInFunc contained    diskused dosmem dow dowi
  96. syn keyword btmBuiltInFunc contained    doy ems eval exec execstr
  97. syn keyword btmBuiltInFunc contained    expand ext extended
  98. syn keyword btmBuiltInFunc contained    fileage fileclose filedate
  99. syn keyword btmBuiltInFunc contained    filename fileopen fileread
  100. syn keyword btmBuiltInFunc contained    files fileseek fileseekl
  101. syn keyword btmBuiltInFunc contained    filesize filetime filewrite
  102. syn keyword btmBuiltInFunc contained    filewriteb findclose
  103. syn keyword btmBuiltInFunc contained    findfirst findnext format
  104. syn keyword btmBuiltInFunc contained    full if inc index insert
  105. syn keyword btmBuiltInFunc contained    instr int label left len
  106. syn keyword btmBuiltInFunc contained    lfn line lines lower lpt
  107. syn keyword btmBuiltInFunc contained    makeage makedate maketime
  108. syn keyword btmBuiltInFunc contained    master month name numeric
  109. syn keyword btmBuiltInFunc contained    path random readscr ready
  110. syn keyword btmBuiltInFunc contained    remote removable repeat
  111. syn keyword btmBuiltInFunc contained    replace right search
  112. syn keyword btmBuiltInFunc contained    select sfn strip substr
  113. syn keyword btmBuiltInFunc contained    time timer trim truename
  114. syn keyword btmBuiltInFunc contained    unique upper wild word
  115. syn keyword btmBuiltInFunc contained    words xms year
  116.  
  117. syn cluster btmSpecialVars contains=btmBuiltInVar,btmSpecialVar
  118.  
  119. " //Show specialized variables specially
  120. " syn match btmSpecialVar contained    "+"
  121. syn match btmSpecialVar contained    "="
  122. syn match btmSpecialVar contained    "#"
  123. syn match btmSpecialVar contained    "??\="
  124. syn keyword btmSpecialVar contained    cmdline colordir comspec
  125. syn keyword btmSpecialVar contained    copycmd dircmd temp temp4dos
  126. syn keyword btmSpecialVar contained    filecompletion path prompt
  127.  
  128. " //Show 4DOS built-in variables specially specially
  129. syn keyword btmBuiltInVar contained    _4ver _alias _ansi
  130. syn keyword btmBuiltInVar contained    _apbatt _aplife _apmac _batch
  131. syn keyword btmBuiltInVar contained    _batchline _batchname _bg
  132. syn keyword btmBuiltInVar contained    _boot _ci _cmdproc _co
  133. syn keyword btmBuiltInVar contained    _codepage _column _columns
  134. syn keyword btmBuiltInVar contained    _country _cpu _cwd _cwds _cwp
  135. syn keyword btmBuiltInVar contained    _cwps _date _day _disk _dname
  136. syn keyword btmBuiltInVar contained    _dos _dosver _dow _dowi _doy
  137. syn keyword btmBuiltInVar contained    _dpmi _dv _env _fg _hlogfile
  138. syn keyword btmBuiltInVar contained    _hour _kbhit _kstack _lastdisk
  139. syn keyword btmBuiltInVar contained    _logfile _minute _monitor
  140. syn keyword btmBuiltInVar contained    _month _mouse _ndp _row _rows
  141. syn keyword btmBuiltInVar contained    _second _shell _swapping
  142. syn keyword btmBuiltInVar contained    _syserr _time _transient
  143. syn keyword btmBuiltInVar contained    _video _win _wintitle _year
  144.  
  145. " //Commands in 4DOS and/or DOS
  146. syn match btmCommand    "\s?"
  147. syn match btmCommand    "^?"
  148. syn keyword btmCommand    alias append assign attrib
  149. syn keyword btmCommand    backup beep break cancel case
  150. syn keyword btmCommand    cd cdd cdpath chcp chdir
  151. syn keyword btmCommand    chkdsk cls color comp copy
  152. syn keyword btmCommand    ctty date debug default defrag
  153. syn keyword btmCommand    del delay describe dir
  154. syn keyword btmCommand    dirhistory dirs diskcomp
  155. syn keyword btmCommand    diskcopy doskey dosshell
  156. syn keyword btmCommand    drawbox drawhline drawvline
  157. "syn keyword btmCommand    echo echoerr echos echoserr
  158. syn keyword btmCommand    edit edlin emm386 endlocal
  159. syn keyword btmCommand    endswitch erase eset except
  160. syn keyword btmCommand    exe2bin exit expand fastopen
  161. syn keyword btmCommand    fc fdisk ffind find format
  162. syn keyword btmCommand    free global gosub goto
  163. syn keyword btmCommand    graftabl graphics help history
  164. syn keyword btmCommand    inkey input join keyb keybd
  165. syn keyword btmCommand    keystack label lh list loadbtm
  166. syn keyword btmCommand    loadhigh lock log md mem
  167. syn keyword btmCommand    memory mirror mkdir mode more
  168. syn keyword btmCommand    move nlsfunc on option path
  169. syn keyword btmCommand    pause popd print prompt pushd
  170. syn keyword btmCommand    quit rd reboot recover ren
  171. syn keyword btmCommand    rename replace restore return
  172. syn keyword btmCommand    rmdir scandisk screen scrput
  173. syn keyword btmCommand    select set setdos setlocal
  174. syn keyword btmCommand    setver share shift sort subst
  175. syn keyword btmCommand    swapping switch sys tee text
  176. syn keyword btmCommand    time timer touch tree truename
  177. syn keyword btmCommand    type unalias undelete unformat
  178. syn keyword btmCommand    unlock unset ver verify vol
  179. syn keyword btmCommand    vscrput y
  180.  
  181. if !exists("did_btm_syntax_inits")
  182.   let did_btm_syntax_inits = 1
  183.   " The default methods for highlighting.  Can be overridden later
  184.   hi link btmLabel        Special
  185.   hi link btmLabelMark        Special
  186.   hi link btmCmdDivider        Special
  187.   hi link btmConditional    btmStatement
  188.   hi link btmDotBoolOp          btmStatement
  189.   hi link btmRepeat        btmStatement
  190.   hi link btmEchoCommand    btmStatement
  191.   hi link btmEchoParam          btmStatement
  192.   hi link btmStatement        Statement
  193.   hi link btmTodo        Todo
  194.   hi link btmString        String
  195.   hi link btmNumber             Number
  196.   hi link btmComment        Comment
  197.   hi link btmArgument        Identifier
  198.   hi link btmVariable        Identifier
  199.   hi link btmEcho        String
  200.   hi link btmBIFMatch           btmStatement
  201.   hi link btmBuiltInFunc        btmStatement
  202.   hi link btmBuiltInVar         btmStatement
  203.   hi link btmSpecialVar         btmStatement
  204.   hi link btmCommand        btmStatement
  205.  
  206. "optional highlighting
  207.   "hi link btmShowTab        Error
  208.   "hi link btmShowTabc        Error
  209.  
  210.   "hi link btmIdentifier        Identifier
  211. endif
  212.  
  213. let b:current_syntax = "btm"
  214.  
  215. " vim: ts=8
  216.