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

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

[nongnu] elpa/lua-mode 1a0e191 255/468: lua--rx-symbol: fix shy-grouping


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 1a0e191 255/468: lua--rx-symbol: fix shy-grouping
Date: Thu, 5 Aug 2021 04:58:48 -0400 (EDT)

branch: elpa/lua-mode
commit 1a0e191c9dcd34248d0cab85ff5ca37343714a3f
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    lua--rx-symbol: fix shy-grouping
---
 lua-mode.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index ca6230b..20c8d40 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -114,6 +114,7 @@
 
 (eval-and-compile
   (defvar lua-rx-constituents)
+  (defvar rx-parent)
 
   (defun lua-rx-to-string (form &optional no-group)
     "Lua-specific replacement for `rx-to-string'.
@@ -148,8 +149,15 @@ element is itself expanded with `lua-rx-to-string'. "
       (push form lua-rx-constituents)))
 
   (defun lua--rx-symbol (form)
-    (rx-form `(seq symbol-start (or ,@(cdr form))
-                   symbol-end)))
+    ;; form is a list (symbol XXX ...)
+    ;; Skip initial 'symbol
+    (setq form (cdr form))
+    ;; If there's only one element, take it from the list, otherwise wrap the
+    ;; whole list into `(or XXX ...)' form.
+    (setq form (if (eq 1 (length form))
+                   (car form)
+                 (append '(or) form)))
+    (rx-form `(seq symbol-start ,form symbol-end) rx-parent))
 
   (setq lua-rx-constituents (copy-sequence rx-constituents))
 



reply via email to

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