Distinguish ternary operator tokens from slash symbol and slash
char literal.
+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.
(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"
(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