diff --git a/haskell-font-lock.el b/haskell-font-lock.el index 160e4ac76..e2a0015c2 100644 --- a/haskell-font-lock.el +++ b/haskell-font-lock.el @@ -304,10 +304,8 @@ like ::, class, instance, data, newtype, type." (conid (if (get-text-property (match-beginning 0) 'haskell-type) 'haskell-type-face 'haskell-constructor-face)) - (varsym (when (and (not (member (match-string 0) '("-" "+" "."))) - (not (save-excursion - (goto-char (match-beginning 1)) - (looking-at-p "\\sw")))) + (varsym (unless (and (member (match-string 0) '("-" "+" ".")) + (equal (string-to-syntax "w") (syntax-after (match-beginning 0)))) ;; We need to protect against the case of ;; plus, minus or dot inside a floating ;; point number. diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el index 3d8bdf220..64264d8a4 100644 --- a/tests/haskell-font-lock-tests.el +++ b/tests/haskell-font-lock-tests.el @@ -268,6 +268,7 @@ " 9.9'r'" ; (9.9,'r') " 's'12e-34" ; ('s',1.2e-33) " 't'56.78" ; ('t',56.78) + " ." ) '(("'a'" t font-lock-string-face) ("'b'" t font-lock-string-face) @@ -294,6 +295,7 @@ ("12e-34" t nil) ("'t'" t font-lock-string-face) ("56.78" t nil) + ("." t haskell-operator-face) )))