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

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

[nongnu] elpa/swift-mode befeb2a 017/496: Highlight bools and nil as con


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode befeb2a 017/496: Highlight bools and nil as constants
Date: Sun, 29 Aug 2021 11:32:59 -0400 (EDT)

branch: elpa/swift-mode
commit befeb2a58c33691eb074ebbbe0603c1cee42871c
Author: Chris Barrett <chris.d.barrett@me.com>
Commit: Chris Barrett <chris.d.barrett@me.com>

    Highlight bools and nil as constants
---
 swift-mode.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/swift-mode.el b/swift-mode.el
index 72616d5..4010462 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -62,6 +62,9 @@
                   swift-mode--contextual-keywords))
   "Keywords used in the Swift language.")
 
+(defvar swift-mode--constants
+  '("true" "false" "nil"))
+
 (defvar swift-mode--font-lock-defaults
   (list
    (list
@@ -107,6 +110,12 @@
     (cons (rx (not (any word digit)) (group "_") (or eol (not (any word 
digit))))
           (list 1 font-lock-negation-char-face))
 
+    ;; Constants
+    ;;
+    ;; Highlight nil and boolean literals.
+    (cons (rx-to-string `(and bow (or ,@swift-mode--constants) eow))
+          font-lock-constant-face)
+
     ;; Attributes
     ;;
     ;; Use string face for attribute name.



reply via email to

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