summaryrefslogtreecommitdiff
path: root/pygments/lexers/haskell.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-08 00:12:29 +0200
committerGeorg Brandl <georg@python.org>2014-10-08 00:12:29 +0200
commit1fd65ff28bc90c6ea89a4f4e6397818ab1a99b4c (patch)
tree428190f76c144f08d6b8f7e058ad10667905e03e /pygments/lexers/haskell.py
parent91a1dc56d38e918f69bf690675583f60a0b6425d (diff)
downloadpygments-1fd65ff28bc90c6ea89a4f4e6397818ab1a99b4c.tar.gz
Closes #1015: fix lexing of Haskell char literals.
In the case of TH quoting, 'f'7 means char literal and then numeric 7, not quoted f'7, see http://www.haskell.org/ghc/docs/7.6.2/html/users_guide/template-haskell.html
Diffstat (limited to 'pygments/lexers/haskell.py')
-rw-r--r--pygments/lexers/haskell.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py
index 9b13cbc6..6c71aa97 100644
--- a/pygments/lexers/haskell.py
+++ b/pygments/lexers/haskell.py
@@ -59,8 +59,9 @@ class HaskellLexer(RegexLexer):
(r'\bmodule\b', Keyword.Reserved, 'module'),
(r'\berror\b', Name.Exception),
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
+ (r"'[^\\]'", String.Char), # this has to come before the TH quote
(r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
- (r"'?[_" + uni.Ll + r"'][\w']*", Name),
+ (r"'?[_" + uni.Ll + r"][\w']*", Name),
(r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
# Operators
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator