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