'((right "=")
(right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^="
"<<=" ">>=" "&&=" "||=")
- (left ".." "...")
- (left "+" "-")
- (left "*" "/" "%" "**")
+ (nonassoc ".." "...")
(left "&&" "||")
- (left "^" "&" "|")
(nonassoc "<=>")
- (nonassoc ">" ">=" "<" "<=")
(nonassoc "==" "===" "!=")
(nonassoc "=~" "!~")
+ (nonassoc ">" ">=" "<" "<=")
+ (left "^" "&" "|")
(left "<<" ">>")
+ (left "+" "-")
+ (left "*" "/" "%")
+ (left "**")
(assoc "."))))))
(defun ruby-smie--bosp ()
(member (save-excursion (ruby-smie--backward-token))
'("iuwu-mod" "and" "or")))
(save-excursion
- (forward-comment 1)
+ (forward-comment (point-max))
(looking-at "&?\\."))))))
(defun ruby-smie--redundant-do-p (&optional skip)
((looking-at "<<")
(cond
((and (ruby-expr-beg 'heredoc)
- (looking-at "<<\\(-\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\(?:\\sw\\|\\s_\\)+\\)"))
+ (looking-at "<<\\([-~]\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\(?:\\sw\\|\\s_\\)+\\)"))
(setq re (regexp-quote (or (match-string 4) (match-string 2))))
(if (match-beginning 1) (setq re (concat "\\s *" re)))
(let* ((id-end (goto-char (match-end 0)))
(goto-char ruby-indent-point)
(beginning-of-line)
(skip-syntax-forward " ")
- (if (looking-at "\\.[^.]")
+ (if (looking-at "\\.[^.]\\|&\\.")
(+ indent ruby-indent-level)
indent))))
(string-to-syntax "'"))))
;; Symbols with special characters.
("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\)\\)"
- (3 (string-to-syntax "_")))
+ (3 (unless (nth 8 (syntax-ppss (match-beginning 3)))
+ (goto-char (match-end 0))
+ (string-to-syntax "_"))))
;; Part of method name when at the end of it.
("[!?]"
(0 (unless (save-excursion
'font-lock-string-face)))
;; Perl-ish keywords.
"\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
- ;; Variables.
+ ;; Singleton objects.
(,(concat ruby-font-lock-keyword-beg-re
"\\_<\\(nil\\|true\\|false\\)\\_>")
1 font-lock-constant-face)
("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
(0 font-lock-builtin-face))
;; Symbols.
- ("\\(^\\|[^:]\\)\\(:@?\\(?:\\w\\|_\\)+\\)\\([!?=]\\)?"
+ ("\\(^\\|[^:]\\)\\(:@\\{0,2\\}\\(?:\\sw\\|\\s_\\)+\\)"
(2 font-lock-constant-face)
(3 (unless (and (eq (char-before (match-end 3)) ?=)
(eq (char-after (match-end 3)) ?>))