1. Georg Brandl
  2. pygments-main


Gaurav Jain  committed 6cfd87a

Move order of comment match after operator match

Since -- can be used in an operator, match operators before comments. The exmaple file has been updated to add such an operator. Also the package-qualified import has been made more generic.

  • Participants
  • Parent commits 33931e7
  • Branches default

Comments (0)

Files changed (2)

File pygments/lexers/functional.py

View file
             (r'\s+', Text),
             (r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
             (r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
+            (r',', Punctuation),
+            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
             (r'--.*$', Comment.Single),
             (r'{-', Comment.Multiline, 'comment'),
-            (r',', Punctuation),
-            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
             # (HACK, but it makes sense to push two instances, believe me)
             (r'\(', Punctuation, ('funclist', 'funclist')),
             (r'\)', Punctuation, '#pop:2'),

File tests/examplefiles/import.hs

View file
-import "mtl" Control.Monad.Trans
+import "base" Data.Char
+(-->) :: Num a => a -- signature
+(-->) = 2 -- implementation
 main :: IO ()
 main = putStrLn "hello world"