* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight

regexp options.

Fixes: debbugs:16914
This commit is contained in:
Dmitry Gutov 2014-03-02 00:04:59 +02:00
parent 2907acd464
commit 1850913d96
3 changed files with 19 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2014-03-01 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
regexp options. (Bug#16914)
2014-03-01 Martin Rudalics <rudalics@gmx.at>
* window.el (window--max-delta-1): Round down when calculating

View file

@ -2132,6 +2132,16 @@ See `font-lock-syntax-table'.")
;; Character literals.
;; FIXME: Support longer escape sequences.
("\\_<\\?\\\\?\\S " 0 font-lock-string-face)
;; Regexp options.
("\\(?:\\s|\\|/\\)\\([imxo]+\\)"
1 (when (save-excursion
(let ((state (syntax-ppss (match-beginning 0))))
(and (nth 3 state)
(or (eq (char-after) ?/)
(progn
(goto-char (nth 8 state))
(looking-at "%r"))))))
font-lock-preprocessor-face))
)
"Additional expressions to highlight in Ruby mode.")

View file

@ -29,6 +29,10 @@ a = asub / aslb + bsub / bslb;
# Highlight the regexp after "if".
x = toto / foo if /do bar/ =~ "dobar"
# Regexp options are highlighted.
/foo/xi != %r{bar}mo.tee
bar(class: XXX) do # ruby-indent-keyword-label
foo
end