Commit d1bbba4f authored by Dmitry Gutov's avatar Dmitry Gutov
Browse files

* lisp/progmodes/ruby-mode.el (ruby-syntax-before-regexp-re):

Distinguish ternary operator tokens from slash symbol and slash
char literal.
parent 14dd22d2
2013-06-18 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el (ruby-syntax-before-regexp-re):
Distinguish ternary operator tokens from slash symbol and slash
char literal.
2013-06-18 Juanma Barranquero <lekktu@gmail.com>
Convert symbol prettification into minor mode and global minor mode.
......
......@@ -1368,7 +1368,10 @@ It will be properly highlighted even when the call omits parens.")
(defvar ruby-syntax-before-regexp-re
(concat
;; Special tokens that can't be followed by a division operator.
"\\(^\\|[[=(,~?:;<>]"
"\\(^\\|[[=(,~;<>]"
;; Distinguish ternary operator tokens.
;; FIXME: They don't really have to be separated with spaces.
"\\|[?:] "
;; Control flow keywords and operators following bol or whitespace.
"\\|\\(?:^\\|\\s \\)"
(regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and"
......
......@@ -124,6 +124,12 @@ VALUES-PLIST is a list with alternating index and value elements."
(ert-deftest ruby-regexp-can-be-multiline ()
(ruby-assert-state "/bars\ntees # toots \nfoos/" 3 nil))
(ert-deftest ruby-slash-symbol-is-not-mistaken-for-regexp ()
(ruby-assert-state ":/" 3 nil))
(ert-deftest ruby-slash-char-literal-is-not-mistaken-for-regexp ()
(ruby-assert-state "?/" 3 nil))
(ert-deftest ruby-indent-simple ()
(ruby-should-indent-buffer
"if foo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment