[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 68ca175 056/217: Fixes #20, the cons bug (a ::
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 68ca175 056/217: Fixes #20, the cons bug (a :: b :: Nil) as well as improving some of |
Date: |
Sun, 29 Aug 2021 11:30:42 -0400 (EDT) |
branch: elpa/scala-mode
commit 68ca175580d70582e9f6bfc3b8afd7b432e39fd2
Author: Erik Osheim <d_m@plastic-idolatry.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Fixes #20, the cons bug (a :: b :: Nil) as well as improving some of
the other rules a bit. More things will highlight as objects now.
Closes #21
---
scala-mode-fontlock.el | 58 ++++++++++++++++++++++++++++++++------------------
1 file changed, 37 insertions(+), 21 deletions(-)
diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el
index e4b9628..bd78a97 100644
--- a/scala-mode-fontlock.el
+++ b/scala-mode-fontlock.el
@@ -7,7 +7,7 @@
(require 'scala-mode-syntax)
(require 'scala-mode-constants)
-(defcustom scala-font-lock:constant-list '("Nil")
+(defcustom scala-font-lock:constant-list '()
"A list of strigs that should be fontified in constant
face. This customization property takes effect only after the
scala-mode has been reloaded."
@@ -351,7 +351,7 @@ Does not continue past limit.
"\\)")
1 font-lock-constant-face)
- ;; class, trait
+ ;; class, trait, object
(,(concat "\\<\\(class\\|trait\\)[ \t]+\\("
scala-syntax:id-re
"\\)")
@@ -384,7 +384,7 @@ Does not continue past limit.
(2 font-lock-constant-face nil t)
(3 font-lock-type-face nil t)))
- ;; Case (but not case class|object)
+ ;; case (but not case class|object)
("\\<case[ \t]+\\([^:]\\)"
(scala-font-lock:mark-pattern-part (scala-font-lock:limit-pattern
(goto-char (match-beginning 1)))
@@ -393,19 +393,21 @@ Does not continue past limit.
(2 font-lock-constant-face nil t)
(3 font-lock-type-face nil t)))
- ;; Some patterns from Erik
-
- ;; :
- (,(rx ":"
- (0+ space)
- (group (or
- (and (in "a-zA-Z_")
- (0+ (in "a-zA-Z0-9_"))
- (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
- (and (in "!#%&*+-/<=>?@\\^|~") (0+ (in
"!#%&*+-/:<=>?@\\^|~"))))))
- (1 font-lock-type-face))
-
- (,(rx (group "extends")
+ ;; type ascriptions (: followed by a type)
+ (,(rx
+ (or (not (in "!#%&*+-/:<=>?@\\^|~")) line-start)
+ (group ":")
+ (0+ space)
+ (group (or
+ (and (in "a-zA-Z_")
+ (0+ (in "a-zA-Z0-9_"))
+ (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (and (in "!#%&*+-/<=>?@\\^|~") (0+ (in
"!#%&*+-/:<=>?@\\^|~"))))))
+ (1 font-lock-keyword-face) (2 font-lock-type-face))
+
+ ;; extends followed by type
+ (,(rx symbol-start
+ (group "extends")
(1+ space)
(group (or
(and (in "a-zA-Z_")
@@ -414,7 +416,9 @@ Does not continue past limit.
(1+ (in "!#%&*+-/:<=>?@\\^|~")))))
(1 font-lock-keyword-face) (2 font-lock-type-face))
- (,(rx (group "with")
+ ;; with followed by type
+ (,(rx symbol-start
+ (group "with")
(1+ space)
(group (or
(and (in "a-zA-Z_")
@@ -423,7 +427,9 @@ Does not continue past limit.
(1+ (in "!#%&*+-/:<=>?@\\^|~")))))
(1 font-lock-keyword-face) (2 font-lock-type-face))
- (,(rx (group "new")
+ ;; new followed by type
+ (,(rx symbol-start
+ (group "new")
(1+ space)
(group (or
(and (in "a-zA-Z_")
@@ -432,14 +438,24 @@ Does not continue past limit.
(1+ (in "!#%&*+-/:<=>?@\\^|~")))))
(1 font-lock-keyword-face) (2 font-lock-type-face))
- ; uppercase
+ ;; uppercase means a type or object
(,(rx symbol-start
(and (in "A-Z")
(0+ (in "a-zA-Z0-9_"))
(\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~"))))))
- . font-lock-type-face)
+ . font-lock-constant-face)
+ ;; . font-lock-type-face)
+ ; uncomment this to go back to highlighting objects as types
+
+ ;; uppercase
+ (,(rx symbol-start
+ (group
+ (and (in "A-Z")
+ (0+ (in "a-zA-Z0-9_"))
+ (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~")))))))
+ . font-lock-constant-face)
- ; package name
+ ;; package name
(,(rx symbol-start
(group "package")
(1+ space)
- [nongnu] elpa/scala-mode 59cdd94 074/217: Add `scala-indent:use-javadoc-style` defcustom., (continued)
- [nongnu] elpa/scala-mode 59cdd94 074/217: Add `scala-indent:use-javadoc-style` defcustom., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 347faeb 075/217: Add Evan Meagher to contributors list., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 081a92b 081/217: scala-indent:remove-indent-from-previous-empty-line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0fac9ae 014/217: removed debug messages, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 9476d4c 018/217: Fixes #3: alignment of else inside parens, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3f724ed 030/217: Add the scala-indent:pad-equals setting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6257e3b 033/217: Renamed bad-equals to indent-value-expression. Added info to README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 4e3a24f 043/217: Updated Examples.md to reflect issues already solved, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 338ff73 060/217: Changed the indent defaults, closes #19, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6c257f6 057/217: Enhanced support for comments and multi-line strings, including, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 68ca175 056/217: Fixes #20, the cons bug (a :: b :: Nil) as well as improving some of,
ELPA Syncer <=
- [nongnu] elpa/scala-mode 78fff40 039/217: scala-indent:align-forms customization variable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f61e32d 047/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0991658 051/217: Fixes #17: string syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3174f4c 048/217: Update README.md clone to be a valid command., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode a78716d 046/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode ac13b94 061/217: post-self-insert-hooks, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 2201b1c 092/217: Interact nicely with global-font-lock-mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 98d22a5 099/217: Added programming languages to README.md code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 453c012 106/217: fixed bug in string escapes marking, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6116127 042/217: Updated README.md, ELPA Syncer, 2021/08/29