* misc/ruby-mode.el (ruby-expr-beg, ruby-in-here-doc-p): tell

singleton class definitions from here documents.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-02-07 15:56:34 +00:00
Родитель 360e0b93fd
Коммит 5f3e191f95
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -1,4 +1,7 @@
Tue Feb 8 00:53:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
Tue Feb 8 00:56:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* misc/ruby-mode.el (ruby-expr-beg, ruby-in-here-doc-p): tell
singleton class definitions from here documents.
* misc/ruby-mode.el (ruby-expr-beg, ruby-parse-partial): keyword
followed by colon is label.

Просмотреть файл

@ -438,6 +438,12 @@ The variable ruby-indent-level controls the amount of indentation.
((and (eq c ?:) (or (not b) (eq (char-syntax b) ? ))))
((eq c ?\\) (eq b ??)))))
(defun ruby-singleton-class-p ()
(save-excursion
(forward-word -1)
(and (or (bolp) (not (eq (char-before (point)) ?_)))
(looking-at "class\\s *<<"))))
(defun ruby-expr-beg (&optional option)
(save-excursion
(store-match-data nil)
@ -451,7 +457,9 @@ The variable ruby-indent-level controls the amount of indentation.
(or (eq (char-syntax (char-before (point))) ?w)
(ruby-special-char-p))))
nil)
((and (eq option 'heredoc) (< space 0)) t)
((and (progn (goto-char start) (eq option 'heredoc))
(not (ruby-singleton-class-p)))
t)
((or (looking-at ruby-operator-re)
(looking-at "[\\[({,;]")
(and (looking-at "[!?]")
@ -1229,7 +1237,8 @@ balanced expression is found."
(let ((old-point (point)) (case-fold-search nil))
(beginning-of-line)
(catch 'found-beg
(while (re-search-backward ruby-here-doc-beg-re nil t)
(while (and (re-search-backward ruby-here-doc-beg-re nil t)
(not (ruby-singleton-class-p)))
(if (not (or (ruby-in-ppss-context-p 'anything)
(ruby-here-doc-find-end old-point)))
(throw 'found-beg t)))))))