diff --git a/haskell-font-lock.el b/haskell-font-lock.el index a0d837427..b557003ae 100644 --- a/haskell-font-lock.el +++ b/haskell-font-lock.el @@ -335,16 +335,16 @@ like ::, class, instance, data, newtype, type." ;; "^>", otherwise a line of code starts with "^". (line-prefix "^\\(?:> ?\\)?") - (varid "\\b[[:lower:]_][[:alnum:]'_]*\\b") + (varid "[[:lower:]_][[:alnum:]'_]*") ;; We allow ' preceding conids because of DataKinds/PolyKinds - (conid "\\b'?[[:upper:]][[:alnum:]'_]*\\b") + (conid "'?[[:upper:]][[:alnum:]'_]*") (sym "\\s.+") ;; Top-level declarations (topdecl-var - (concat line-prefix "\\(" varid "\\(?:\\s-*,\\s-*" varid "\\)*" "\\)\\s-*" + (concat line-prefix "\\(" varid "\\(?:\\s-*,\\s-*" varid "\\)*" "\\)" ;; optionally allow for a single newline after identifier - "\\([\n]\\s-+\\)?" + "\\(\\s-+\\|\\s-*[\n]\\s-+\\)" ;; A toplevel declaration can be followed by a definition ;; (=), a type (::) or (∷), a guard, or a pattern which can ;; either be a variable, a constructor, a parenthesized diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el index 1ffea8588..0ae72c5d2 100644 --- a/tests/haskell-font-lock-tests.el +++ b/tests/haskell-font-lock-tests.el @@ -443,6 +443,17 @@ '("Q +++ 12.12") '(("+++" t haskell-definition-face)))) +(ert-deftest haskell-syntactic-definition-face-4 () + (check-properties + '("_test'") + '(("_test'" t nil)))) + +(ert-deftest haskell-syntactic-definition-face-5 () + (check-properties + '("_test' _") + '(("_test'" t haskell-definition-face)))) + + (ert-deftest haskell-literate-bird-1 () (check-properties '("Comment1"