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

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

[elpa] externals/ruby-end 4498561af6 19/91: Split all keywords to modifi


From: ELPA Syncer
Subject: [elpa] externals/ruby-end 4498561af6 19/91: Split all keywords to modifiers and non-modifiers
Date: Wed, 25 Jan 2023 19:58:25 -0500 (EST)

branch: externals/ruby-end
commit 4498561af63061c3c8627e85273f41b8e2621277
Author: Roman Sokolov <sokolov.r.v@gmail.com>
Commit: Roman Sokolov <sokolov.r.v@gmail.com>

    Split all keywords to modifiers and non-modifiers
    
    According to ruby grammar [1] there are 4 statement modifiers, so
    there is no need to prevent for all other keywords.
    
    [1] -- http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/yacc.html
---
 ruby-end.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ruby-end.el b/ruby-end.el
index adcb03e4b6..d6c52c02c6 100644
--- a/ruby-end.el
+++ b/ruby-end.el
@@ -61,8 +61,8 @@
   :type 'boolean
   :group 'ruby)
 
-(defconst ruby-end-expand-postfix-statement-before-re
-  
"\\(?:def\\|if\\|class\\|module\\|unless\\|case\\|while\\|until\\|for\\|begin\\)"
+(defconst ruby-end-expand-postfix-modifiers-before-re
+  "\\(?:if\\|unless\\|while\\)"
   "Regular expression matching statements before point.")
 
 (defconst ruby-end-expand-prefix-check-modifiers-re
@@ -73,8 +73,8 @@
   "\\(?:^\\|\\s-+\\)"
   "Prefix for regular expression")
 
-(defconst ruby-end-expand-block-before-re
-  "\\(?:^\\|\\s-+\\)do"
+(defconst ruby-end-expand-keywords-before-re
+  "\\(?:^\\|\\s-+\\)\\(?:do\\|def\\|class\\|module\\|case\\|for\\|begin\\)"
   "Regular expression matching blocks before point.")
 
 
@@ -110,17 +110,17 @@
 
 (defun ruby-end-expand-p ()
   "Checks if expansion (insertion of end) should be done."
-  (let ((ruby-end-expand-statement-before-re
+  (let ((ruby-end-expand-statement-modifiers-before-re
         (concat
          (if ruby-end-check-statement-modifiers
              ruby-end-expand-prefix-check-modifiers-re
              ruby-end-expand-prefix-re)
-         ruby-end-expand-postfix-statement-before-re)))
+         ruby-end-expand-postfix-modifiers-before-re)))
     (and
      (ruby-end-code-at-point-p)
      (or
-      (looking-back ruby-end-expand-statement-before-re)
-      (looking-back ruby-end-expand-block-before-re))
+      (looking-back ruby-end-expand-statement-modifiers-before-re)
+      (looking-back ruby-end-expand-keywords-before-re))
      (looking-at ruby-end-expand-after-re))))
 
 (defun ruby-end-code-at-point-p ()



reply via email to

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