Commits

Gaurav Jain  committed e6c5231

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.

  • Participants
  • Parent commits 6cfd87a

Comments (0)

Files changed (2)

File pygments/lexers/functional.py

             (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'),

File tests/examplefiles/import.hs

 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"