1" Vim syntax file 2" Language: CUPL 3" Maintainer: John Cook <[email protected]> 4" Last Change: 2011 Dec 27 5 6" For version 5.x: Clear all syntax items 7" For version 6.x: Quit when a syntax file was already loaded 8if version < 600 9 syntax clear 10elseif exists("b:current_syntax") 11 finish 12endif 13 14let s:cpo_save = &cpo 15set cpo&vim 16 17" this language is oblivious to case. 18syn case ignore 19 20" A bunch of keywords 21syn keyword cuplHeader name partno date revision rev designer company nextgroup=cuplHeaderContents 22syn keyword cuplHeader assembly assy location device nextgroup=cuplHeaderContents 23 24syn keyword cuplTodo contained TODO XXX FIXME 25 26" cuplHeaderContents uses default highlighting except for numbers 27syn match cuplHeaderContents ".\+;"me=e-1 contains=cuplNumber contained 28 29" String contstants 30syn region cuplString start=+'+ end=+'+ 31syn region cuplString start=+"+ end=+"+ 32 33syn keyword cuplStatement append condition 34syn keyword cuplStatement default else 35syn keyword cuplStatement field fld format function fuse 36syn keyword cuplStatement group if jump loc 37syn keyword cuplStatement macro min node out 38syn keyword cuplStatement pin pinnode present table 39syn keyword cuplStatement sequence sequenced sequencejk sequencers sequencet 40 41syn keyword cuplFunction log2 log8 log16 log 42 43" Valid integer number formats (decimal, binary, octal, hex) 44syn match cuplNumber "\<[-+]\=[0-9]\+\>" 45syn match cuplNumber "'d'[0-9]\+\>" 46syn match cuplNumber "'b'[01x]\+\>" 47syn match cuplNumber "'o'[0-7x]\+\>" 48syn match cuplNumber "'h'[0-9a-fx]\+\>" 49 50" operators 51syn match cuplLogicalOperator "[!#&$]" 52syn match cuplArithmeticOperator "[-+*/%]" 53syn match cuplArithmeticOperator "\*\*" 54syn match cuplAssignmentOperator ":\==" 55syn match cuplEqualityOperator ":" 56syn match cuplTruthTableOperator "=>" 57 58" Signal extensions 59syn match cuplExtension "\.[as][pr]\>" 60syn match cuplExtension "\.oe\>" 61syn match cuplExtension "\.oemux\>" 62syn match cuplExtension "\.[dlsrjk]\>" 63syn match cuplExtension "\.ck\>" 64syn match cuplExtension "\.dq\>" 65syn match cuplExtension "\.ckmux\>" 66syn match cuplExtension "\.tec\>" 67syn match cuplExtension "\.cnt\>" 68 69syn match cuplRangeOperator "\.\." contained 70 71" match ranges like memadr:[0000..1FFF] 72" and highlight both the numbers and the .. operator 73syn 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 77syn match cuplBitVector "\<\a\+\d\+\.\.\d\+\>" contains=cuplRangeOperator 78 79" other special characters 80syn match cuplSpecialChar "[\[\](){},;]" 81 82" directives 83" (define these after cuplOperator so $xxx overrides $) 84syn match cuplDirective "\$msg" 85syn match cuplDirective "\$macro" 86syn match cuplDirective "\$mend" 87syn match cuplDirective "\$repeat" 88syn match cuplDirective "\$repend" 89syn match cuplDirective "\$define" 90syn match cuplDirective "\$include" 91 92" multi-line comments 93syn region cuplComment start=+/\*+ end=+\*/+ contains=cuplNumber,cuplTodo 94 95syn 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 100if 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 130endif 131 132let b:current_syntax = "cupl" 133 134let &cpo = s:cpo_save 135unlet s:cpo_save 136 137" vim:ts=8 138