blob: 306039bc74d5ea90036ca035816a2558c117e574 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Spice circuit simulator input netlist
3" Maintainer: Noam Halevy <Noam.Halevy.motorola.com>
Bram Moolenaarc8734422012-06-01 22:38:45 +02004" Last Change: 2012 Jun 01
5" (Dominique Pelle added @Spell)
Bram Moolenaar071d4272004-06-13 20:20:40 +00006"
7" This is based on sh.vim by Lennart Schultz
8" but greatly simplified
9
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020010" quit when a syntax file was already loaded
11if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000012 finish
13endif
14
15" spice syntax is case INsensitive
16syn case ignore
17
18syn keyword spiceTodo contained TODO
19
Bram Moolenaarc8734422012-06-01 22:38:45 +020020syn match spiceComment "^ \=\*.*$" contains=@Spell
21syn match spiceComment "\$.*$" contains=@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
23" Numbers, all with engineering suffixes and optional units
24"==========================================================
25"floating point number, with dot, optional exponent
26syn match spiceNumber "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
27"floating point number, starting with a dot, optional exponent
28syn match spiceNumber "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
29"integer number with optional exponent
30syn match spiceNumber "\<[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
31
32" Misc
33"=====
34syn match spiceWrapLineOperator "\\$"
35syn match spiceWrapLineOperator "^+"
36
37syn match spiceStatement "^ \=\.\I\+"
38
39" Matching pairs of parentheses
40"==========================================
41syn region spiceParen transparent matchgroup=spiceOperator start="(" end=")" contains=ALLBUT,spiceParenError
42syn region spiceSinglequote matchgroup=spiceOperator start=+'+ end=+'+
43
44" Errors
45"=======
46syn match spiceParenError ")"
47
48" Syncs
49" =====
50syn sync minlines=50
51
52" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020053" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000054
Bram Moolenaarf37506f2016-08-31 22:22:10 +020055hi def link spiceTodo Todo
56hi def link spiceWrapLineOperator spiceOperator
57hi def link spiceSinglequote spiceExpr
58hi def link spiceExpr Function
59hi def link spiceParenError Error
60hi def link spiceStatement Statement
61hi def link spiceNumber Number
62hi def link spiceComment Comment
63hi def link spiceOperator Operator
Bram Moolenaar071d4272004-06-13 20:20:40 +000064
Bram Moolenaar071d4272004-06-13 20:20:40 +000065
66let b:current_syntax = "spice"
67
68" insert the following to $VIM/syntax/scripts.vim
69" to autodetect HSpice netlists and text listing output:
70"
71" " Spice netlists and text listings
72" elseif getline(1) =~ 'spice\>' || getline("$") =~ '^\.end'
73" so <sfile>:p:h/spice.vim
74
75" vim: ts=8