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

Import: haskell: Properly highlight promoted data constructors #21

Merged
merged 1 commit into from
May 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
haskell: Properly highlight promoted data constructors
Unfortunately there is a bit of ambiguity with char literals.
For instance, the data constructor `A'` would be `'A'` in promoted form.
This will still be highlighted as as char literal but this is the best
we can do without more context.
  • Loading branch information
bgamari committed Nov 1, 2018
commit be79c58ac13042496ad50b167ab5217296e65150
1 change: 1 addition & 0 deletions lib/rouge/lexers/haskell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def self.detect?(text)
# rule /^[_a-z][\w']*/, Name::Function
rule /[_a-z][\w']*/, Name
rule /[A-Z][\w']*/, Keyword::Type
rule /'[A-Z]\w[\w']*/, Keyword::Type # promoted data constructor

# lambda operator
rule %r(\\(?![:!#\$\%&*+.\\/<=>?@^\|~-]+)), Name::Function
Expand Down