* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 30 Jun 2013 02:23:10 +0000 (06:23 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 30 Jun 2013 02:23:10 +0000 (06:23 +0400)
start heredoc inside a string or comment.

lisp/ChangeLog
lisp/progmodes/ruby-mode.el
test/automated/ruby-mode-tests.el

index 0506a68..aa2b350 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-30  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't
+       start heredoc inside a string or comment.
+
 2013-06-29  Eli Zaretskii  <eliz@gnu.org>
 
        * bindings.el (visual-order-cursor-movement): New defcustom.
index ab5634e..0292e40 100644 (file)
@@ -1422,7 +1422,9 @@ It will be properly highlighted even when the call omits parens.")
             ("^\\(=\\)begin\\_>" (1 "!"))
             ;; Handle here documents.
             ((concat ruby-here-doc-beg-re ".*\\(\n\\)")
-             (7 (unless (ruby-singleton-class-p (match-beginning 0))
+             (7 (unless (or (nth 8 (save-excursion
+                                     (syntax-ppss (match-beginning 0))))
+                            (ruby-singleton-class-p (match-beginning 0)))
                   (put-text-property (match-beginning 7) (match-end 7)
                                      'syntax-table (string-to-syntax "\""))
                   (ruby-syntax-propertize-heredoc end))))
index ad13d01..a18899d 100644 (file)
@@ -87,6 +87,9 @@ VALUES-PLIST is a list with alternating index and value elements."
 (ert-deftest ruby-heredoc-highlights-interpolations ()
   (ruby-assert-face "s = <<EOS\n  #{foo}\nEOS" 15 font-lock-variable-name-face))
 
+(ert-deftest ruby-no-heredoc-inside-quotes ()
+  (ruby-assert-state "\"<<\", \"\",\nfoo" 3 nil))
+
 (ert-deftest ruby-deep-indent ()
   (let ((ruby-deep-arglist nil)
         (ruby-deep-indent-paren '(?\( ?\{ ?\[ ?\] t)))