1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

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

Distinguish ternary operator tokens from slash symbol and slash
char literal.
This commit is contained in:
Dmitry Gutov 2013-06-19 02:17:56 +04:00
parent 14dd22d2ce
commit d1bbba4fa5
3 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,9 @@
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.

View File

@ -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"

View File

@ -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