1" Vim syntax file 2" Language: bc - An arbitrary precision calculator language 3" Maintainer: Vladimir Scholtz <[email protected]> 4" Last change: 2001 Sep 02 5" Available on: www.gjh.sk/~vlado/bc.vim 6 7" For version 5.x: Clear all syntax items 8" For version 6.x: Quit when a syntax file was already loaded 9if version < 600 10 syntax clear 11elseif exists("b:current_syntax") 12 finish 13endif 14 15syn case ignore 16 17" Keywords 18syn keyword bcKeyword if else while for break continue return limits halt quit 19syn keyword bcKeyword define 20syn keyword bcKeyword length read sqrt print 21 22" Variable 23syn keyword bcType auto 24 25" Constant 26syn keyword bcConstant scale ibase obase last 27syn keyword bcConstant BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX BC_STRING_MAX 28syn keyword bcConstant BC_ENV_ARGS BC_LINE_LENGTH 29 30" Any other stuff 31syn match bcIdentifier "[a-z_][a-z0-9_]*" 32 33" String 34 syn match bcString "\"[^"]*\"" 35 36" Number 37syn match bcNumber "[0-9]\+" 38 39" Comment 40syn match bcComment "\#.*" 41syn region bcComment start="/\*" end="\*/" 42 43" Parent () 44syn cluster bcAll contains=bcList,bcIdentifier,bcNumber,bcKeyword,bcType,bcConstant,bcString,bcParentError 45syn region bcList matchgroup=Delimiter start="(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=@bcAll 46syn region bcList matchgroup=Delimiter start="\[" skip="|.\{-}|" matchgroup=Delimiter end="\]" contains=@bcAll 47syn match bcParenError "]" 48syn match bcParenError ")" 49 50 51 52syn case match 53 54" Define the default highlighting. 55" For version 5.7 and earlier: only when not done already 56" For version 5.8 and later: only when an item doesn't have highlighting yet 57if version >= 508 || !exists("did_bc_syntax_inits") 58 if version < 508 59 let did_bc_syntax_inits = 1 60 command -nargs=+ HiLink hi link <args> 61 else 62 command -nargs=+ HiLink hi def link <args> 63 endif 64 65 HiLink bcKeyword Statement 66 HiLink bcType Type 67 HiLink bcConstant Constant 68 HiLink bcNumber Number 69 HiLink bcComment Comment 70 HiLink bcString String 71 HiLink bcSpecialChar SpecialChar 72 HiLink bcParenError Error 73 74 delcommand HiLink 75endif 76 77let b:current_syntax = "bc" 78" vim: ts=8 79