Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: ABEL |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 3 | " Maintainer: John Cook <johncook3@gmail.com> |
| 4 | " Last Change: 2011 Dec 27 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 6 | " quit when a syntax file was already loaded |
| 7 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | finish |
| 9 | endif |
| 10 | |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 11 | let s:cpo_save = &cpo |
| 12 | set cpo&vim |
| 13 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 6c391a7 | 2021-09-09 21:55:11 +0200 | [diff] [blame] | 62 | " string constants and special characters within them |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 123 | " Only when an item doesn't have highlighting yet |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 124 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 125 | " The default highlighting. |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 126 | hi def link abelHeader abelStatement |
| 127 | hi def link abelSection abelStatement |
| 128 | hi def link abelDeclaration abelStatement |
| 129 | hi def link abelLogicalOperator abelOperator |
| 130 | hi def link abelRangeOperator abelOperator |
| 131 | hi def link abelAlternateOperator abelOperator |
| 132 | hi def link abelArithmeticOperator abelOperator |
| 133 | hi def link abelRelationalOperator abelOperator |
| 134 | hi def link abelAssignmentOperator abelOperator |
| 135 | hi def link abelTruthTableOperator abelOperator |
| 136 | hi def link abelSpecifier abelStatement |
| 137 | hi def link abelOperator abelStatement |
| 138 | hi def link abelStatement Statement |
| 139 | hi def link abelIdentifier Identifier |
| 140 | hi def link abelTypeId abelType |
| 141 | hi def link abelTypeIdChar abelType |
| 142 | hi def link abelType Type |
| 143 | hi def link abelNumber abelString |
| 144 | hi def link abelString String |
| 145 | hi def link abelConstant Constant |
| 146 | hi def link abelComment Comment |
| 147 | hi def link abelExtension abelSpecial |
| 148 | hi def link abelSpecialChar abelSpecial |
| 149 | hi def link abelTypeIdEnd abelSpecial |
| 150 | hi def link abelSpecial Special |
| 151 | hi def link abelDirective PreProc |
| 152 | hi def link abelTodo Todo |
| 153 | hi def link abelError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 154 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 155 | |
| 156 | let b:current_syntax = "abel" |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 157 | |
| 158 | let &cpo = s:cpo_save |
| 159 | unlet s:cpo_save |
| 160 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 161 | " vim:ts=8 |