mirror of
https://github.com/scopatz/nanorc
synced 2025-06-20 13:40:07 +02:00
More generic highlighting for user defined types, strings with escape characters, extensions, operators, infix operators, and hex/oct/dec numbers with scientific notation.
49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
syntax "Haskell" "\.hs$"
|
|
comment "-- "
|
|
|
|
## Numbers (hex, oct, dec)
|
|
color magenta "((0[xX][0-9a-fA-F]+)|(0[oO][0-7]+)|([0-9]+(\.[0-9]+)?(e[0-9]+(\.[0-9]+)?)?))"
|
|
|
|
## Operators
|
|
color cyan "[^(a-z)^(A-Z)^(0-9)^ ]*"
|
|
|
|
## Chars
|
|
color green "'([^']|\\')'"
|
|
|
|
## Types, constructors, modules
|
|
color yellow "([ ]|^)+([A-Z][a-zA-Z0-9']*)"
|
|
|
|
## Names
|
|
color normal "([ ]|^)+[a-z][a-zA-Z0-9'_]*"
|
|
|
|
## Infix backticked names
|
|
color cyan "`[a-z][a-zA-Z0-9'_]*`"
|
|
|
|
## Strings
|
|
color green "\"([^\"\\]|\\.)*\""
|
|
|
|
## Commas, brac(k)e(t)s
|
|
color normal "(,|\[|\]|\{|\}|\(|\))"
|
|
|
|
## Special sugar
|
|
color magenta "\([ ]*\)"
|
|
color magenta "\[[ ]*\]"
|
|
|
|
## Keywords
|
|
color red "[ ](as|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)[ ]"
|
|
color red "(^data|^foreign|^import|^infix|^infixl|^infixr|^instance|^module|^newtype|^type)[ ]"
|
|
color red "[ ](as$|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$)"
|
|
|
|
## undefined
|
|
color brightred "undefined"
|
|
|
|
## Comments
|
|
color brightblue "-- .*"
|
|
color brightblue start="\{-" end="-\}"
|
|
|
|
## Extensions
|
|
color brightred start="\{-#" end="#-\}"
|
|
|
|
## Trailing spaces
|
|
color ,green "[[:space:]]+$"
|