-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaskell.lang
36 lines (27 loc) · 1.39 KB
/
haskell.lang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Quick and dirty Haskell highlight rules for GNU Source-highlight and SHJS
# Sergey Astanin
# Feel free to improve according to http://www.haskell.org/onlinereport/lexemes.html
# Source-highlight docs: http://www.gnu.org/software/src-highlite/source-highlight.html#Language-Definitions
# SHJS docs: http://shjs.sourceforge.net/doc/documentation.html
# as number.lang but also with Haskell octals
number =
'\<[+-]?((0x[[:xdigit:]]+)|(0[oO][0-7]+)|(([[:digit:]]*\.)?
[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(?:8|16|32|64))|L)?\>'
# strings and chars (including non-control escapes)
string delim "\"" "\"" escape "\\"
string = '\'([^\\\']{1}|\\[\\\'0abfnrtv"&]|\\[[:digit:]]+|\\[oO][0-7]+|\\[xX][[:xdigit:]]+)\''
# show some syntax errors with "regex" style
regex = '\'[^\\\']{2,}\''
keyword = '\<(case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)\>'
comment delim "{-" "-}" multiline nested
# -- An end-of-line comment
# but -->, <--, |-- and --| are not comments in Haskell!
symbol = '([!#$$%*+\./<=>\?@\\\^\|\-~:]+)--'
comment start '(--)(?![!#$$%*+\./<=>\?@\\\^\|\-~:]+)'
# dont highlight types in qualified names, borrowed from caml.lang
type = '\<(?:[A-Z][\w\']*)\>(?![\.])'
symbol =
"!","#","$","%","&","*","+",".","/","<","=",">","?","@","\\","^","\|","-","~",
"(",")",",",";","[","]","`","{","}",
":"
cbracket = "{|}"