[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 64c496a 016/217: Fixed #4: numbers in ids
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 64c496a 016/217: Fixed #4: numbers in ids |
Date: |
Sun, 29 Aug 2021 11:30:35 -0400 (EDT) |
branch: elpa/scala-mode
commit 64c496a7152a088850baa0ff1acd1d0d3a7b2e6a
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Fixed #4: numbers in ids
---
scala-mode-fontlock.el | 20 ++++++++++++++++++--
scala-mode-syntax.el | 12 ++++++++----
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el
index ddf6849..3e3bbfd 100644
--- a/scala-mode-fontlock.el
+++ b/scala-mode-fontlock.el
@@ -295,6 +295,22 @@ Does not continue past limit.
(let ((state (syntax-ppss (match-beginning 0))))
(goto-char (match-end 0))
(= (nth 3 state) ?\"))))
+
+(defun scala-font-lock:mark-numberLiteral (re limit)
+ (when (re-search-forward re limit t)
+ (goto-char (match-beginning 0))
+ (when (or (bolp) (string-match-p scala-syntax:number-safe-start-re (string
(char-before))))
+ (goto-char (match-end 0)))))
+
+(defun scala-font-lock:mark-floatingPointLiteral (limit)
+ (scala-font-lock:mark-numberLiteral
+ scala-syntax:floatingPointLiteral-re
+ limit))
+
+(defun scala-font-lock:mark-integerLiteral (limit)
+ (scala-font-lock:mark-numberLiteral
+ scala-syntax:integerLiteral-re
+ limit))
(defun scala-font-lock:keywords ()
;; chars, string, comments are handled acording to syntax and
@@ -424,7 +440,7 @@ Does not continue past limit.
(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)
+ (scala-font-lock:mark-floatingPointLiteral . font-lock-constant-face)
+ (scala-font-lock:mark-integerLiteral . font-lock-constant-face)
))
diff --git a/scala-mode-syntax.el b/scala-mode-syntax.el
index 575b457..1e83cd6 100644
--- a/scala-mode-syntax.el
+++ b/scala-mode-syntax.el
@@ -51,10 +51,11 @@
(defconst scala-syntax:hexNumeral-re (concat "0x[" scala-syntax:hexDigit-group
"]+"))
(defconst scala-syntax:octalNumeral-re (concat "0["
scala-syntax:octalDigit-group "]+"))
(defconst scala-syntax:integerLiteral-re (concat "-?" ;; added from definition
of literal
- "\\(" scala-syntax:decimalNumeral-re
- "\\|" scala-syntax:hexNumeral-re
- "\\|" scala-syntax:octalNumeral-re
- "\\)[Ll]?"))
+ "\\("
scala-syntax:decimalNumeral-re
+ "\\|"
scala-syntax:hexNumeral-re
+ "\\|"
scala-syntax:octalNumeral-re
+ "\\)[Ll]?"))
+
;; Floating Point Literal (Chapter 1.3.2)
(defconst scala-syntax:exponentPart-re (concat "\\([eE][+-]?["
scala-syntax:digit-group "]+\\)"))
@@ -68,6 +69,9 @@
"\\|" "[" scala-syntax:digit-group "]+" scala-syntax:exponentPart-re
"\\|" "[" scala-syntax:digit-group "]+" scala-syntax:floatType-re
"\\)"))
+(defconst scala-syntax:number-safe-start-re
+ (concat "[^_" scala-syntax:letter-group "]"))
+
;; Boolean Literals (Chapter 1.3.3)
(defconst scala-syntax:booleanLiteral-re "true|false")
- [nongnu] elpa/scala-mode f0cc3d4 006/217: working on indent rules, (continued)
- [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, 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 <=
- [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
- [nongnu] elpa/scala-mode da67179 050/217: Merge pull request #15 from non/bug/fix-annotations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 95e3742 063/217: fix typo in readme, ELPA Syncer, 2021/08/29