Debian Codegraph @

runtime/syntax/haskell.yaml

raw
1 filetype: haskell
2
3 detect:
4 filename: "\\.hs$"
5
6 rules:
7 - symbol.operator: "[!#$%&:*+/<=>?@.\\\\^\\|~\\p{Sm}\\-]+"
8
9 # Identifiers (with or without a module name)
10 - type: "\\b([A-Z][A-Za-z0-9_]*\\.)*[A-Z]+[A-Za-z0-9_']*\\b"
11 - default: "\\b([A-Z][A-Za-z0-9_]*\\.)*[a-z][A-Za-z0-9_']*\\b"
12
13 - statement: ";"
14 - symbol.bracket: "[\\(\\)\\[\\]\\{\\}]"
15 - special: "`[A-Za-z0-9']+`"
16
17 # Keywords
18 - statement: "\\b(case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix|infixl|infixr|instance|let|in|mdo|module|newtype|qualified|type|where)\\b"
19
20 # Data constructors
21 - constant.bool: "\\b(True|False)\\b"
22 - constant: "\\b(Nothing|Just|Left|Right|LT|EQ|GT)\\b"
23
24 - constant: "\\(\\)" # Unit
25 - constant.number: "\\b(0[xX][0-9A-Fa-f]+|0[oO][0-7]+|0[bB][01]+|[-]?[0-9]+([.][0-9]+)?([eE][+-]?[0-9]+)?)\\b"
26
27 # Data classes
28 - identifier.class: "\\b(Additive|Applicative|Bounded|Data|Enum|Eq|Floating|Foldable|Fractional|Functor|Integral|Monad|MonadPlus|Monoid|Num|Ord|Read|Real|RealFloat|RealFrac|Semigroup|Show|Traversable|Typeable|Zip)[ ]"
29
30 # Strings
31 - constant.string:
32 start: "\""
33 end: "\""
34 skip: "\\\\."
35 rules:
36 - special: "\\\\&"
37 - constant.specialChar: "\\\\([abfnrtv\"'\\\\]|[0-9]+|x[0-9a-fA-F]+|o[0-7]+|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC[1-4]|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL)"
38
39 # Comments
40 - comment:
41 start: "--"
42 end: "$"
43 rules:
44 - todo: "(TODO|XXX|FIXME):?"
45
46 - comment:
47 start: "\\{-"
48 end: "-\\}"
49 rules:
50 - todo: "(TODO|XXX|FIXME):?"
51
52 - identifier.macro: "undefined"