]> code.delx.au - gnu-emacs/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function):
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 5 May 2014 23:18:18 +0000 (03:18 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 5 May 2014 23:18:18 +0000 (03:18 +0400)
Backtrack one char if the global/char-literal var matcher hits
inside a string.  The next char could be the beginning of an
expression expansion.

* test/automated/ruby-mode-tests.el
(ruby-interpolation-after-dollar-sign): New test.

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

index 3bbacb85e979599dc63dff39113fcf5863978ea1..7c838a61fe57bb68c22a19b191347f3af8ec044d 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-05  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-syntax-propertize-function):
+       Backtrack one char if the global/char-literal var matcher hits
+       inside a string.  The next char could be the beginning of an
+       expression expansion.
+
 2014-05-05  Glenn Morris  <rgm@gnu.org>
 
        * help-fns.el (describe-function-1): Test for an autoload before a
index 912736707efd712ad3f2f23bd5ffe87f4931cd2e..74edf7a680f341a735f99e406308daf71614e114 100644 (file)
@@ -1804,9 +1804,10 @@ It will be properly highlighted even when the call omits parens.")
       ;; $' $" $` .... are variables.
       ;; ?' ?" ?` are character literals (one-char strings in 1.9+).
       ("\\([?$]\\)[#\"'`]"
-       (1 (unless (save-excursion
-                    ;; Not within a string.
-                    (nth 3 (syntax-ppss (match-beginning 0))))
+       (1 (if (save-excursion
+                (nth 3 (syntax-ppss (match-beginning 0))))
+              ;; Within a string, skip.
+              (goto-char (match-end 1))
             (string-to-syntax "\\"))))
       ;; Part of symbol when at the end of a method name.
       ("[!?]"
index a02b8e80395c320fec2d5959f2dc2dd2ed473618..0a3e89e73851a5f43de84f861c5771542632a665 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-05  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * automated/ruby-mode-tests.el
+       (ruby-interpolation-after-dollar-sign): New test.
+
 2014-05-05  Glenn Morris  <rgm@gnu.org>
 
        * automated/help-fns.el: New file.
index f6fddb5ef4cfd036548bb50c038a0cb7dc95d023..0ad5650cd7719dffc93a269b780622ef91d9c2de 100644 (file)
@@ -452,6 +452,10 @@ VALUES-PLIST is a list with alternating index and value elements."
   (ruby-assert-face "%w{foo #@bar}" 8 font-lock-string-face)
   (ruby-assert-face "%s{foo #@bar}" 8 font-lock-string-face))
 
+(ert-deftest ruby-interpolation-after-dollar-sign ()
+  (ruby-assert-face "\"$#{balance}\"" 2 'font-lock-string-face)
+  (ruby-assert-face "\"$#{balance}\"" 3 'font-lock-variable-name-face))
+
 (ert-deftest ruby-no-unknown-percent-literals ()
   ;; No folding of case.
   (ruby-assert-face "%S{foo}" 4 nil)