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