Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: VHDL |
| 3 | " Maintainer: Czo <Olivier.Sirol@lip6.fr> |
| 4 | " Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn> |
Bram Moolenaar | b8ff1fb | 2012-02-04 21:59:01 +0100 | [diff] [blame] | 5 | " Last Changed: 2012 Feb 03 by Thilo Six |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 6 | " $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 7 | |
| 8 | " VHSIC Hardware Description Language |
| 9 | " Very High Scale Integrated Circuit |
| 10 | |
| 11 | " For version 5.x: Clear all syntax items |
| 12 | " For version 6.x: Quit when a syntax file was already loaded |
| 13 | if version < 600 |
| 14 | syntax clear |
| 15 | elseif exists("b:current_syntax") |
| 16 | finish |
| 17 | endif |
| 18 | |
Bram Moolenaar | b8ff1fb | 2012-02-04 21:59:01 +0100 | [diff] [blame] | 19 | let s:cpo_save = &cpo |
| 20 | set cpo&vim |
| 21 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 22 | " This is not VHDL. I use the C-Preprocessor cpp to generate different binaries |
| 23 | " from one VHDL source file. Unfortunately there is no preprocessor for VHDL |
| 24 | " available. If you don't like this, please remove the following lines. |
| 25 | syn match cDefine "^#ifdef[ ]\+[A-Za-z_]\+" |
| 26 | syn match cDefine "^#endif" |
| 27 | |
| 28 | " case is not significant |
| 29 | syn case ignore |
| 30 | |
| 31 | " VHDL keywords |
| 32 | syn keyword vhdlStatement access after alias all assert |
| 33 | syn keyword vhdlStatement architecture array attribute |
| 34 | syn keyword vhdlStatement begin block body buffer bus |
| 35 | syn keyword vhdlStatement case component configuration constant |
| 36 | syn keyword vhdlStatement disconnect downto |
| 37 | syn keyword vhdlStatement elsif end entity exit |
| 38 | syn keyword vhdlStatement file for function |
| 39 | syn keyword vhdlStatement generate generic group guarded |
| 40 | syn keyword vhdlStatement impure in inertial inout is |
| 41 | syn keyword vhdlStatement label library linkage literal loop |
| 42 | syn keyword vhdlStatement map |
| 43 | syn keyword vhdlStatement new next null |
| 44 | syn keyword vhdlStatement of on open others out |
| 45 | syn keyword vhdlStatement package port postponed procedure process pure |
| 46 | syn keyword vhdlStatement range record register reject report return |
| 47 | syn keyword vhdlStatement select severity signal shared |
| 48 | syn keyword vhdlStatement subtype |
| 49 | syn keyword vhdlStatement then to transport type |
| 50 | syn keyword vhdlStatement unaffected units until use |
| 51 | syn keyword vhdlStatement variable wait when while with |
| 52 | syn keyword vhdlStatement note warning error failure |
| 53 | |
| 54 | " Special match for "if" and "else" since "else if" shouldn't be highlighted. |
| 55 | " The right keyword is "elsif" |
| 56 | syn match vhdlStatement "\<\(if\|else\)\>" |
| 57 | syn match vhdlNone "\<else\s\+if\>$" |
| 58 | syn match vhdlNone "\<else\s\+if\>\s" |
| 59 | |
| 60 | " Predifined VHDL types |
| 61 | syn keyword vhdlType bit bit_vector |
| 62 | syn keyword vhdlType character boolean integer real time |
| 63 | syn keyword vhdlType string severity_level |
| 64 | " Predifined standard ieee VHDL types |
| 65 | syn keyword vhdlType positive natural signed unsigned |
| 66 | syn keyword vhdlType line text |
| 67 | syn keyword vhdlType std_logic std_logic_vector |
| 68 | syn keyword vhdlType std_ulogic std_ulogic_vector |
| 69 | " Predefined non standard VHDL types for Mentor Graphics Sys1076/QuickHDL |
| 70 | syn keyword vhdlType qsim_state qsim_state_vector |
| 71 | syn keyword vhdlType qsim_12state qsim_12state_vector |
| 72 | syn keyword vhdlType qsim_strength |
| 73 | " Predefined non standard VHDL types for Alliance VLSI CAD |
| 74 | syn keyword vhdlType mux_bit mux_vector reg_bit reg_vector wor_bit wor_vector |
| 75 | |
| 76 | " array attributes |
| 77 | syn match vhdlAttribute "\'high" |
| 78 | syn match vhdlAttribute "\'left" |
| 79 | syn match vhdlAttribute "\'length" |
| 80 | syn match vhdlAttribute "\'low" |
| 81 | syn match vhdlAttribute "\'range" |
| 82 | syn match vhdlAttribute "\'reverse_range" |
| 83 | syn match vhdlAttribute "\'right" |
| 84 | syn match vhdlAttribute "\'ascending" |
| 85 | " block attributes |
| 86 | syn match vhdlAttribute "\'behaviour" |
| 87 | syn match vhdlAttribute "\'structure" |
| 88 | syn match vhdlAttribute "\'simple_name" |
| 89 | syn match vhdlAttribute "\'instance_name" |
| 90 | syn match vhdlAttribute "\'path_name" |
| 91 | syn match vhdlAttribute "\'foreign" |
| 92 | " signal attribute |
| 93 | syn match vhdlAttribute "\'active" |
| 94 | syn match vhdlAttribute "\'delayed" |
| 95 | syn match vhdlAttribute "\'event" |
| 96 | syn match vhdlAttribute "\'last_active" |
| 97 | syn match vhdlAttribute "\'last_event" |
| 98 | syn match vhdlAttribute "\'last_value" |
| 99 | syn match vhdlAttribute "\'quiet" |
| 100 | syn match vhdlAttribute "\'stable" |
| 101 | syn match vhdlAttribute "\'transaction" |
| 102 | syn match vhdlAttribute "\'driving" |
| 103 | syn match vhdlAttribute "\'driving_value" |
| 104 | " type attributes |
| 105 | syn match vhdlAttribute "\'base" |
| 106 | syn match vhdlAttribute "\'high" |
| 107 | syn match vhdlAttribute "\'left" |
| 108 | syn match vhdlAttribute "\'leftof" |
| 109 | syn match vhdlAttribute "\'low" |
| 110 | syn match vhdlAttribute "\'pos" |
| 111 | syn match vhdlAttribute "\'pred" |
| 112 | syn match vhdlAttribute "\'rightof" |
| 113 | syn match vhdlAttribute "\'succ" |
| 114 | syn match vhdlAttribute "\'val" |
| 115 | syn match vhdlAttribute "\'image" |
| 116 | syn match vhdlAttribute "\'value" |
| 117 | |
| 118 | syn keyword vhdlBoolean true false |
| 119 | |
| 120 | " for this vector values case is significant |
| 121 | syn case match |
| 122 | " Values for standard VHDL types |
| 123 | syn match vhdlVector "\'[0L1HXWZU\-\?]\'" |
| 124 | " Values for non standard VHDL types qsim_12state for Mentor Graphics Sys1076/QuickHDL |
| 125 | syn keyword vhdlVector S0S S1S SXS S0R S1R SXR S0Z S1Z SXZ S0I S1I SXI |
| 126 | syn case ignore |
| 127 | |
| 128 | syn match vhdlVector "B\"[01_]\+\"" |
| 129 | syn match vhdlVector "O\"[0-7_]\+\"" |
| 130 | syn match vhdlVector "X\"[0-9a-f_]\+\"" |
| 131 | syn match vhdlCharacter "'.'" |
| 132 | syn region vhdlString start=+"+ end=+"+ |
| 133 | |
| 134 | " floating numbers |
| 135 | syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>" |
| 136 | syn match vhdlNumber "-\=\<\d\+\.\d\+\>" |
| 137 | syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\=" |
| 138 | syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" |
| 139 | " integer numbers |
| 140 | syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>" |
| 141 | syn match vhdlNumber "-\=\<\d\+\>" |
| 142 | syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\=" |
| 143 | syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" |
| 144 | " operators |
| 145 | syn keyword vhdlOperator and nand or nor xor xnor |
| 146 | syn keyword vhdlOperator rol ror sla sll sra srl |
| 147 | syn keyword vhdlOperator mod rem abs not |
| 148 | syn match vhdlOperator "[&><=:+\-*\/|]" |
| 149 | syn match vhdlSpecial "[().,;]" |
| 150 | " time |
| 151 | syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" |
| 152 | syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" |
| 153 | |
| 154 | syn match vhdlComment "--.*$" |
| 155 | " syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]" |
| 156 | |
| 157 | " Define the default highlighting. |
| 158 | " For version 5.7 and earlier: only when not done already |
| 159 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 160 | if version >= 508 || !exists("did_vhdl_syntax_inits") |
| 161 | if version < 508 |
| 162 | let did_vhdl_syntax_inits = 1 |
| 163 | command -nargs=+ HiLink hi link <args> |
| 164 | else |
| 165 | command -nargs=+ HiLink hi def link <args> |
| 166 | endif |
| 167 | |
| 168 | HiLink cDefine PreProc |
| 169 | HiLink vhdlSpecial Special |
| 170 | HiLink vhdlStatement Statement |
| 171 | HiLink vhdlCharacter String |
| 172 | HiLink vhdlString String |
| 173 | HiLink vhdlVector String |
| 174 | HiLink vhdlBoolean String |
| 175 | HiLink vhdlComment Comment |
| 176 | HiLink vhdlNumber String |
| 177 | HiLink vhdlTime String |
| 178 | HiLink vhdlType Type |
| 179 | HiLink vhdlOperator Type |
| 180 | HiLink vhdlGlobal Error |
| 181 | HiLink vhdlAttribute Type |
| 182 | |
| 183 | delcommand HiLink |
| 184 | endif |
| 185 | |
| 186 | let b:current_syntax = "vhdl" |
| 187 | |
Bram Moolenaar | b8ff1fb | 2012-02-04 21:59:01 +0100 | [diff] [blame] | 188 | let &cpo = s:cpo_save |
| 189 | unlet s:cpo_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 190 | " vim: ts=8 |