Update Haskell with lexer for numeric literal extensions

Issue #1399 new
Takenobu Tani
created an issue

Sorry if it is not the correct procedure.
Could you please modify syntax highlighting of numeric literals for Haskell?

  • Add Number.Float for HexFloatLiterals extension 1
  • Add Number.Bin for BinaryLiterals extension 2
  • Modify Number.* for NumericUnderscores extension 3 4

I prepared a patch on a local basis:

diff -r 7941677dc77d pygments/lexers/haskell.py
--- a/pygments/lexers/haskell.py    Mon Mar 13 19:16:03 2017 +0000
+++ b/pygments/lexers/haskell.py    Sun Dec 03 08:46:22 2017 +0000
@@ -72,11 +72,14 @@
             (r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type),  # Constructor operators
             (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),  # Other operators
             #  Numbers
-            (r'\d+[eE][+-]?\d+', Number.Float),
-            (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
-            (r'0[oO][0-7]+', Number.Oct),
-            (r'0[xX][\da-fA-F]+', Number.Hex),
-            (r'\d+', Number.Integer),
+            (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*', Number.Float),
+            (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*\.[\da-fA-F](_*[\da-fA-F])*(_*[pP][+-]?\d(_*\d)*)?', Number.Float),
+            (r'\d(_*\d)*_*[eE][+-]?\d(_*\d)*', Number.Float),
+            (r'\d(_*\d)*\.\d(_*\d)*(_*[eE][+-]?\d(_*\d)*)?', Number.Float),
+            (r'0[bB]_*[01](_*[01])*', Number.Bin),
+            (r'0[oO]_*[0-7](_*[0-7])*', Number.Oct),
+            (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*', Number.Hex),
+            (r'\d(_*\d)*', Number.Integer),
             #  Character/String Literals
             (r"'", String.Char, 'character'),
             (r'"', String, 'string'),

I visually checked this patch with the these files 5 6.
Please tell me how I should take action.

Thank you for your valuable work.