[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 4ec6259 185/385: prefer the lexer
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 4ec6259 185/385: prefer the lexer |
Date: |
Tue, 5 Oct 2021 23:59:28 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 4ec62598a70980645af1c3d471fbb36be85d62d7
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
prefer the lexer
---
haskell-tng-smie.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 641c30d..d640e3a 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -215,7 +215,8 @@ information, to aid in the creation of new rules."
(or (smie-backward-sexp)
(bobp))))))
(next (save-excursion
- (car (smie-indent-forward-token)))))
+ (car (smie-indent-forward-token))))
+ (prevline (haskell-tng-smie:prev-line-tokens)))
(when haskell-tng-smie:debug
(with-current-buffer haskell-tng-smie:debug
@@ -237,8 +238,7 @@ information, to aid in the creation of new rules."
"|")
((and (member parent '("::" "=>"))
- (not (haskell-tng-smie:search-prev-line
- (rx (>= 2 (+ anything) "->")))))
+ (< (--count (equal it "=>") prevline) 2))
"=>")
((equal parent "deriving")
@@ -454,13 +454,18 @@ Inspired by `smie-indent--parent', which can only be used
in
(cons tok (haskell-tng-smie:ancestors (- n 1)))
(list tok))))
-(defun haskell-tng-smie:search-prev-line (regexp)
+(defun haskell-tng-smie:prev-line-tokens ()
"Search forward on the previous non-empty line"
(save-excursion
(beginning-of-line)
(forward-comment (- (point)))
(beginning-of-line)
- (re-search-forward regexp (line-end-position) t)))
+ (let ((eol (line-end-position))
+ tokens)
+ (while (< (point) eol)
+ (when-let (tok (smie-indent-forward-token))
+ (push (car tok) tokens)))
+ (reverse tokens))))
;; SMIE wishlist, in order of desirability:
;;
- [nongnu] elpa/haskell-tng-mode d43fd73 141/385: more efficient indentation 'insert test, (continued)
- [nongnu] elpa/haskell-tng-mode d43fd73 141/385: more efficient indentation 'insert test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode a830fcb 135/385: reindention test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode aa2a0ad 146/385: prefer --enable-tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode a754020 144/385: indent alts will suggest based on previous <- lines, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 9023dc6 164/385: don't rely on line-based indentation rules, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fdaaf38 148/385: indent after "in", ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e2c60a9 161/385: prep for records, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8e4f438 184/385: don't continue indenting one liner types, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5251477 186/385: thots, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 41f1ad5 191/385: document fast-tags, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4ec6259 185/385: prefer the lexer,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 1475f31 196/385: workaround bad indentation at the end of files, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4b0ab71 199/385: indent type signatures on separate lines, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 950d094 210/385: projectile is not core, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2df165a 229/385: electric indent locally disabled only, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 56ee2aa 231/385: completions alpha, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6e938d0 230/385: workaround cabal bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 444664d 257/385: special case indentation of visual line breaks, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 487989b 241/385: skeleton for contrib-stack, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cea8b23 240/385: proof of concept getting the ghcflags from cabal, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6699829 277/385: cleaner fqns, ELPA Syncer, 2021/10/06