Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: CUPL |
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 | |
| 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 | |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 14 | let s:cpo_save = &cpo |
| 15 | set cpo&vim |
| 16 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | " this language is oblivious to case. |
| 18 | syn case ignore |
| 19 | |
| 20 | " A bunch of keywords |
| 21 | syn keyword cuplHeader name partno date revision rev designer company nextgroup=cuplHeaderContents |
| 22 | syn keyword cuplHeader assembly assy location device nextgroup=cuplHeaderContents |
| 23 | |
| 24 | syn keyword cuplTodo contained TODO XXX FIXME |
| 25 | |
| 26 | " cuplHeaderContents uses default highlighting except for numbers |
| 27 | syn match cuplHeaderContents ".\+;"me=e-1 contains=cuplNumber contained |
| 28 | |
| 29 | " String contstants |
| 30 | syn region cuplString start=+'+ end=+'+ |
| 31 | syn region cuplString start=+"+ end=+"+ |
| 32 | |
| 33 | syn keyword cuplStatement append condition |
| 34 | syn keyword cuplStatement default else |
| 35 | syn keyword cuplStatement field fld format function fuse |
| 36 | syn keyword cuplStatement group if jump loc |
| 37 | syn keyword cuplStatement macro min node out |
| 38 | syn keyword cuplStatement pin pinnode present table |
| 39 | syn keyword cuplStatement sequence sequenced sequencejk sequencers sequencet |
| 40 | |
| 41 | syn keyword cuplFunction log2 log8 log16 log |
| 42 | |
| 43 | " Valid integer number formats (decimal, binary, octal, hex) |
| 44 | syn match cuplNumber "\<[-+]\=[0-9]\+\>" |
| 45 | syn match cuplNumber "'d'[0-9]\+\>" |
| 46 | syn match cuplNumber "'b'[01x]\+\>" |
| 47 | syn match cuplNumber "'o'[0-7x]\+\>" |
| 48 | syn match cuplNumber "'h'[0-9a-fx]\+\>" |
| 49 | |
| 50 | " operators |
| 51 | syn match cuplLogicalOperator "[!#&$]" |
| 52 | syn match cuplArithmeticOperator "[-+*/%]" |
| 53 | syn match cuplArithmeticOperator "\*\*" |
| 54 | syn match cuplAssignmentOperator ":\==" |
| 55 | syn match cuplEqualityOperator ":" |
| 56 | syn match cuplTruthTableOperator "=>" |
| 57 | |
| 58 | " Signal extensions |
| 59 | syn match cuplExtension "\.[as][pr]\>" |
| 60 | syn match cuplExtension "\.oe\>" |
| 61 | syn match cuplExtension "\.oemux\>" |
| 62 | syn match cuplExtension "\.[dlsrjk]\>" |
| 63 | syn match cuplExtension "\.ck\>" |
| 64 | syn match cuplExtension "\.dq\>" |
| 65 | syn match cuplExtension "\.ckmux\>" |
| 66 | syn match cuplExtension "\.tec\>" |
| 67 | syn match cuplExtension "\.cnt\>" |
| 68 | |
| 69 | syn match cuplRangeOperator "\.\." contained |
| 70 | |
| 71 | " match ranges like memadr:[0000..1FFF] |
| 72 | " and highlight both the numbers and the .. operator |
| 73 | syn match cuplNumberRange "\<\x\+\.\.\x\+\>" contains=cuplRangeOperator |
| 74 | |
| 75 | " match vectors of type [name3..0] (decimal numbers only) |
| 76 | " but assign them no special highlighting except for the .. operator |
| 77 | syn match cuplBitVector "\<\a\+\d\+\.\.\d\+\>" contains=cuplRangeOperator |
| 78 | |
| 79 | " other special characters |
| 80 | syn match cuplSpecialChar "[\[\](){},;]" |
| 81 | |
| 82 | " directives |
| 83 | " (define these after cuplOperator so $xxx overrides $) |
| 84 | syn match cuplDirective "\$msg" |
| 85 | syn match cuplDirective "\$macro" |
| 86 | syn match cuplDirective "\$mend" |
| 87 | syn match cuplDirective "\$repeat" |
| 88 | syn match cuplDirective "\$repend" |
| 89 | syn match cuplDirective "\$define" |
| 90 | syn match cuplDirective "\$include" |
| 91 | |
| 92 | " multi-line comments |
| 93 | syn region cuplComment start=+/\*+ end=+\*/+ contains=cuplNumber,cuplTodo |
| 94 | |
| 95 | syn sync minlines=1 |
| 96 | |
| 97 | " Define the default highlighting. |
| 98 | " For version 5.7 and earlier: only when not done already |
| 99 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 100 | if version >= 508 || !exists("did_cupl_syn_inits") |
| 101 | if version < 508 |
| 102 | let did_cupl_syn_inits = 1 |
| 103 | command -nargs=+ HiLink hi link <args> |
| 104 | else |
| 105 | command -nargs=+ HiLink hi def link <args> |
| 106 | endif |
| 107 | |
| 108 | " The default highlighting. |
| 109 | HiLink cuplHeader cuplStatement |
| 110 | HiLink cuplLogicalOperator cuplOperator |
| 111 | HiLink cuplRangeOperator cuplOperator |
| 112 | HiLink cuplArithmeticOperator cuplOperator |
| 113 | HiLink cuplAssignmentOperator cuplOperator |
| 114 | HiLink cuplEqualityOperator cuplOperator |
| 115 | HiLink cuplTruthTableOperator cuplOperator |
| 116 | HiLink cuplOperator cuplStatement |
| 117 | HiLink cuplFunction cuplStatement |
| 118 | HiLink cuplStatement Statement |
| 119 | HiLink cuplNumberRange cuplNumber |
| 120 | HiLink cuplNumber cuplString |
| 121 | HiLink cuplString String |
| 122 | HiLink cuplComment Comment |
| 123 | HiLink cuplExtension cuplSpecial |
| 124 | HiLink cuplSpecialChar cuplSpecial |
| 125 | HiLink cuplSpecial Special |
| 126 | HiLink cuplDirective PreProc |
| 127 | HiLink cuplTodo Todo |
| 128 | |
| 129 | delcommand HiLink |
| 130 | endif |
| 131 | |
| 132 | let b:current_syntax = "cupl" |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 133 | |
| 134 | let &cpo = s:cpo_save |
| 135 | unlet s:cpo_save |
| 136 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 137 | " vim:ts=8 |