bc.vim 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. " Vim syntax file
  2. " Language: bc - An arbitrary precision calculator language
  3. " Maintainer: Vladimir Scholtz <vlado@gjh.sk>
  4. " Last change: 2012 Jun 01
  5. " (Dominique Pelle added @Spell)
  6. " Available on: www.gjh.sk/~vlado/bc.vim
  7. " quit when a syntax file was already loaded
  8. if exists("b:current_syntax")
  9. finish
  10. endif
  11. syn case ignore
  12. " Keywords
  13. syn keyword bcKeyword if else while for break continue return limits halt quit
  14. syn keyword bcKeyword define
  15. syn keyword bcKeyword length read sqrt print
  16. " Variable
  17. syn keyword bcType auto
  18. " Constant
  19. syn keyword bcConstant scale ibase obase last
  20. syn keyword bcConstant BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX BC_STRING_MAX
  21. syn keyword bcConstant BC_ENV_ARGS BC_LINE_LENGTH
  22. " Any other stuff
  23. syn match bcIdentifier "[a-z_][a-z0-9_]*"
  24. " String
  25. syn match bcString "\"[^"]*\"" contains=@Spell
  26. " Number
  27. syn match bcNumber "[0-9]\+"
  28. " Comment
  29. syn match bcComment "\#.*" contains=@Spell
  30. syn region bcComment start="/\*" end="\*/" contains=@Spell
  31. " Parent ()
  32. syn cluster bcAll contains=bcList,bcIdentifier,bcNumber,bcKeyword,bcType,bcConstant,bcString,bcParentError
  33. syn region bcList matchgroup=Delimiter start="(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=@bcAll
  34. syn region bcList matchgroup=Delimiter start="\[" skip="|.\{-}|" matchgroup=Delimiter end="\]" contains=@bcAll
  35. syn match bcParenError "]"
  36. syn match bcParenError ")"
  37. syn case match
  38. " Define the default highlighting.
  39. " Only when an item doesn't have highlighting yet
  40. hi def link bcKeyword Statement
  41. hi def link bcType Type
  42. hi def link bcConstant Constant
  43. hi def link bcNumber Number
  44. hi def link bcComment Comment
  45. hi def link bcString String
  46. hi def link bcSpecialChar SpecialChar
  47. hi def link bcParenError Error
  48. let b:current_syntax = "bc"
  49. " vim: ts=8