haste.vim 4.9 KB

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