[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 84d9c10 011/217: highlight string escapes
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 84d9c10 011/217: highlight string escapes |
Date: |
Sun, 29 Aug 2021 11:30:34 -0400 (EDT) |
branch: elpa/scala-mode
commit 84d9c10c23f7dc30d3e359f3019d93d1c997db4a
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
highlight string escapes
---
scala-mode-fontlock.el | 16 +++++++++++-----
scala-mode-syntax.el | 7 +++++--
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el
index 0d2815e..8c35dcd 100644
--- a/scala-mode-fontlock.el
+++ b/scala-mode-fontlock.el
@@ -295,6 +295,11 @@ Does not continue past limit.
(message "limit %d" (scala-font-lock:limit-simpleType (point)))
(message "mark from %d: %s at %d" (point) (scala-font-lock:mark-simpleType)
(point)))
+
+(defun scala-font-lock:mark-string-escapes (limit)
+ (when (re-search-forward scala-syntax:string-escape-re limit)
+ (let ((state (syntax-ppss (match-beginning 0))))
+ (= (nth 3 state) ?\"))))
(defun scala-font-lock:keywords ()
;; chars, string, comments are handled acording to syntax and
@@ -305,10 +310,6 @@ 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)
@@ -321,6 +322,9 @@ Does not continue past limit.
;; underscore
(scala-font-lock:mark-underscore 2 font-lock-keyword-face)
+ ;; escapes inside strings
+ (scala-font-lock:mark-string-escapes (0 font-lock-constant-face prepend
nil))
+
;; object
(,(concat "\\<object[ \t]+\\("
scala-syntax:id-re
@@ -424,6 +428,8 @@ Does not continue past limit.
(group (and (in "a-zA-Z_.") (0+ (in "a-zA-Z0-9_.")))))
(1 font-lock-keyword-face) (2 font-lock-string-face))
-
+ ;; number literals (have to be here so that other rules take precedence)
+ (,scala-syntax:floatingPointLiteral-re . font-lock-constant-face)
+ (,scala-syntax:integerLiteral-re . font-lock-constant-face)
))
diff --git a/scala-mode-syntax.el b/scala-mode-syntax.el
index 1313f7b..575b457 100644
--- a/scala-mode-syntax.el
+++ b/scala-mode-syntax.el
@@ -80,11 +80,14 @@
"\\|" scala-syntax:escapeSequence-re
"\\|" scala-syntax:UnicodeEscape-re "\\)\\('\\)"))
+(defconst scala-syntax:string-escape-re
+ (concat scala-syntax:escapeSequence-re
+ "\\|" scala-syntax:UnicodeEscape-re))
+
;; String Literals (Chapter 1.3.5)
(defconst scala-syntax:stringElement-re
(concat "\\(" "[^\n\"\\\\\]"
- "\\|" scala-syntax:escapeSequence-re
- "\\|" scala-syntax:UnicodeEscape-re "\\)"))
+ "\\|" scala-syntax:string-escape-re "\\)"))
(defconst scala-syntax:oneLineStringLiteral-re (concat "\\(\"\\)"
scala-syntax:stringElement-re "*\\(\"\\)"))
(defconst scala-syntax:multiLineStringLiteral-re
"\\(\"\\)\\(\"\"\\(\"?\"?[^\"]\\)*\"\"+\\)\\(\"\\)")
- [nongnu] elpa/scala-mode 6f1b748 001/217: Example.scala to show how we intend to indent, (continued)
- [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, 2021/08/29
- [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 <=
- [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
- [nongnu] elpa/scala-mode 7faea31 027/217: also handle .sbt files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0930f14 026/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 2527376 032/217: Merge pull request #12 from non/topic/optional-padding, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6aeb341 034/217: Edited README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode bd0cd1a 035/217: Examples.md contains discussion on indenting, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 35f3eef 036/217: Fixes #10, if body in parameter lists, ELPA Syncer, 2021/08/29