Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: ABEL |
| 3 | " Maintainer: John Cook <john.cook@kla-tencor.com> |
| 4 | " Last Change: 2001 Sep 2 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | " this language is oblivious to case |
| 15 | syn case ignore |
| 16 | |
| 17 | " A bunch of keywords |
| 18 | syn keyword abelHeader module title device options |
| 19 | syn keyword abelSection declarations equations test_vectors end |
| 20 | syn keyword abelDeclaration state truth_table state_diagram property |
| 21 | syn keyword abelType pin node attribute constant macro library |
| 22 | |
| 23 | syn keyword abelTypeId com reg neg pos buffer dc reg_d reg_t contained |
| 24 | syn keyword abelTypeId reg_sr reg_jk reg_g retain xor invert contained |
| 25 | |
| 26 | syn keyword abelStatement when then else if with endwith case endcase |
| 27 | syn keyword abelStatement fuses expr trace |
| 28 | |
| 29 | " option to omit obsolete statements |
| 30 | if exists("abel_obsolete_ok") |
| 31 | syn keyword abelStatement enable flag in |
| 32 | else |
| 33 | syn keyword abelError enable flag in |
| 34 | endif |
| 35 | |
| 36 | " directives |
| 37 | syn match abelDirective "@alternate" |
| 38 | syn match abelDirective "@standard" |
| 39 | syn match abelDirective "@const" |
| 40 | syn match abelDirective "@dcset" |
| 41 | syn match abelDirective "@include" |
| 42 | syn match abelDirective "@page" |
| 43 | syn match abelDirective "@radix" |
| 44 | syn match abelDirective "@repeat" |
| 45 | syn match abelDirective "@irp" |
| 46 | syn match abelDirective "@expr" |
| 47 | syn match abelDirective "@if" |
| 48 | syn match abelDirective "@ifb" |
| 49 | syn match abelDirective "@ifnb" |
| 50 | syn match abelDirective "@ifdef" |
| 51 | syn match abelDirective "@ifndef" |
| 52 | syn match abelDirective "@ifiden" |
| 53 | syn match abelDirective "@ifniden" |
| 54 | |
| 55 | syn keyword abelTodo contained TODO XXX FIXME |
| 56 | |
| 57 | " wrap up type identifiers to differentiate them from normal strings |
| 58 | syn region abelSpecifier start='istype' end=';' contains=abelTypeIdChar,abelTypeId,abelTypeIdEnd keepend |
| 59 | syn match abelTypeIdChar "[,']" contained |
| 60 | syn match abelTypeIdEnd ";" contained |
| 61 | |
| 62 | " string contstants and special characters within them |
| 63 | syn match abelSpecial contained "\\['\\]" |
| 64 | syn region abelString start=+'+ skip=+\\"+ end=+'+ contains=abelSpecial |
| 65 | |
| 66 | " valid integer number formats (decimal, binary, octal, hex) |
| 67 | syn match abelNumber "\<[-+]\=[0-9]\+\>" |
| 68 | syn match abelNumber "\^d[0-9]\+\>" |
| 69 | syn match abelNumber "\^b[01]\+\>" |
| 70 | syn match abelNumber "\^o[0-7]\+\>" |
| 71 | syn match abelNumber "\^h[0-9a-f]\+\>" |
| 72 | |
| 73 | " special characters |
| 74 | " (define these after abelOperator so ?= overrides ?) |
| 75 | syn match abelSpecialChar "[\[\](){},;:?]" |
| 76 | |
| 77 | " operators |
| 78 | syn match abelLogicalOperator "[!#&$]" |
| 79 | syn match abelRangeOperator "\.\." |
| 80 | syn match abelAlternateOperator "[/*+]" |
| 81 | syn match abelAlternateOperator ":[+*]:" |
| 82 | syn match abelArithmeticOperator "[-%]" |
| 83 | syn match abelArithmeticOperator "<<" |
| 84 | syn match abelArithmeticOperator ">>" |
| 85 | syn match abelRelationalOperator "[<>!=]=" |
| 86 | syn match abelRelationalOperator "[<>]" |
| 87 | syn match abelAssignmentOperator "[:?]\==" |
| 88 | syn match abelAssignmentOperator "?:=" |
| 89 | syn match abelTruthTableOperator "->" |
| 90 | |
| 91 | " signal extensions |
| 92 | syn match abelExtension "\.aclr\>" |
| 93 | syn match abelExtension "\.aset\>" |
| 94 | syn match abelExtension "\.clk\>" |
| 95 | syn match abelExtension "\.clr\>" |
| 96 | syn match abelExtension "\.com\>" |
| 97 | syn match abelExtension "\.fb\>" |
| 98 | syn match abelExtension "\.[co]e\>" |
| 99 | syn match abelExtension "\.l[eh]\>" |
| 100 | syn match abelExtension "\.fc\>" |
| 101 | syn match abelExtension "\.pin\>" |
| 102 | syn match abelExtension "\.set\>" |
| 103 | syn match abelExtension "\.[djksrtq]\>" |
| 104 | syn match abelExtension "\.pr\>" |
| 105 | syn match abelExtension "\.re\>" |
| 106 | syn match abelExtension "\.a[pr]\>" |
| 107 | syn match abelExtension "\.s[pr]\>" |
| 108 | |
| 109 | " special constants |
| 110 | syn match abelConstant "\.[ckudfpxz]\." |
| 111 | syn match abelConstant "\.sv[2-9]\." |
| 112 | |
| 113 | " one-line comments |
| 114 | syn region abelComment start=+"+ end=+"\|$+ contains=abelNumber,abelTodo |
| 115 | " option to prevent C++ style comments |
| 116 | if !exists("abel_cpp_comments_illegal") |
| 117 | syn region abelComment start=+//+ end=+$+ contains=abelNumber,abelTodo |
| 118 | endif |
| 119 | |
| 120 | syn sync minlines=1 |
| 121 | |
| 122 | " Define the default highlighting. |
| 123 | " For version 5.7 and earlier: only when not done already |
| 124 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 125 | if version >= 508 || !exists("did_abel_syn_inits") |
| 126 | if version < 508 |
| 127 | let did_abel_syn_inits = 1 |
| 128 | command -nargs=+ HiLink hi link <args> |
| 129 | else |
| 130 | command -nargs=+ HiLink hi def link <args> |
| 131 | endif |
| 132 | |
| 133 | " The default highlighting. |
| 134 | HiLink abelHeader abelStatement |
| 135 | HiLink abelSection abelStatement |
| 136 | HiLink abelDeclaration abelStatement |
| 137 | HiLink abelLogicalOperator abelOperator |
| 138 | HiLink abelRangeOperator abelOperator |
| 139 | HiLink abelAlternateOperator abelOperator |
| 140 | HiLink abelArithmeticOperator abelOperator |
| 141 | HiLink abelRelationalOperator abelOperator |
| 142 | HiLink abelAssignmentOperator abelOperator |
| 143 | HiLink abelTruthTableOperator abelOperator |
| 144 | HiLink abelSpecifier abelStatement |
| 145 | HiLink abelOperator abelStatement |
| 146 | HiLink abelStatement Statement |
| 147 | HiLink abelIdentifier Identifier |
| 148 | HiLink abelTypeId abelType |
| 149 | HiLink abelTypeIdChar abelType |
| 150 | HiLink abelType Type |
| 151 | HiLink abelNumber abelString |
| 152 | HiLink abelString String |
| 153 | HiLink abelConstant Constant |
| 154 | HiLink abelComment Comment |
| 155 | HiLink abelExtension abelSpecial |
| 156 | HiLink abelSpecialChar abelSpecial |
| 157 | HiLink abelTypeIdEnd abelSpecial |
| 158 | HiLink abelSpecial Special |
| 159 | HiLink abelDirective PreProc |
| 160 | HiLink abelTodo Todo |
| 161 | HiLink abelError Error |
| 162 | |
| 163 | delcommand HiLink |
| 164 | endif |
| 165 | |
| 166 | let b:current_syntax = "abel" |
| 167 | " vim:ts=8 |