haskell.syntax 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. # Author : Sergei Trofimovich <slyfox@inbox.ru>
  2. # Language : haskell
  3. #
  4. # 'Syntax rules for the C and the C++ programming languages' is taken as base
  5. # (haskell compilers support CPP macros)
  6. #
  7. # haskell keywords and reserved symbols are grabbed from ghc-6.10.1/compiler/parser/Lexer.hs
  8. context default
  9. # haskell keywords
  10. # reserved keywords:
  11. # unused symbols
  12. keyword whole _\[0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\] brightmagenta
  13. keyword whole as yellow
  14. keyword whole case yellow
  15. keyword whole class yellow
  16. keyword whole data yellow
  17. keyword whole default yellow
  18. keyword whole deriving yellow
  19. keyword whole do yellow
  20. keyword whole else yellow
  21. keyword whole hiding yellow
  22. keyword whole if yellow
  23. keyword whole import yellow
  24. keyword whole in yellow
  25. keyword whole infix yellow
  26. keyword whole infixl yellow
  27. keyword whole infixr yellow
  28. keyword whole instance yellow
  29. keyword whole let yellow
  30. keyword whole module yellow
  31. keyword whole newtype yellow
  32. keyword whole of yellow
  33. keyword whole qualified yellow
  34. keyword whole then yellow
  35. keyword whole type yellow
  36. keyword whole where yellow
  37. # extension keywords
  38. keyword whole forall yellow
  39. keyword whole mdo yellow
  40. keyword whole family yellow
  41. keyword whole group yellow
  42. keyword whole by yellow
  43. keyword whole using yellow
  44. # ffi
  45. keyword whole foreign yellow
  46. keyword whole export yellow
  47. keyword whole label yellow
  48. keyword whole dynamic yellow
  49. keyword whole safe yellow
  50. keyword whole threadsafe yellow
  51. keyword whole unsafe yellow
  52. keyword whole stdcall yellow
  53. keyword whole ccall yellow
  54. keyword whole dotnet yellow
  55. keyword whole rec yellow
  56. keyword whole proc yellow
  57. # other
  58. keyword . white
  59. # keyword whole .. white
  60. # unboxed (started from upcase)
  61. keyword whole \{ABCDEFGHIJKLMNOPQRSTUVWXYZ\}\[0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\]# white
  62. # types/modules
  63. keyword whole \{ABCDEFGHIJKLMNOPQRSTUVWXYZ\}\[0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\] white
  64. # C keywords (TODO: remove unused in haskell source)
  65. keyword whole auto yellow
  66. keyword whole break yellow
  67. keyword whole case yellow
  68. keyword whole char yellow
  69. keyword whole const yellow
  70. keyword whole continue yellow
  71. keyword whole do yellow
  72. keyword whole double yellow
  73. keyword whole else yellow
  74. keyword whole enum yellow
  75. keyword whole extern yellow
  76. keyword whole float yellow
  77. keyword whole for yellow
  78. keyword whole goto yellow
  79. keyword whole if yellow
  80. keyword whole int yellow
  81. keyword whole long yellow
  82. keyword whole register yellow
  83. keyword whole return yellow
  84. keyword whole short yellow
  85. keyword whole signed yellow
  86. keyword whole sizeof yellow
  87. keyword whole static yellow
  88. keyword whole struct yellow
  89. keyword whole switch yellow
  90. keyword whole typedef yellow
  91. keyword whole union yellow
  92. keyword whole unsigned yellow
  93. keyword whole void yellow
  94. keyword whole volatile yellow
  95. keyword whole while yellow
  96. keyword whole asm yellow
  97. keyword whole inline yellow
  98. keyword whole wchar_t yellow
  99. keyword whole ... yellow
  100. keyword whole linestart \{\s\t\}\[\s\t\]#*\n brightmagenta
  101. keyword whole \[\s\t\]default yellow
  102. keyword whole linestart \[\s\t\]\{ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\}\[0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\]: cyan
  103. #digits
  104. keyword whole 0\{xX\}\{0123456789abcdefABCDEF\}\[0123456789abcdefABCDEF\] brightgreen
  105. keyword whole \{0123456789\}\[0123456789\] brightgreen
  106. keyword whole \[0123456789\]\.\{0123456789\}\[0123456789\] brightgreen
  107. keyword whole \{0123456789\}\[0123456789\]\.\[0123456789\] brightgreen
  108. keyword whole \{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] brightgreen
  109. keyword whole \{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\] brightgreen
  110. keyword whole \{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] brightgreen
  111. keyword whole \{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\] brightgreen
  112. #comments
  113. keyword {- brown
  114. keyword -} brown
  115. keyword -- brown
  116. keyword \*/ brown
  117. keyword /\* brown
  118. keyword // brown
  119. keyword '\\\{"abtnvfr\}' brightgreen
  120. #haskell standalone char escapes
  121. keyword '\\NUL' brightgreen
  122. keyword '\\SOH' brightgreen
  123. keyword '\\STX' brightgreen
  124. keyword '\\ETX' brightgreen
  125. keyword '\\EOT' brightgreen
  126. keyword '\\ENQ' brightgreen
  127. keyword '\\ACK' brightgreen
  128. keyword '\\BEL' brightgreen
  129. keyword '\\BS' brightgreen
  130. keyword '\\HT' brightgreen
  131. keyword '\\LF' brightgreen
  132. keyword '\\VT' brightgreen
  133. keyword '\\FF' brightgreen
  134. keyword '\\CR' brightgreen
  135. keyword '\\SO' brightgreen
  136. keyword '\\SI' brightgreen
  137. keyword '\\DLE' brightgreen
  138. keyword '\\DC1' brightgreen
  139. keyword '\\DC2' brightgreen
  140. keyword '\\DC3' brightgreen
  141. keyword '\\DC4' brightgreen
  142. keyword '\\NAK' brightgreen
  143. keyword '\\SYN' brightgreen
  144. keyword '\\ETB' brightgreen
  145. keyword '\\CAN' brightgreen
  146. keyword '\\EM' brightgreen
  147. keyword '\\SUB' brightgreen
  148. keyword '\\ESC' brightgreen
  149. keyword '\\FS' brightgreen
  150. keyword '\\GS' brightgreen
  151. keyword '\\RS' brightgreen
  152. keyword '\\US' brightgreen
  153. keyword '\\SP' brightgreen
  154. keyword '\\DEL' brightgreen
  155. keyword '\\\{0123\}\{01234567\}\{01234567\}' brightgreen
  156. keyword '\\'' brightgreen
  157. keyword '\\\\' brightgreen
  158. keyword '\\0' brightgreen
  159. keyword '\{\s!"#$%&()\*\+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~嵗╯丰戍貝物洎悖停眾斯須號獄播噶擱藏霰匸�帊昅恘倳眑婭笫崷窙嗲睧颬睼麧緗鴇膹擨闀貘覷鏷禴矙𡜍𦶠�\}' brightgreen
  160. # some punctuation characters
  161. keyword whole $ yellow
  162. keyword whole ! white
  163. keyword whole && white
  164. keyword whole \* yellow
  165. keyword whole \+ yellow
  166. keyword whole / yellow
  167. keyword whole < yellow
  168. keyword whole > yellow
  169. keyword whole ^ white
  170. keyword whole || white
  171. keyword whole | white
  172. keyword ~ white
  173. keyword , brightcyan
  174. keyword - yellow
  175. keyword : brightcyan
  176. keyword ; yellow
  177. keyword = yellow
  178. keyword { white
  179. keyword } white
  180. keyword [ brightcyan
  181. keyword ] brightcyan
  182. keyword ( brightcyan
  183. keyword ) brightcyan
  184. # comments
  185. context exclusive /\* \*/ brown
  186. spellcheck
  187. context exclusive {-# #-} green
  188. spellcheck
  189. context exclusive {- -} brown
  190. spellcheck
  191. context exclusive // \n brown
  192. spellcheck
  193. context exclusive \-\- \n brown
  194. spellcheck
  195. # C macros
  196. context linestart # \n brightred
  197. keyword \\\n yellow
  198. keyword /\**\*/ brown
  199. keyword //*\n brown
  200. keyword "+" red
  201. keyword <+> red
  202. context " " green
  203. spellcheck
  204. #haskell escapes in ""s
  205. keyword \\NUL brightgreen
  206. keyword \\SOH brightgreen
  207. keyword \\STX brightgreen
  208. keyword \\ETX brightgreen
  209. keyword \\EOT brightgreen
  210. keyword \\ENQ brightgreen
  211. keyword \\ACK brightgreen
  212. keyword \\BEL brightgreen
  213. keyword \\BS brightgreen
  214. keyword \\HT brightgreen
  215. keyword \\LF brightgreen
  216. keyword \\VT brightgreen
  217. keyword \\FF brightgreen
  218. keyword \\CR brightgreen
  219. keyword \\SO brightgreen
  220. keyword \\SI brightgreen
  221. keyword \\DLE brightgreen
  222. keyword \\DC1 brightgreen
  223. keyword \\DC2 brightgreen
  224. keyword \\DC3 brightgreen
  225. keyword \\DC4 brightgreen
  226. keyword \\NAK brightgreen
  227. keyword \\SYN brightgreen
  228. keyword \\ETB brightgreen
  229. keyword \\CAN brightgreen
  230. keyword \\EM brightgreen
  231. keyword \\SUB brightgreen
  232. keyword \\ESC brightgreen
  233. keyword \\FS brightgreen
  234. keyword \\GS brightgreen
  235. keyword \\RS brightgreen
  236. keyword \\US brightgreen
  237. keyword \\SP brightgreen
  238. keyword \\DEL brightgreen
  239. keyword \\" brightgreen
  240. keyword %% brightgreen
  241. keyword %\[#0\s-\+,\]\[0123456789\*\]\[.\]\[0123456789\*\]\[L\]\{eEfgGoxX\} brightgreen
  242. keyword %\[0\s-\+,\]\[0123456789\*\]\[.\]\[0123456789\*\]\[hl\]\{diuxX\} brightgreen
  243. keyword %\[hl\]n brightgreen
  244. keyword %\[-\]\[0123456789\*\]\[.\]\[0123456789\*\]s brightgreen
  245. keyword %[*] brightgreen
  246. keyword %c brightgreen
  247. keyword %p brightgreen
  248. keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
  249. keyword \\\\ brightgreen
  250. keyword \\' brightgreen
  251. keyword \\\{abtnvfr\} brightgreen
  252. # infix binop
  253. context exclusive ` ` white