Do not mistake colon at the end of regexp for slash symbol
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): Check the parse state in the "Symbols with special characters" rule (bug#23515).
This commit is contained in:
parent
4c5a00b09f
commit
1a5a05cf6f
2 changed files with 6 additions and 1 deletions
|
@ -1858,7 +1858,9 @@ It will be properly highlighted even when the call omits parens.")
|
||||||
(string-to-syntax "'"))))
|
(string-to-syntax "'"))))
|
||||||
;; Symbols with special characters.
|
;; 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.
|
;; Part of method name when at the end of it.
|
||||||
("[!?]"
|
("[!?]"
|
||||||
(0 (unless (save-excursion
|
(0 (unless (save-excursion
|
||||||
|
|
|
@ -146,6 +146,9 @@ VALUES-PLIST is a list with alternating index and value elements."
|
||||||
(ert-deftest ruby-slash-char-literal-is-not-mistaken-for-regexp ()
|
(ert-deftest ruby-slash-char-literal-is-not-mistaken-for-regexp ()
|
||||||
(ruby-assert-state "?/" 3 nil))
|
(ruby-assert-state "?/" 3 nil))
|
||||||
|
|
||||||
|
(ert-deftest ruby-regexp-is-not-mistaken-for-slash-symbol ()
|
||||||
|
(ruby-assert-state "x = /foo:/" 3 nil))
|
||||||
|
|
||||||
(ert-deftest ruby-indent-simple ()
|
(ert-deftest ruby-indent-simple ()
|
||||||
(ruby-should-indent-buffer
|
(ruby-should-indent-buffer
|
||||||
"if foo
|
"if foo
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue