[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 4dbaa5f 010/217: picked some of Erik's fontlock
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 4dbaa5f 010/217: picked some of Erik's fontlock magic for an interim solution |
Date: |
Sun, 29 Aug 2021 11:30:34 -0400 (EDT) |
branch: elpa/scala-mode
commit 4dbaa5fa6c4d846ae3dd8cf2030ca164ecf11dc9
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
picked some of Erik's fontlock magic for an interim solution
---
README | 8 ++++-
scala-mode-fontlock.el | 89 ++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 82 insertions(+), 15 deletions(-)
diff --git a/README b/README
index 1988df1..d6c9caf 100644
--- a/README
+++ b/README
@@ -12,6 +12,12 @@ The mode will target scala code written in a functinal style.
Check out Example.scala to see how it indents.
+Special thanks for valuable feedback:
+- Eiríkr Åsheim (aka Erik Osheim)
+
TODO:
+- indent scaladoc left margin correctly
- indenting a row removes trailing whitespace and converts tabs to spaces
-
+- highlight number (decimal, octal, hex, double, float) literals as constants
+- indent and fill multi-line strings with margin correctly
+- high-light headings and annotations inside scaladoc specially (use underline
for headings)
diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el
index dd112f3..0d2815e 100644
--- a/scala-mode-fontlock.el
+++ b/scala-mode-fontlock.el
@@ -305,6 +305,10 @@ Does not continue past limit.
(,scala-syntax:value-keywords-re 2 font-lock-constant-face)
(,scala-syntax:path-keywords-re 2 font-lock-keyword-face)
+ ;; number literals
+ (,scala-syntax:floatingPointLiteral-re . font-lock-constant-face)
+ (,scala-syntax:integerLiteral-re . font-lock-constant-face)
+
;; User defined constants
(,(scala-font-lock:create-user-constant-re) 0 font-lock-constant-face)
@@ -329,20 +333,20 @@ Does not continue past limit.
"\\)")
2 font-lock-type-face)
- ;; extends, with, new
- (,(concat "\\<\\(extends\\|with\\|new\\)[ \t]+\\([("
- scala-syntax:id-first-char-group "]\\)")
- (scala-font-lock:mark-simpleType (scala-font-lock:limit-simpleType
- (goto-char (match-beginning 2)))
- nil
- (0 font-lock-type-face nil t)))
-
- ;; ':'
- (,scala-syntax:colon-re
- (scala-font-lock:mark-simpleType (scala-font-lock:limit-simpleType
- (goto-char (match-end 2)))
- nil
- (0 font-lock-type-face nil t)))
+ ;; ;; extends, with, new
+ ;; (,(concat "\\<\\(extends\\|with\\|new\\)[ \t]+\\([("
+ ;; scala-syntax:id-first-char-group "]\\)")
+ ;; (scala-font-lock:mark-simpleType (scala-font-lock:limit-simpleType
+ ;; (goto-char (match-beginning 2)))
+ ;; nil
+ ;; (0 font-lock-type-face nil t)))
+
+ ;; ;; ':'
+ ;; (,scala-syntax:colon-re
+ ;; (scala-font-lock:mark-simpleType (scala-font-lock:limit-simpleType
+ ;; (goto-char (match-end 2)))
+ ;; nil
+ ;; (0 font-lock-type-face nil t)))
;; def
(,(concat "\\<def[ \t]+\\(" scala-syntax:id-re "\\)") 1
font-lock-function-name-face)
@@ -364,5 +368,62 @@ Does not continue past limit.
(1 font-lock-variable-name-face nil t)
(2 font-lock-constant-face nil t)
(3 font-lock-type-face nil t)))
+
+ ;; Some patterns from Erik
+ (,(rx "@" (in "a-zA-Z_") (0+ (in "a-zA-Z0-9_")))
+ . font-lock-preprocessor-face)
+
+ ;; :
+ (,(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")
+ (1+ space)
+ (group (or
+ (and (in "a-zA-Z_")
+ (0+ (in "a-zA-Z0-9_"))
+ (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (1 font-lock-keyword-face) (2 font-lock-type-face))
+
+ (,(rx (group "with")
+ (1+ space)
+ (group (or
+ (and (in "a-zA-Z_")
+ (0+ (in "a-zA-Z0-9_"))
+ (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (1 font-lock-keyword-face) (2 font-lock-type-face))
+
+ (,(rx (group "new")
+ (1+ space)
+ (group (or
+ (and (in "a-zA-Z_")
+ (0+ (in "a-zA-Z0-9_"))
+ (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (1+ (in "!#%&*+-/:<=>?@\\^|~")))))
+ (1 font-lock-keyword-face) (2 font-lock-type-face))
+
+ ; uppercase
+ (,(rx symbol-start
+ (and (in "A-Z")
+ (0+ (in "a-zA-Z0-9_"))
+ (\? (and "_" (1+ (in "!#%&*+-/:<=>?@\\^|~"))))))
+ . font-lock-type-face)
+
+ ; package name
+ (,(rx symbol-start
+ (group "package")
+ (1+ space)
+ (group (and (in "a-zA-Z_.") (0+ (in "a-zA-Z0-9_.")))))
+ (1 font-lock-keyword-face) (2 font-lock-string-face))
+
+
))
- [nongnu] branch elpa/scala-mode created (now 598cb68), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 5ba0a78 005/217: run-on and list indent primitives, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode ca7308a 002/217: Initial commit with README and Example.scala outlining how it will work, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode a8b0936 003/217: Working on syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6f1b748 001/217: Example.scala to show how we intend to indent, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3413883 004/217: run-on-p, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f0cc3d4 006/217: working on indent rules, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f17fa95 007/217: approaching a functioning indent engine, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 4dbaa5f 010/217: picked some of Erik's fontlock magic for an interim solution,
ELPA Syncer <=
- [nongnu] elpa/scala-mode 84e5c8a 013/217: regression fix, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode aebc5b0 017/217: Fixes #7: indenting of block lines when at last char of buffer, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode c3ea76f 009/217: fixed indenting of if body (and probably other things), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode ba3c9ca 020/217: renamed README to README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 9f74c7d 015/217: Partial fix to #5., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 84d9c10 011/217: highlight string escapes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 150e3d2 012/217: updated README with some TODOs, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 64c496a 016/217: Fixed #4: numbers in ids, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6bc98fd 024/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode b0c821d 023/217: Working on README, ELPA Syncer, 2021/08/29