2 " Language: Spice circuit simulator input netlist
3 " Maintainer: Noam Halevy <Noam.Halevy.motorola.com>
4 " Last Change: 12/08/99
6 " This is based on sh.vim by Lennart Schultz
7 " but greatly simplified
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
17 " spice syntax is case INsensitive
20 syn keyword spiceTodo contained TODO
22 syn match spiceComment "^ \=\*.*$"
23 syn match spiceComment "\$.*$"
25 " Numbers, all with engineering suffixes and optional units
26 "==========================================================
27 "floating point number, with dot, optional exponent
28 syn match spiceNumber "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
29 "floating point number, starting with a dot, optional exponent
30 syn match spiceNumber "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
31 "integer number with optional exponent
32 syn match spiceNumber "\<[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
36 syn match spiceWrapLineOperator "\\$"
37 syn match spiceWrapLineOperator "^+"
39 syn match spiceStatement "^ \=\.\I\+"
41 " Matching pairs of parentheses
42 "==========================================
43 syn region spiceParen transparent matchgroup=spiceOperator start="(" end=")" contains=ALLBUT,spiceParenError
44 syn region spiceSinglequote matchgroup=spiceOperator start=+'+ end=+'+
48 syn match spiceParenError ")"
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
57 if version >= 508 || !exists("did_spice_syntax_inits")
59 let did_spice_syntax_inits = 1
60 command -nargs=+ HiLink hi link <args>
62 command -nargs=+ HiLink hi def link <args>
66 HiLink spiceWrapLineOperator spiceOperator
67 HiLink spiceSinglequote spiceExpr
68 HiLink spiceExpr Function
69 HiLink spiceParenError Error
70 HiLink spiceStatement Statement
71 HiLink spiceNumber Number
72 HiLink spiceComment Comment
73 HiLink spiceOperator Operator
78 let b:current_syntax = "spice"
80 " insert the following to $VIM/syntax/scripts.vim
81 " to autodetect HSpice netlists and text listing output:
83 " " Spice netlists and text listings
84 " elseif getline(1) =~ 'spice\>' || getline("$") =~ '^\.end'
85 " so <sfile>:p:h/spice.vim