Fix Ruby's operator precedence
* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Rearrange the smie-precs->prec2 form.
This commit is contained in:
parent
1d686c2afb
commit
2036be4666
2 changed files with 28 additions and 6 deletions
|
@ -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 ()
|
||||
|
|
|
@ -295,10 +295,31 @@ def begin
|
|||
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue