summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2013-07-13 00:28:53 +0400
committerDmitry Gutov <dgutov@yandex.ru>2013-07-13 00:28:53 +0400
commit0880a9520ed651100f9ca85b5c37399b465c7ea2 (patch)
tree278e682658da875ba0f7e9030e74099864b88342 /lisp
parent6741ad6cfaa1090ad2631218100c18f7f2f0c519 (diff)
downloademacs-0880a9520ed651100f9ca85b5c37399b465c7ea2.tar.gz
emacs-0880a9520ed651100f9ca85b5c37399b465c7ea2.tar.bz2
emacs-0880a9520ed651100f9ca85b5c37399b465c7ea2.zip
* lisp/progmodes/ruby-mode.el (ruby-percent-literals-beg-re):
(ruby-syntax-expansion-allowed-p): Support array of symbols, for Ruby 2.0. (ruby-font-lock-keywords): Distinguish calls to functions with module-like names from module references. Highlight character literals.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/ruby-mode.el16
2 files changed, 20 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 592b6f236ec..e7c4c27002a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2013-07-12 Dmitry Gutov <dgutov@yandex.ru>
+
+ * progmodes/ruby-mode.el (ruby-percent-literals-beg-re):
+ (ruby-syntax-expansion-allowed-p): Support array of symbols, for
+ Ruby 2.0.
+ (ruby-font-lock-keywords): Distinguish calls to functions with
+ module-like names from module references. Highlight character
+ literals.
+
2013-07-12 Sergio Durigan Junior <sergiodj@riseup.net> (tiny change)
* progmodes/gdb-mi.el (gdb-strip-string-backslash): New function.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index b873606286a..041458233c9 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1351,7 +1351,7 @@ If the result is do-end block, it will always be multiline."
(progn
(eval-and-compile
(defconst ruby-percent-literal-beg-re
- "\\(%\\)[qQrswWx]?\\([[:punct:]]\\)"
+ "\\(%\\)[qQrswWxIi]?\\([[:punct:]]\\)"
"Regexp to match the beginning of percent literal.")
(defconst ruby-syntax-methods-before-regexp
@@ -1387,7 +1387,7 @@ It will be properly highlighted even when the call omits parens.")
(funcall
(syntax-propertize-rules
;; $' $" $` .... are variables.
- ;; ?' ?" ?` are ascii codes.
+ ;; ?' ?" ?` are character literals (one-char strings in 1.9+).
("\\([?$]\\)[#\"'`]"
(1 (unless (save-excursion
;; Not within a string.
@@ -1518,7 +1518,7 @@ It will be properly highlighted even when the call omits parens.")
(save-match-data
(save-excursion
(goto-char (nth 8 parse-state))
- (looking-at "%\\(?:[QWrx]\\|\\W\\)")))))))
+ (looking-at "%\\(?:[QWrxI]\\|\\W\\)")))))))
(defun ruby-syntax-propertize-expansions (start end)
(save-excursion
@@ -1848,8 +1848,11 @@ See `font-lock-syntax-table'.")
'("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+"
0 font-lock-variable-name-face)
;; constants
- '("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)"
- 1 font-lock-type-face)
+ '("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)\\(?:\\_>[^\(]\\|::\\|\\'\\)"
+ 1 (progn
+ (when (eq ?: (char-before))
+ (forward-char -2))
+ font-lock-type-face))
'("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face)
;; expression expansion
'(ruby-match-expression-expansion
@@ -1857,6 +1860,9 @@ See `font-lock-syntax-table'.")
;; negation char
'("[^[:alnum:]_]\\(!\\)[^=]"
1 font-lock-negation-char-face)
+ ;; character literals
+ ;; FIXME: Support longer escape sequences.
+ '("\\?\\\\?\\S " 0 font-lock-string-face)
)
"Additional expressions to highlight in Ruby mode.")