Function: haskell-indentation-expression
haskell-indentation-expression is a natively compiled function defined
in haskell-indentation.el.
Signature
(haskell-indentation-expression &optional ACCEPTED-TOKENS)
Documentation
Parse an expression until an unknown token is encountered.
Source Code
;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-indentation.el
(defun haskell-indentation-expression (&optional accepted-tokens)
"Parse an expression until an unknown token is encountered."
(catch 'return
(let ((current-indent (current-column)))
(unless accepted-tokens
(setq accepted-tokens '(value operator)))
(while t
(cond
((memq current-token accepted-tokens)
(haskell-indentation-read-next-token))
((eq current-token 'end-tokens)
(cond ((string= following-token "where")
(haskell-indentation-add-where-pre-indent)) ; before a where
((haskell-indentation-expression-token-p following-token)
;; a normal expression can be either continued or have
;; left indent
(haskell-indentation-add-indentation
current-indent)
(haskell-indentation-add-indentation
left-indent)))
(throw 'return nil))
(t (let ((parser (assoc current-token
haskell-indentation-expression-list)))
(when (null parser)
(throw 'return nil)) ; not expression token, so exit
(funcall (cdr parser)) ; run parser
;; after an 'open' expression such as 'if', exit
(unless (member (car parser) '("(" "[" "{" "case"))
(throw 'return nil)))))))))