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

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

[nongnu] elpa/lua-mode acd0c55 354/468: Revert to using group-n in lua--


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode acd0c55 354/468: Revert to using group-n in lua--left-shifter-regexp
Date: Thu, 5 Aug 2021 04:59:08 -0400 (EDT)

branch: elpa/lua-mode
commit acd0c5541928e40e1cd9a715b97f5a4ec42f4367
Author: Reuben Thomas <rrt@sc3d.org>
Commit: Reuben Thomas <rrt@sc3d.org>

    Revert to using group-n in lua--left-shifter-regexp
    
    Resurrect code from commit 8d283426 now we require Emacs >= 24.3. There are
    other places where group-n could be used, but no past code to simply
    reapply, so more care and thought would be required for those cases!
---
 lua-mode.el | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index a7b4b27..ebe6ea2 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1447,25 +1447,19 @@ one."
      ;; This regexp should answer the following questions:
      ;; 1. is there a left shifter regexp on that line?
      ;; 2. where does block-open token of that left shifter reside?
-     ;;
-     ;; NOTE: couldn't use `group-n' keyword of `rx' macro, because it was
-     ;; introduced in Emacs 24.2 only, so for the sake of code clarity the 
named
-     ;; groups don't really match anything, they just report the position of 
the
-     ;; match.
-     (or (seq (regexp "\\_<local[ \t]+") (regexp "\\(?1:\\)function\\_>"))
-         (seq (eval lua--function-name-rx) (* blank) (regexp "\\(?1:\\)[{(]"))
-         (seq (or
-               ;; assignment statement prefix
-               (seq (* nonl) (not (any "<=>~")) "=" (* blank))
-               ;; return statement prefix
-               (seq word-start "return" word-end (* blank)))
-              (regexp "\\(?1:\\)")
+     (or (seq (group-n 1 symbol-start "local" (+ blank)) "function" symbol-end)
+
+         (seq (group-n 1 (eval lua--function-name-rx) (* blank)) (any "{("))
+         (seq (group-n 1 (or
+                          ;; assignment statement prefix
+                          (seq (* nonl) (not (any "<=>~")) "=" (* blank))
+                          ;; return statement prefix
+                          (seq word-start "return" word-end (* blank))))
               ;; right hand side
               (or "{"
                   "function"
-                  (seq
-                   (eval lua--function-name-rx) (* blank)
-                   (regexp "\\(?1:\\)") (any "({")))))))
+                  (seq (group-n 1 (eval lua--function-name-rx) (* blank))
+                       (any "({")))))))
 
   "Regular expression that matches left-shifter expression.
 



reply via email to

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