+2013-03-06 Dmitry Gutov <dgutov@yandex.ru>
+
+ * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
+ propertize regexp when not inside a string (Bug#13885).
+
2013-03-06 Alan Mackenzie <acm@muc.de>
Correct the position of point in some line-up functions.
"\\)\\s *"
;; The regular expression itself.
"\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)")
- (2 (string-to-syntax "\"/"))
- (3 (string-to-syntax "\"/")))
+ (3 (unless (nth 3 (syntax-ppss (match-beginning 2)))
+ (put-text-property (match-beginning 2) (match-end 2)
+ 'syntax-table (string-to-syntax "\"/"))
+ (string-to-syntax "\"/"))))
("^=en\\(d\\)\\_>" (1 "!"))
("^\\(=\\)begin\\_>" (1 "!"))
;; Handle here documents.
(defun ruby-test-string (s &rest args)
(apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args))
-(defun ruby-assert-state (content &rest values-plist)
+(defun ruby-assert-state (content index value &optional point)
"Assert syntax state values at the end of CONTENT.
VALUES-PLIST is a list with alternating index and value elements."
(ruby-with-temp-buffer content
+ (when point (goto-char point))
(syntax-propertize (point))
- (while values-plist
- (should (eq (nth (car values-plist)
- (parse-partial-sexp (point-min) (point)))
- (cadr values-plist)))
- (setq values-plist (cddr values-plist)))))
+ (should (eq (nth index
+ (parse-partial-sexp (point-min) (point)))
+ value))))
(defun ruby-assert-face (content pos face)
(ruby-with-temp-buffer content
(ruby-should-indent "a = %w[abc\n def]\n " 0)
(ruby-should-indent "a = \"abc\n def\"\n " 0))
+(ert-deftest ruby-regexp-doest-start-in-string ()
+ (ruby-assert-state "'(/', /\d+/" 3 nil))
+
+(ert-deftest ruby-regexp-starts-after-string ()
+ (ruby-assert-state "'(/', /\d+/" 3 ?/ 8))
+
(ert-deftest ruby-indent-simple ()
(ruby-should-indent-buffer
"if foo