emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode f6ce55f 006/385: type detection has begun


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode f6ce55f 006/385: type detection has begun
Date: Tue, 5 Oct 2021 23:58:50 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit f6ce55f08f88acad6b877e707f3246f50de88e38
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    type detection has begun
---
 haskell-tng-font-lock.el | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/haskell-tng-font-lock.el b/haskell-tng-font-lock.el
index 7be03a2..8558efc 100644
--- a/haskell-tng-font-lock.el
+++ b/haskell-tng-font-lock.el
@@ -48,8 +48,11 @@
   "Haskell constructors."
   :group 'haskell-tng:faces)
 
-;; TODO: types (signatures, classes and imports)
-;;
+(defface haskell-tng:toplevel
+  '((t :inherit font-lock-function-name-face))
+  "Haskell top level declarations."
+  :group 'haskell-tng:faces)
+
 ;; TODO: pragmas
 ;;
 ;; TODO: numeric / char primitives?
@@ -79,6 +82,22 @@
           (: symbol-start (char ?\\))))
       . 'haskell-tng:keyword)
 
+     ;; types
+     ;; TODO TypeApplications
+     ;; 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)))
+      (1 'haskell-tng:type keep))
+     (,(rx-to-string `(: line-start "data" (+ space)
+                         (group (| ,conid ,consym))))
+      (1 'haskell-tng:type))
+
      ;; modules
      (,(rx-to-string `(: symbol-start "module" symbol-end (+ space)
                          symbol-start (group (opt ,qual) ,conid) symbol-end))
@@ -97,6 +116,14 @@
                           (opt (+ space) word-start (group ,conid) word-end)))
        nil nil (1 'haskell-tng:keyword) (2 'haskell-tng:module nil t)))
 
+     ;; top-level
+     (,(rx-to-string `(: line-start
+                         (group (|
+                                 (: (any lower ?_) (* wordchar))
+                                 (: "(" (+? (syntax symbol)) ")")))
+                         symbol-end))
+      . 'haskell-tng:toplevel)
+
      ;; uses of F.Q.N.s
      (,(rx-to-string `(: symbol-start (+ (: ,conid "."))))
       . 'haskell-tng:module)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]