emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 2036be4: Fix Ruby's operator precedence


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 2036be4: Fix Ruby's operator precedence
Date: Wed, 16 Mar 2016 02:33:40 +0000

branch: emacs-25
commit 2036be4666becf02f4524d63595e3da55b14ff0d
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Fix Ruby's operator precedence
    
    * lisp/progmodes/ruby-mode.el (ruby-smie-grammar):
    Rearrange the smie-precs->prec2 form.
---
 lisp/progmodes/ruby-mode.el |   11 ++++++-----
 test/indent/ruby.rb         |   23 ++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index edd89b3..60480d6 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -406,16 +406,17 @@ It is used when `ruby-encoding-magic-comment-style' is 
set to `custom'."
      '((right "=")
        (right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^="
               "<<=" ">>=" "&&=" "||=")
-       (left ".." "...")
-       (left "+" "-")
-       (left "*" "/" "%" "**")
+       (nonassoc ".." "...")
        (left "&&" "||")
-       (left "^" "&" "|")
        (nonassoc "<=>")
-       (nonassoc ">" ">=" "<" "<=")
        (nonassoc "==" "===" "!=")
        (nonassoc "=~" "!~")
+       (nonassoc ">" ">=" "<" "<=")
+       (left "^" "&" "|")
        (left "<<" ">>")
+       (left "+" "-")
+       (left "*" "/" "%")
+       (left "**")
        (assoc "."))))))
 
 (defun ruby-smie--bosp ()
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 85f2708..b038512 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -295,10 +295,31 @@ foo > bar &&
   tee < qux
 
 zux do
-  foo == bar and
+  foo == bar &&
     tee == qux
+
+  a = 3 and
+    b = 4
 end
 
+foo + bar ==
+  tee + qux
+
+1 .. 2 &&
+     3
+
+3 < 4 +
+    5
+
+10 << 4 ^
+  20
+
+100 + 2 >>
+  3
+
+2 ** 10 /
+  2
+
 foo ^
   bar
 



reply via email to

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