diff options
| author | Dmitry Gutov | 2013-06-19 02:17:56 +0400 |
|---|---|---|
| committer | Dmitry Gutov | 2013-06-19 02:17:56 +0400 |
| commit | d1bbba4fa5de77c3bdfb01901b697ead748a4ba6 (patch) | |
| tree | 6df0d8ba9fae9ff9940f523565d4260c4d5a7c92 | |
| parent | 14dd22d2cedad0e1babcce0fea868a0c01294fa2 (diff) | |
| download | emacs-d1bbba4fa5de77c3bdfb01901b697ead748a4ba6.tar.gz emacs-d1bbba4fa5de77c3bdfb01901b697ead748a4ba6.zip | |
* lisp/progmodes/ruby-mode.el (ruby-syntax-before-regexp-re):
Distinguish ternary operator tokens from slash symbol and slash
char literal.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 5 | ||||
| -rw-r--r-- | test/automated/ruby-mode-tests.el | 6 |
3 files changed, 16 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 44d8a2a82bd..ce507cfff9f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-06-18 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * progmodes/ruby-mode.el (ruby-syntax-before-regexp-re): | ||
| 4 | Distinguish ternary operator tokens from slash symbol and slash | ||
| 5 | char literal. | ||
| 6 | |||
| 1 | 2013-06-18 Juanma Barranquero <lekktu@gmail.com> | 7 | 2013-06-18 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | Convert symbol prettification into minor mode and global minor mode. | 9 | Convert symbol prettification into minor mode and global minor mode. |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index fa4efe49b7b..8a1548bc940 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -1368,7 +1368,10 @@ It will be properly highlighted even when the call omits parens.") | |||
| 1368 | (defvar ruby-syntax-before-regexp-re | 1368 | (defvar ruby-syntax-before-regexp-re |
| 1369 | (concat | 1369 | (concat |
| 1370 | ;; Special tokens that can't be followed by a division operator. | 1370 | ;; Special tokens that can't be followed by a division operator. |
| 1371 | "\\(^\\|[[=(,~?:;<>]" | 1371 | "\\(^\\|[[=(,~;<>]" |
| 1372 | ;; Distinguish ternary operator tokens. | ||
| 1373 | ;; FIXME: They don't really have to be separated with spaces. | ||
| 1374 | "\\|[?:] " | ||
| 1372 | ;; Control flow keywords and operators following bol or whitespace. | 1375 | ;; Control flow keywords and operators following bol or whitespace. |
| 1373 | "\\|\\(?:^\\|\\s \\)" | 1376 | "\\|\\(?:^\\|\\s \\)" |
| 1374 | (regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and" | 1377 | (regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and" |
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index 77dd62821f7..ad13d01a674 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el | |||
| @@ -124,6 +124,12 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 124 | (ert-deftest ruby-regexp-can-be-multiline () | 124 | (ert-deftest ruby-regexp-can-be-multiline () |
| 125 | (ruby-assert-state "/bars\ntees # toots \nfoos/" 3 nil)) | 125 | (ruby-assert-state "/bars\ntees # toots \nfoos/" 3 nil)) |
| 126 | 126 | ||
| 127 | (ert-deftest ruby-slash-symbol-is-not-mistaken-for-regexp () | ||
| 128 | (ruby-assert-state ":/" 3 nil)) | ||
| 129 | |||
| 130 | (ert-deftest ruby-slash-char-literal-is-not-mistaken-for-regexp () | ||
| 131 | (ruby-assert-state "?/" 3 nil)) | ||
| 132 | |||
| 127 | (ert-deftest ruby-indent-simple () | 133 | (ert-deftest ruby-indent-simple () |
| 128 | (ruby-should-indent-buffer | 134 | (ruby-should-indent-buffer |
| 129 | "if foo | 135 | "if foo |