From 2163d9db774b275ebe0764836f527b48033628d8 Mon Sep 17 00:00:00 2001 From: Gracjan Polak Date: Thu, 1 Oct 2015 09:02:43 +0200 Subject: [PATCH 1/2] Support names starting with quotes In reality a quote that does not seem to be a part of character literal is treated as an operator on its own. --- haskell-indentation.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/haskell-indentation.el b/haskell-indentation.el index 2ab49c7ae..2575ee4dd 100644 --- a/haskell-indentation.el +++ b/haskell-indentation.el @@ -1352,7 +1352,8 @@ line." (defun haskell-indentation-skip-token () "Skip to the next token." (let ((case-fold-search nil)) - (if (or (looking-at "'\\([^\\']\\|\\\\.\\)*'") + (if (or (looking-at "'\\([^\\']\\|\\\\.\\)'") + (looking-at "'\\\\\\([^\\']\\|\\\\.\\)*'") (looking-at "\"\\([^\\\"]\\|\\\\.\\)*\"") ;; Hierarchical names always start with uppercase (looking-at From 5291cc62a1dfe9d251d94709dda944a18ee4a993 Mon Sep 17 00:00:00 2001 From: Gracjan Polak Date: Thu, 1 Oct 2015 09:03:44 +0200 Subject: [PATCH 2/2] Support names starting with quotes (tests) --- tests/haskell-indentation-tests.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/haskell-indentation-tests.el b/tests/haskell-indentation-tests.el index 44e8c1e6a..b66de93f5 100644 --- a/tests/haskell-indentation-tests.el +++ b/tests/haskell-indentation-tests.el @@ -570,4 +570,24 @@ foo = do " ((4 0) 4)) +(hindent-test "28a names starting with quotes" " +f = a (a 'A) + (a 'A) +" + ((2 0) 0 4)) + +(hindent-test "28b character literal (escape sequence)" " +f = '\\\\' + +" + ((2 0) 0 4)) + + +(hindent-test "28c name starting with a quote" " +function (Operation 'Init) = do + print 'Init +" + ((2 0) 2)) + + ;;; haskell-indentation-tests.el ends here