[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 6ce5efb 007/385: moar type fontification
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 6ce5efb 007/385: moar type fontification |
Date: |
Tue, 5 Oct 2021 23:58:50 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 6ce5efb7aeeb58985eff60d71db8ee37bd721e4e
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
moar type fontification
---
haskell-tng-font-lock.el | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/haskell-tng-font-lock.el b/haskell-tng-font-lock.el
index 8558efc..68f5a2f 100644
--- a/haskell-tng-font-lock.el
+++ b/haskell-tng-font-lock.el
@@ -14,12 +14,6 @@
;; parsing, but until that day, we do it the idiomatic Emacs way (with hacks
;; and more hacks).
;;
-;; We try very hard to use only single line fontifications, since multiline
-;; introduces both a performance and maintenance penalty. For this reason,
some
-;; very unusual styles of Haskell, although valid, may not be supported. For
-;; example, comments in unusual positions and line breaks after contextual
-;; markers (e.g. multiline imports may pick up incorrect colours).
-;;
;;
https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Font-Lock-Mode
;;
;;; Code:
@@ -57,7 +51,13 @@
;;
;; TODO: numeric / char primitives?
;;
-;; TODO: haddock
+;; TODO: haddock, different face vs line comments, and some markup.
+;;
+;; TODO: multiline support for imports and type detection.
+;;
+;; TODO: consider comments where we currently check for spaces.
+;;
+;; TODO: consider ; in the "until the end of the line" searches.
(setq
haskell-tng:keywords
@@ -82,28 +82,33 @@
(: symbol-start (char ?\\))))
. 'haskell-tng:keyword)
- ;; types
- ;; TODO TypeApplications
+ ;; types (multi-line support would improve this)
;; TODO bracketed types (when are these allowed)
- ;; TODO class definitions
- ;; TODO types (not constructors) in imports
(,(rx-to-string '(: (|
(: line-start (+ space) "->")
(: symbol-start "::" symbol-end))
(+ space)
(group (+? (not (syntax comment-start))))
- (| (syntax comment-start) line-end)))
+ (| ?\; (syntax comment-start) line-end)))
(1 'haskell-tng:type keep))
(,(rx-to-string `(: line-start "data" (+ space)
(group (| ,conid ,consym))))
(1 'haskell-tng:type))
+ (,(rx-to-string `(: line-start (| "class" "instance") (+ space)
+ (group (+? anything))
+ (+ space) "where"))
+ (1 'haskell-tng:type keep))
+ ;; TypeApplications
+ (,(rx-to-string `(: symbol-start "@" (+ space)
+ (group (opt ,qual) (| ,conid ,consym))))
+ (1 'haskell-tng:type))
;; modules
(,(rx-to-string `(: symbol-start "module" symbol-end (+ space)
symbol-start (group (opt ,qual) ,conid) symbol-end))
1 'haskell-tng:module)
- ;; imports
+ ;; imports (multi-line support would improve this)
(,(rx-to-string '(: word-start "import" word-end)) ;; anchor matcher
(,(rx-to-string `(: point (+ space) (group word-start "qualified"
word-end)))
nil nil (1 'haskell-tng:keyword))
@@ -114,7 +119,12 @@
(,(rx-to-string `(: point (+? (not (any ?\()))
word-start (group (| "hiding" "as")) word-end
(opt (+ space) word-start (group ,conid) word-end)))
- nil nil (1 'haskell-tng:keyword) (2 'haskell-tng:module nil t)))
+ nil nil (1 'haskell-tng:keyword) (2 'haskell-tng:module nil t))
+ (,(rx-to-string `(: symbol-start (group (| ,conid ,consym)) symbol-end
+ (* space) "(..)"))
+ nil nil (1 'haskell-tng:constructor))
+ (,(rx-to-string `(: symbol-start (group (| ,conid ,consym)) symbol-end))
+ nil nil (1 'haskell-tng:type)))
;; top-level
(,(rx-to-string `(: line-start
- [nongnu] branch elpa/haskell-tng-mode created (now 55d8e69), ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode bf24329 001/385: going nova, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode aadf499 003/385: module fontification, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode c2a5b64 005/385: cleaner import fontification, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode f6ce55f 006/385: type detection has begun, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode 700524b 008/385: typo in keywords, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode 6ce5efb 007/385: moar type fontification,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 7bc3218 010/385: extend types in parens, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode 52f0cb9 011/385: expand parens, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode f99ca77 012/385: fixup! expand parens, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode bd8f905 016/385: almost there, regions not being expanded, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode db064be 024/385: dank macro for font-lock extends/keyword, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode 639fc6c 018/385: multiline types and font-lock-multiline, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode cc739ad 020/385: multiline topdecl type sections, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode 595bd44 034/385: type families, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode 77d6ec5 019/385: cleaned up multiline explicit types, ELPA Syncer, 2021/10/05
- [nongnu] elpa/haskell-tng-mode fa32b46 037/385: finally caught the bug in anchor pre/post resetting, ELPA Syncer, 2021/10/05