@@ -969,60 +969,63 @@ layout starts."
969
969
(apply-partially #'haskell-indentation-phrase-rest phrase)
970
970
nil ))
971
971
972
- (defun haskell-indentation-phrase-rest (phrase )
972
+ (defun haskell-indentation-phrase-rest (phrase1 )
973
973
" " ; FIXME
974
- (let ((starter-line parse-line-number))
975
- (let ((current-indent (current-column )))
976
- (funcall (car phrase)))
977
- (cond
978
- ((eq current-token 'end-tokens )
979
- (cond ((null (cdr phrase))) ; ; fallthrough
980
- ((equal following-token (cadr phrase))
981
- (haskell-indentation-add-indentation starter-indent)
982
- (throw 'parse-end nil ))
983
- ((string= (cadr phrase) " in" )
984
- (when (= left-indent layout-indent)
985
- (haskell-indentation-add-layout-indent)
986
- (throw 'parse-end nil )))
987
- (t (throw 'parse-end nil ))))
988
- ((null (cdr phrase)))
989
- ((equal (cadr phrase) current-token)
990
- (let* ((on-new-line (= (current-column )
991
- (haskell-indentation-current-indentation)))
992
- (lines-between (- parse-line-number starter-line))
993
- (left-indent (if (<= lines-between 0 )
994
- left-indent
995
- starter-indent)))
996
- (haskell-indentation-read-next-token)
997
- (when (eq current-token 'end-tokens )
998
- (cond ((member (cadr phrase) '(" then" " else" ))
999
- (haskell-indentation-add-indentation
1000
- (+ starter-indent haskell-indentation-ifte-offset)))
1001
-
1002
- ((member (cadr phrase) '(" in" " ->" ))
1003
- ; ; expression ending in another expression
1004
- (when (or (not haskell-indentation-indent-leftmost)
1005
- (eq haskell-indentation-indent-leftmost 'both ))
1006
- (haskell-indentation-add-indentation
1007
- (+ starter-indent haskell-indentation-starter-offset)))
1008
- (when haskell-indentation-indent-leftmost
1009
- (haskell-indentation-add-indentation
1010
- (if on-new-line
1011
- (+ left-indent haskell-indentation-starter-offset)
1012
- left-indent))))
1013
- (t
1014
- (when (or (not haskell-indentation-indent-leftmost)
1015
- (eq haskell-indentation-indent-leftmost 'both ))
1016
- (haskell-indentation-add-indentation
1017
- (+ starter-indent haskell-indentation-starter-offset)))
1018
- (when haskell-indentation-indent-leftmost
974
+ (while phrase1
975
+ (let ((starter-line parse-line-number)
976
+ (phrase phrase1))
977
+ (setq phrase1 nil )
978
+ (let ((current-indent (current-column )))
979
+ (funcall (car phrase)))
980
+ (cond
981
+ ((eq current-token 'end-tokens )
982
+ (cond ((null (cdr phrase))) ; ; fallthrough
983
+ ((equal following-token (cadr phrase))
984
+ (haskell-indentation-add-indentation starter-indent)
985
+ (throw 'parse-end nil ))
986
+ ((string= (cadr phrase) " in" )
987
+ (when (= left-indent layout-indent)
988
+ (haskell-indentation-add-layout-indent)
989
+ (throw 'parse-end nil )))
990
+ (t (throw 'parse-end nil ))))
991
+ ((null (cdr phrase)))
992
+ ((equal (cadr phrase) current-token)
993
+ (let* ((on-new-line (= (current-column )
994
+ (haskell-indentation-current-indentation)))
995
+ (lines-between (- parse-line-number starter-line))
996
+ (left-indent (if (<= lines-between 0 )
997
+ left-indent
998
+ starter-indent)))
999
+ (haskell-indentation-read-next-token)
1000
+ (when (eq current-token 'end-tokens )
1001
+ (cond ((member (cadr phrase) '(" then" " else" ))
1019
1002
(haskell-indentation-add-indentation
1020
- (if on-new-line
1021
- (+ left-indent haskell-indentation-starter-offset)
1022
- left-indent)))))
1023
- (throw 'parse-end nil ))
1024
- (haskell-indentation-phrase-rest (cddr phrase))))
1025
- ((string= (cadr phrase) " in" )))))
1003
+ (+ starter-indent haskell-indentation-ifte-offset)))
1004
+
1005
+ ((member (cadr phrase) '(" in" " ->" ))
1006
+ ; ; expression ending in another expression
1007
+ (when (or (not haskell-indentation-indent-leftmost)
1008
+ (eq haskell-indentation-indent-leftmost 'both ))
1009
+ (haskell-indentation-add-indentation
1010
+ (+ starter-indent haskell-indentation-starter-offset)))
1011
+ (when haskell-indentation-indent-leftmost
1012
+ (haskell-indentation-add-indentation
1013
+ (if on-new-line
1014
+ (+ left-indent haskell-indentation-starter-offset)
1015
+ left-indent))))
1016
+ (t
1017
+ (when (or (not haskell-indentation-indent-leftmost)
1018
+ (eq haskell-indentation-indent-leftmost 'both ))
1019
+ (haskell-indentation-add-indentation
1020
+ (+ starter-indent haskell-indentation-starter-offset)))
1021
+ (when haskell-indentation-indent-leftmost
1022
+ (haskell-indentation-add-indentation
1023
+ (if on-new-line
1024
+ (+ left-indent haskell-indentation-starter-offset)
1025
+ left-indent)))))
1026
+ (throw 'parse-end nil ))
1027
+ (setq phrase1 (cddr phrase))))
1028
+ ((string= (cadr phrase) " in" ))))))
1026
1029
1027
1030
(defun haskell-indentation-add-indentation (indent )
1028
1031
" " ; FIXME
0 commit comments