[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 174c63b 046/385: laying the foundations f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 174c63b 046/385: laying the foundations for SMIE |
Date: |
Tue, 5 Oct 2021 23:58:59 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 174c63b799a5a8ce94f392a976698a0aff5636be
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
laying the foundations for SMIE
---
haskell-tng-smie.el | 41 ++++++++++++++++++++++++++++++++++++++
test/haskell-tng-font-lock-test.el | 2 +-
test/haskell-tng-smie-test.el | 39 ++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+), 1 deletion(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
new file mode 100644
index 0000000..436b17a
--- /dev/null
+++ b/haskell-tng-smie.el
@@ -0,0 +1,41 @@
+;;; haskell-tng-smie.el --- SMIE Rules for Haskell -*- lexical-binding: t -*-
+
+;; Copyright (C) 2018 Tseen She
+;; License: GPL 3 or any later version
+
+;;; Commentary:
+;;
+;; SMIE lexer, precedence table (providing s-expression navigation), and
+;; indentation rules.
+;;
+;; https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#SMIE
+;;
+;;; Code:
+
+(require 'smie)
+
+ ;; (defvar sample-keywords-regexp
+ ;; (regexp-opt '("+" "*" "," ";" ">" ">=" "<" "<=" ":=" "=")))
+ ;; (defun sample-smie-forward-token ()
+ ;; (forward-comment (point-max))
+ ;; (cond
+ ;; ((looking-at sample-keywords-regexp)
+ ;; (goto-char (match-end 0))
+ ;; (match-string-no-properties 0))
+ ;; (t (buffer-substring-no-properties
+ ;; (point)
+ ;; (progn (skip-syntax-forward "w_")
+ ;; (point))))))
+ ;; (defun sample-smie-backward-token ()
+ ;; (forward-comment (- (point)))
+ ;; (cond
+ ;; ((looking-back sample-keywords-regexp (- (point) 2) t)
+ ;; (goto-char (match-beginning 0))
+ ;; (match-string-no-properties 0))
+ ;; (t (buffer-substring-no-properties
+ ;; (point)
+ ;; (progn (skip-syntax-backward "w_")
+ ;; (point))))))
+
+(provide 'haskell-tng-smie)
+;;; haskell-tng-smie.el ends here
diff --git a/test/haskell-tng-font-lock-test.el
b/test/haskell-tng-font-lock-test.el
index afaba90..fe5c739 100644
--- a/test/haskell-tng-font-lock-test.el
+++ b/test/haskell-tng-font-lock-test.el
@@ -17,6 +17,6 @@
(faceup-defexplainer have-expected-faces)
(ert-deftest haskell-tng-font-lock-file-tests ()
- (should (have-expected-faces "faces/medley.hs")) )
+ (should (have-expected-faces "faces/medley.hs")))
;;; haskell-tng-font-lock-test.el ends here
diff --git a/test/haskell-tng-smie-test.el b/test/haskell-tng-smie-test.el
new file mode 100644
index 0000000..2905484
--- /dev/null
+++ b/test/haskell-tng-smie-test.el
@@ -0,0 +1,39 @@
+;;; haskell-tng-smie-test.el --- Tests for fontification -*- lexical-binding:
t -*-
+
+;; Copyright (C) 2018 Tseen She
+;; License: GPL 3 or any later version
+
+(require 'haskell-tng-mode)
+
+(require 'ert)
+(require 'faceup)
+
+(defun haskell-tng-smie:lex-forward-buffer ()
+ (let* ((buf (current-buffer))
+ (work (switch-to-buffer (concat (buffer-file-name)
".lexer.forward"))))
+ (switch-to-buffer buf)
+ (goto-char (point-min))
+
+ ;; FIXME progress through the buf writing the returned values to work
+ ;; maybe with a character to indicate invocations, maybe newlines.
+
+ ))
+
+(defun have-expected-forward-lexer (file)
+ (let* ((filename (expand-file-name
+ file
+ (eval-when-compile (faceup-this-file-directory))))
+ (golden (concat filename ".lexer.forward")))
+
+ ;; FIXME run the lex-forward-buffer and compare the result with the version
+ ;; on disk, perhaps a trimmed diff.
+
+ ))
+
+(ert-deftest haskell-tng-smie-file-tests ()
+ (should (have-expected-forward-lexer "faces/medley.hs")))
+
+;; ideas for an indentation tester
+;;
https://github.com/elixir-editors/emacs-elixir/blob/master/test/test-helper.el#L52-L63
+
+;;; haskell-tng-smie-test.el ends here
- [nongnu] elpa/haskell-tng-mode ec39a64 133/385: improvements to indentation alts and compilation info, (continued)
- [nongnu] elpa/haskell-tng-mode ec39a64 133/385: improvements to indentation alts and compilation info, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f67557b 142/385: fix a layout corner case, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 20f4091 152/385: support dollars in indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0d5e020 151/385: support LambdaCase, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 08a3946 163/385: records indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3449847 162/385: no need to special-case dollar, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8b5a4d4 177/385: improve indentation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cb801b4 015/385: moar multiline type search, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode de48840 030/385: multiline import anchors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5c50be0 044/385: remove redundant TODOs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 174c63b 046/385: laying the foundations for SMIE,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 97ce717 058/385: improve the testing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2a2afee 064/385: cache invalidation and tests for layout invalidation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3ca869f 067/385: code reorganisation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0ffb885 071/385: a thought, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 79aeb82 076/385: most of the grammar, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 7eaef51 078/385: optimisation in the sexp test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cb0f3d2 082/385: starting indentation rules, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cfbdae1 084/385: simplify the lexer assertion language, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0c5acb7 087/385: lexer and grammar supports symid, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6c520bc 093/385: fixes for type level lists, ELPA Syncer, 2021/10/06