Skip to content

Fix parsing of comma separated list inside parentheses #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions haskell-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -940,20 +940,22 @@ the current buffer."
;; ,
(defun haskell-indentation-separated (parser separator &optional stmt-separator)
(catch 'return
(unless (listp separator)
(setq separator (list separator)))
(unless (listp stmt-separator)
(setq stmt-separator (list stmt-separator)))
(while t
(funcall parser)
(cond ((if (listp separator)
(member current-token separator)
(equal current-token separator))
(cond ((member current-token separator)
(haskell-indentation-at-separator))

((equal current-token stmt-separator)
((member current-token stmt-separator)
(setq starter-indent (current-column))
(haskell-indentation-at-separator))

((eq current-token 'end-tokens)
(cond ((or (equal following-token separator)
(equal following-token stmt-separator))
(cond ((or (member following-token separator)
(member following-token stmt-separator))
;; set an indentation before a separator,
;; for example:
;; [ 1 or [ 1 | a
Expand Down
1 change: 0 additions & 1 deletion tests/haskell-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Example of lines:

(ert-deftest haskell-indentation-check-4 ()
"Import statememnt symbol list 2"
:expected-result :failed
(haskell-indentation-check
"import Control.Concurrent"
" ( forkIO"
Expand Down