emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/scala-mode fe5c2c4 031/217: Fixes #11: was still using the


From: ELPA Syncer
Subject: [nongnu] elpa/scala-mode fe5c2c4 031/217: Fixes #11: was still using the slow regexp, not faster
Date: Sun, 29 Aug 2021 11:30:38 -0400 (EDT)

branch: elpa/scala-mode
commit fe5c2c41131dc64c50930713e0abbd96370f2f30
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>

    Fixes #11: was still using the slow regexp, not faster
---
 scala-mode-fontlock.el | 15 +++++++++------
 scala-mode-syntax.el   | 31 ++++++++++++++-----------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el
index 3e3bbfd..df62187 100644
--- a/scala-mode-fontlock.el
+++ b/scala-mode-fontlock.el
@@ -35,10 +35,11 @@ scala-mode has been reloaded."
       (while (and (not (or (eobp)
                            (looking-at scala-syntax:other-keywords-unsafe-re)
                            (scala-syntax:looking-at-reserved-symbol nil)))
-                  (looking-at scala-syntax:simplePattern-beginning-re))
+                  (scala-syntax:looking-at-simplePattern-beginning))
 ;        (message "- now at %d" (point))
         (if (= (char-after) ?\()
             (forward-list)
+          ;; else
           (goto-char (match-end 0))
           (scala-syntax:skip-forward-ignorable)
 ;          (message "+ now at %d" (point))
@@ -48,20 +49,22 @@ scala-mode has been reloaded."
                  (goto-char (match-end 0)))
                 ((or (scala-syntax:looking-at-reserved-symbol nil)
                      (looking-at scala-syntax:other-keywords-unsafe-re))
-                 (messssage "saw reserved symbol or keyword"))
+;                 (messssage "saw reserved symbol or keyword"))
                 ((looking-at scala-syntax:id-re)
 ;                 (message "saw id-re %d" (match-beginning 0))
                  (goto-char (match-end 0)))
 ;                (t
 ;                 (message "nothing special here %s" (point)))
-                ))
+                )))
         (scala-syntax:skip-forward-ignorable)))
+;    (message "limit at %s" (point))
     (point)))
 
 (defun scala-font-lock:limit-pattern2-list (&optional start)
   (let ((limit (scala-font-lock:limit-pattern2 start)))
     (while (= (char-after limit) ?,)
       (setq limit (scala-font-lock:limit-pattern2 (1+ limit))))
+;    (message "list limit at %s" limit)
     limit))
 
 (defun scala-font-lock:mark-pattern1-part (&optional limit pattern-p)
@@ -84,7 +87,7 @@ Does not continue past limit.
    ;; quit if we are past limit
    ((or (and limit (>= (point) limit))
         (eobp))
-;    (message "limit")
+;    (message "at limit %s" (point))
     nil)
    ;; Type pattern, just skip the whole thing. It will end at ',' or ')'.
    ;; Note: forms starting with ':' are handled by a completely separete
@@ -183,9 +186,9 @@ Does not continue past limit.
     (set-match-data nil)
     t)
    ;; none of the above, just stop
-;   (t 
+   (t 
 ;    (message "Cannot continue Pattern1 at %d" (point)) 
-;    nil)
+    nil)
 ))
 
 (defun scala-font-lock:limit-pattern (&optional start)
diff --git a/scala-mode-syntax.el b/scala-mode-syntax.el
index d42f21a..665741a 100644
--- a/scala-mode-syntax.el
+++ b/scala-mode-syntax.el
@@ -139,17 +139,16 @@
 
 ;; Paths (Chapter 3.1)
 ;; emacs has a problem with these regex, don't use them
-(defconst scala-syntax:classQualifier-re (concat "[[]" scala-syntax:id-re 
"[]]"))
-(defconst scala-syntax:stableId-re 
-  (concat "\\(\\(" "this"
-          "\\|" "super" scala-syntax:classQualifier-re 
-          "\\|" scala-syntax:id-re 
-          "\\)\\.\\)*"
-          scala-syntax:id-re))
-(defconst scala-syntax:path-re
-  (concat "\\(" scala-syntax:stableId-re
-          "\\|" "\\(" scala-syntax:id-re "\\." "\\)?" "this" "\\)"))
-
+;; (defconst scala-syntax:classQualifier-re (concat "[[]" scala-syntax:id-re 
"[]]"))
+;; (defconst scala-syntax:stableId-re 
+;;   (concat "\\(\\(" "this"
+;;           "\\|" "super" scala-syntax:classQualifier-re 
+;;           "\\|" scala-syntax:id-re 
+;;           "\\)\\.\\)*"
+;;           scala-syntax:id-re))
+;; (defconst scala-syntax:path-re
+;;   (concat "\\(" scala-syntax:stableId-re
+;;           "\\|" "\\(" scala-syntax:id-re "\\." "\\)?" "this" "\\)"))
 
 (defun scala-syntax:looking-at-super ()
   (save-excursion
@@ -196,12 +195,10 @@
              (set-match-data `(,beg ,(match-end 0)))
              (point))))))
 
-;; Patterns
-(defconst scala-syntax:simplePattern-beginning-re 
-  (concat "\\([_(]"
-          "\\|" scala-syntax:literal-re
-          "\\|" scala-syntax:stableId-re
-          "\\)"))
+(defun scala-syntax:looking-at-simplePattern-beginning ()
+  (or (looking-at "[_(]")
+      (looking-at scala-syntax:literal-re)
+      (scala-syntax:looking-at-stableIdOrPath)))
 
 ;;;
 ;;; Other regular expressions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]