summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2017-01-17 08:09:27 +0100
committerGeorg Brandl <georg@python.org>2017-01-17 08:09:27 +0100
commitfc626ed69b1c298e530c173d80dd513f5f0d6b95 (patch)
tree52f29fdec9109dd567ec4730e42b125cffce52ed
parenteb4b3ea0d83b9b8e6dc2e1a642eac393c45181af (diff)
parent4cba1dc69e9fb3be36936ad70082ee831c362eb6 (diff)
downloadpygments-fc626ed69b1c298e530c173d80dd513f5f0d6b95.tar.gz
Merged in tehunger/pygments-main (pull request #685)
Two Haskell fixes
-rw-r--r--pygments/lexers/haskell.py5
-rw-r--r--tests/examplefiles/example.hs10
2 files changed, 14 insertions, 1 deletions
diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py
index ffc3a3a2..b85a8d58 100644
--- a/pygments/lexers/haskell.py
+++ b/pygments/lexers/haskell.py
@@ -39,7 +39,7 @@ class HaskellLexer(RegexLexer):
flags = re.MULTILINE | re.UNICODE
reserved = ('case', 'class', 'data', 'default', 'deriving', 'do', 'else',
- 'if', 'in', 'infix[lr]?', 'instance',
+ 'family', 'if', 'in', 'infix[lr]?', 'instance',
'let', 'newtype', 'of', 'then', 'type', 'where', '_')
ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK',
'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE',
@@ -63,6 +63,9 @@ class HaskellLexer(RegexLexer):
(r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
(r"'?[_" + uni.Ll + r"][\w']*", Name),
(r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
+ (r"(')[" + uni.Lu + r"][\w\']*", Keyword.Type),
+ (r"(')\[[^\]]*\]", Keyword.Type), # tuples and lists get special treatment in GHC
+ (r"(')\([^\)]*\)", Keyword.Type), # ..
# Operators
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
diff --git a/tests/examplefiles/example.hs b/tests/examplefiles/example.hs
index f5e2b555..764cab77 100644
--- a/tests/examplefiles/example.hs
+++ b/tests/examplefiles/example.hs
@@ -29,3 +29,13 @@ data ĈrazyThings =
-- some char literals:
charl = ['"', 'a', '\ESC', '\'', ' ']
+
+-- closed type families
+type family Fam (a :: Type) = r :: Type where
+ Fam Int = True
+ Fam a = False
+
+-- type literals
+type IntChar = '[Int, Char]
+type Falsy = 'False
+type Falsy = '(10, 20, 30)