branch: elpa/swift-mode commit befeb2a58c33691eb074ebbbe0603c1cee42871c Author: Chris Barrett <chris.d.barr...@me.com> Commit: Chris Barrett <chris.d.barr...@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.