diff --git a/haskell-lexeme.el b/haskell-lexeme.el index 9090acc86..52e4c640e 100644 --- a/haskell-lexeme.el +++ b/haskell-lexeme.el @@ -107,13 +107,16 @@ Note that (match-string 1) returns the unqualified part.") Note that negative sign char is not part of a number.") (defconst haskell-lexeme-char-literal-inside - (rx (| (regexp "[^\n'\\]") + (rx (| (not (any "\n'\\")) (: "\\" (| "a" "b" "f" "n" "r" "t" "v" "\\" "\"" "'" "NUL" "SOH" "STX" "ETX" "EOT" "ENQ" "ACK" "BEL" "BS" "HT" "LF" "VT" "FF" "CR" "SO" "SI" "DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB" "CAN" "EM" "SUB" "ESC" "FS" "GS" "RS" "US" "SP" "DEL" + (regexp "[0-9]+") + (: "x" (regexp "[0-9a-fA-F]+")) + (: "o" (regexp "[0-7]+")) (: "^" (regexp "[]A-Z@^_\\[]")))))) "Regexp matching an inside of a character literal.") diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el index 64264d8a4..cbc9b8f09 100644 --- a/tests/haskell-font-lock-tests.el +++ b/tests/haskell-font-lock-tests.el @@ -36,6 +36,11 @@ ("_f" "w" haskell-symbol-face) ("_'''" "w" haskell-symbol-face)))) +(ert-deftest haskell-syntactic-test-character-literal-escapes () + (check-properties + '("'\\000' '\\x01'") + '(("'\\000'" t font-lock-string-face) + ("'\\x01'" t font-lock-string-face)))) (ert-deftest haskell-syntactic-test-7 () "Take quotes and double quotes under control."