Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 2 | " Language: HASTE - a language for VLSI IC programming |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 3 | " Maintainer: M. Tranchero - maurizio.tranchero?gmail.com |
| 4 | " Credits: some parts have been taken from vhdl, verilog, and C syntax |
| 5 | " files |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 6 | " Version: 0.9 |
| 7 | " Last Change: 0.9 improvement of haste numbers detection |
| 8 | " Change: 0.8 error matching for wrong hierarchical connections |
| 9 | " Change: 0.7 added more rules to highlight pre-processor directives |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 10 | |
| 11 | " HASTE |
| 12 | if exists("b:current_syntax") |
| 13 | finish |
| 14 | endif |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 15 | " quit when a syntax file was already loaded |
| 16 | if exists("b:current_syntax") |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 17 | finish |
| 18 | endif |
| 19 | |
| 20 | " case is significant |
| 21 | syn case match |
| 22 | |
| 23 | " HASTE keywords |
| 24 | syn keyword hasteStatement act alias arb array begin bitvec |
| 25 | syn keyword hasteStatement bitwidth boolvec broad case |
| 26 | syn keyword hasteStatement cast chan const dataprobe do edge |
| 27 | syn keyword hasteStatement else end export false ff fi file |
| 28 | syn keyword hasteStatement fit for forever func if import |
| 29 | syn keyword hasteStatement inprobe is les main narb narrow |
| 30 | syn keyword hasteStatement negedge od of or outprobe pas |
| 31 | syn keyword hasteStatement posedge probe proc ram ramreg |
| 32 | syn keyword hasteStatement repeat rom romreg sample sel si |
| 33 | syn keyword hasteStatement sign sizeof skip stop then true |
| 34 | syn keyword hasteStatement type until var wait wire |
| 35 | syn keyword hasteFutureExt Z ffe partial |
| 36 | syn keyword hasteVerilog buf reg while |
| 37 | |
| 38 | " Special match for "if", "or", and "else" since "else if" |
| 39 | " and other "else+if" combination shouldn't be highlighted. |
| 40 | " The right keyword is "or" |
| 41 | syn match hasteStatement "\<\(if\|then\|else\|fi\)\>" |
| 42 | syn match hasteNone "\<else\s\+if\>$" |
| 43 | syn match hasteNone "\<else\s\+if\>\s" |
| 44 | syn match hasteNone "\<elseif\>\s" |
| 45 | syn match hasteNone "\<elsif\>\s" |
| 46 | syn match hasteStatement "\<\(case\|is\|si\)\>" |
| 47 | syn match hasteStatement "\<\(repeat\|until\)\>" |
| 48 | syn match hasteStatement "\<\(forever\|do\|od\)\>" |
| 49 | syn match hasteStatement "\<\(for\|do\|od\)\>" |
| 50 | syn match hasteStatement "\<\(do\|or\|od\)\>" |
| 51 | syn match hasteStatement "\<\(sel\|les\)\>" |
| 52 | syn match hasteError "\<\d\+[_a-zA-Z]\+\>" |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 53 | syn match hasteError "\(\([[:alnum:]]\+\s*(\s\+\|)\s*,\)\)\s*\([[:alnum:]]\+\s*(\)" |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 54 | |
| 55 | " Predifined Haste types |
| 56 | syn keyword hasteType bool |
| 57 | |
| 58 | " Values for standard Haste types |
| 59 | " syn match hasteVector "\'[0L1HXWZU\-\?]\'" |
| 60 | |
| 61 | syn match hasteVector "0b\"[01_]\+\"" |
| 62 | syn match hasteVector "0x\"[0-9a-f_]\+\"" |
| 63 | syn match hasteCharacter "'.'" |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 64 | " syn region hasteString start=+"+ end=+"+ |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 65 | syn match hasteIncluded display contained "<[^>]*>" |
| 66 | syn match hasteIncluded display contained "<[^"]*>" |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 67 | syn region hasteInclude start="^\s*#include\>\s*" end="$" contains=hasteIncluded,hasteString |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 68 | |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 69 | " integer numbers |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 70 | syn match hasteNumber "\d\+\^[[:alnum:]]*[-+]\{0,1\}[[:alnum:]]*" |
| 71 | syn match hasteNumber "-\=\<\d\+\(\^[+\-]\=\d\+\)\>" |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 72 | syn match hasteNumber "-\=\<\d\+\>" |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 73 | " syn match hasteNumber "0*2#[01_]\+#\(\^[+\-]\=\d\+\)\=" |
| 74 | " syn match hasteNumber "0*16#[0-9a-f_]\+#\(\^[+\-]\=\d\+\)\=" |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 75 | " operators |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 76 | syn keyword hasteSeparators & , . \| |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 77 | syn keyword hasteExecution \|\| ; @ |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 78 | syn keyword hasteOperator := ? ! : |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 79 | syn keyword hasteTypeConstr "[" << >> .. "]" ~ |
| 80 | syn keyword hasteExprOp < <= >= > = # <> + - * == ## |
| 81 | syn keyword hasteMisc ( ) 0x 0b |
| 82 | " |
| 83 | syn match hasteSeparators "[&:\|,.]" |
| 84 | syn match hasteOperator ":=" |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 85 | syn match hasteOperator ":" |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 86 | syn match hasteOperator "?" |
| 87 | syn match hasteOperator "!" |
| 88 | syn match hasteExecution "||" |
| 89 | syn match hasteExecution ";" |
| 90 | syn match hasteExecution "@" |
| 91 | syn match hasteType "\[\[" |
| 92 | syn match hasteType "\]\]" |
| 93 | syn match hasteType "<<" |
| 94 | syn match hasteType ">>" |
| 95 | syn match hasteExprOp "<" |
| 96 | syn match hasteExprOp "<=" |
| 97 | syn match hasteExprOp ">=" |
| 98 | syn match hasteExprOp ">" |
| 99 | syn match hasteExprOp "<>" |
| 100 | syn match hasteExprOp "=" |
| 101 | syn match hasteExprOp "==" |
| 102 | syn match hasteExprOp "##" |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 103 | " syn match hasteExprOp "#" |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 104 | syn match hasteExprOp "*" |
| 105 | syn match hasteExprOp "+" |
| 106 | |
| 107 | syn region hasteComment start="/\*" end="\*/" contains=@Spell |
| 108 | syn region hasteComment start="{" end="}" contains=@Spell |
| 109 | syn match hasteComment "//.*" contains=@Spell |
| 110 | |
| 111 | " Define the default highlighting. |
| 112 | " Only when an item doesn't have highlighting yet |
| 113 | hi def link hasteSpecial Special |
| 114 | hi def link hasteStatement Statement |
| 115 | hi def link hasteCharacter String |
| 116 | hi def link hasteString String |
| 117 | hi def link hasteVector String |
| 118 | hi def link hasteBoolean String |
| 119 | hi def link hasteComment Comment |
| 120 | hi def link hasteNumber String |
| 121 | hi def link hasteTime String |
| 122 | hi def link hasteType Type |
| 123 | hi def link hasteGlobal Error |
| 124 | hi def link hasteError Error |
| 125 | hi def link hasteAttribute Type |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 126 | " |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 127 | hi def link hasteSeparators Special |
| 128 | hi def link hasteExecution Special |
| 129 | hi def link hasteTypeConstr Special |
| 130 | hi def link hasteOperator Type |
| 131 | hi def link hasteExprOp Type |
| 132 | hi def link hasteMisc String |
| 133 | hi def link hasteFutureExt Error |
| 134 | hi def link hasteVerilog Error |
| 135 | hi def link hasteDefine Macro |
| 136 | hi def link hasteInclude Include |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 137 | " hi def link hastePreProc Preproc |
| 138 | " hi def link hastePreProcVar Special |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 139 | |
| 140 | let b:current_syntax = "haste" |
| 141 | |
| 142 | " vim: ts=8 |