Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell lexer incorrectly labels type operators as characters. #1177

Open
Anteru opened this issue Aug 31, 2019 · 1 comment
Open

Haskell lexer incorrectly labels type operators as characters. #1177

Anteru opened this issue Aug 31, 2019 · 1 comment
Labels
S-major severity: major T-bug type: a bug X-imported imported from Bitbucket
Milestone

Comments

@Anteru
Copy link
Collaborator

Anteru commented Aug 31, 2019

(Original issue 1473 created by paamayim on 2018-09-08T19:33:42.558716+00:00)

The haskell lexer incorrect identifies the ' in a ': b as a character.

I've included a patch and testcase.

#!diff

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        Sat Sep 08 15:27:18 2018 -0400
@@ -66,6 +66,7 @@
             (r"(')[" + uni.Lu + r"][\w\']*", Keyword.Type),
             (r"(')\[[^\]]*\]", Keyword.Type),  # tuples and lists get special treatment in GHC
             (r"(')\([^)]*\)", Keyword.Type),  # ..
+            (r"(')[:!#$%&*+.\\/<=>?@^|~-]+", Keyword.Type),  # promoted type operators
             #  Operators
             (r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function),  # lambda operator
             (r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word),  # specials
diff -r 7941677dc77d tests/examplefiles/example.hs
--- a/tests/examplefiles/example.hs     Mon Mar 13 19:16:03 2017 +0000
+++ b/tests/examplefiles/example.hs     Sat Sep 08 15:27:18 2018 -0400
@@ -39,3 +39,7 @@
 type IntChar = '[Int, Char]
 type Falsy = 'False
 type Falsy = '(10, 20, 30)
+type EmptyList = '[]
+type TypeCons = 1 ': '[]
+type Times = 1 '* 2
@Anteru Anteru added T-bug type: a bug X-imported imported from Bitbucket S-major severity: major labels Aug 31, 2019
@JvWesterveld
Copy link

This patch has been merged in #1347.

@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Nov 9, 2020
@Anteru Anteru added this to the 2.6 milestone Nov 9, 2020
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-major severity: major T-bug type: a bug X-imported imported from Bitbucket
Projects
None yet
Development

No branches or pull requests

2 participants