Skip to content

Commit

Permalink
Fixed highlighting for infix constructors
Browse files Browse the repository at this point in the history
Closes #120
  • Loading branch information
JustusAdam committed Apr 27, 2020
1 parent d17e4e5 commit 97a291d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
patterns
- Enabling pragmas in multiline comments
([#116](https://github.com/JustusAdam/language-haskell/issues/116))
- Fixed highlighting for infix constructors
([#120])https://github.com/JustusAdam/language-haskell/issues/120)

## 3.0.0 - 26.04.2020

Expand Down
5 changes: 4 additions & 1 deletion syntaxes/haskell.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ patterns:
patterns: {include: $self}
- captures:
'3': {name: entity.name.namespace}
'4':
patterns:
- include: '#data_constructor'
comment: |
In case this regex seems unusual for an infix operator, note that Haskell
allows any ordinary function application (elem 4 [1..10]) to be rewritten
as an infix expression (4 `elem` [1..10]).
match: >-
(`)(([\p{Lu}\p{Lt}][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}''\.]*)\.)?[\p{Ll}_][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}'']*(`)
(`)(([\p{Lu}\p{Lt}][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}''\.]*)\.)?([\p{Ll}\p{Lu}_][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}'']*)(`)
name: keyword.operator.function.infix.haskell
- match: '\(\s*\)'
name: constant.language.unit.haskell
Expand Down
6 changes: 6 additions & 0 deletions test/syntax-examples/test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ f (A,B) = 3
f ( A,B ) = 3
f ( A ,B ) = 3

-- Infix constructors

f =
a `C.A.Constr` b
a `Constr` b
a `C.A.f` b

-- Pragmas in comment blocks

Expand Down

0 comments on commit 97a291d

Please sign in to comment.