From 97a291d6c08ed7f5f656c3349fd1f19e247cbc37 Mon Sep 17 00:00:00 2001 From: Justus Adam Date: Mon, 27 Apr 2020 12:27:48 +0100 Subject: [PATCH] Fixed highlighting for infix constructors Closes #120 --- CHANGELOG.md | 2 ++ syntaxes/haskell.YAML-tmLanguage | 5 ++++- test/syntax-examples/test.hs | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd55ed..db189a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/syntaxes/haskell.YAML-tmLanguage b/syntaxes/haskell.YAML-tmLanguage index f9ca71b..458b973 100644 --- a/syntaxes/haskell.YAML-tmLanguage +++ b/syntaxes/haskell.YAML-tmLanguage @@ -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 diff --git a/test/syntax-examples/test.hs b/test/syntax-examples/test.hs index 45a27be..e017b45 100644 --- a/test/syntax-examples/test.hs +++ b/test/syntax-examples/test.hs @@ -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