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