summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Jain <gaurav@gauravjain.org>2014-04-20 12:40:50 -0400
committerGaurav Jain <gaurav@gauravjain.org>2014-04-20 12:40:50 -0400
commit4393a40410fa23443311d3d03543bb558ad94ded (patch)
treedf7fbf1b3ddd1b8c829d5213b2807ad837a9165a
parentfe432e0176860487e3b09b180aa3b7627dffab9e (diff)
downloadpygments-4393a40410fa23443311d3d03543bb558ad94ded.tar.gz
Restore order of comment regex. Instead copy better expression from root state.
The previous commit does not handle all situations. Instead the comment regex needs to be copied from the root state. Added additional test lines in the example file for testing.
-rw-r--r--pygments/lexers/functional.py4
-rw-r--r--tests/examplefiles/import.hs10
2 files changed, 11 insertions, 3 deletions
diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py
index 5baa18e9..af9918a0 100644
--- a/pygments/lexers/functional.py
+++ b/pygments/lexers/functional.py
@@ -977,10 +977,10 @@ class HaskellLexer(RegexLexer):
(r'\s+', Text),
(r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
+ (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
+ (r'{-', Comment.Multiline, 'comment'),
(r',', Punctuation),
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
- (r'--.*$', Comment.Single),
- (r'{-', Comment.Multiline, 'comment'),
# (HACK, but it makes sense to push two instances, believe me)
(r'\(', Punctuation, ('funclist', 'funclist')),
(r'\)', Punctuation, '#pop:2'),
diff --git a/tests/examplefiles/import.hs b/tests/examplefiles/import.hs
index 5ececfea..f266f62e 100644
--- a/tests/examplefiles/import.hs
+++ b/tests/examplefiles/import.hs
@@ -1,7 +1,15 @@
import "base" Data.Char
+import "base" Data.Char (isControl, isSpace)
+import "base" Data.Char (isControl, --isSpace)
+ isSpace)
+import "base" Data.Char (isControl, -- isSpace)
+ isSpace)
(-->) :: Num a => a -- signature
-(-->) = 2 -- implementation
+(-->) = 2 -- >implementation
+
+--test comment
+-- test comment
main :: IO ()
main = putStrLn "hello world"