nanorc/haskell.nanorc
lopho d0481c50e1
Better haskell highlighting
More generic highlighting for user defined types, strings with escape characters, extensions, operators, infix operators, and hex/oct/dec numbers with scientific notation.
2019-02-28 05:32:08 +01:00

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:]]+$"