aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2013-07-13 00:28:53 +0400
committerDmitry Gutov2013-07-13 00:28:53 +0400
commit0880a9520ed651100f9ca85b5c37399b465c7ea2 (patch)
tree278e682658da875ba0f7e9030e74099864b88342 /lisp
parent6741ad6cfaa1090ad2631218100c18f7f2f0c519 (diff)
downloademacs-0880a9520ed651100f9ca85b5c37399b465c7ea2.tar.gz
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 @@
12013-07-12 Dmitry Gutov <dgutov@yandex.ru>
2
3 * progmodes/ruby-mode.el (ruby-percent-literals-beg-re):
4 (ruby-syntax-expansion-allowed-p): Support array of symbols, for
5 Ruby 2.0.
6 (ruby-font-lock-keywords): Distinguish calls to functions with
7 module-like names from module references. Highlight character
8 literals.
9
12013-07-12 Sergio Durigan Junior <sergiodj@riseup.net> (tiny change) 102013-07-12 Sergio Durigan Junior <sergiodj@riseup.net> (tiny change)
2 11
3 * progmodes/gdb-mi.el (gdb-strip-string-backslash): New function. 12 * 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."
1351 (progn 1351 (progn
1352 (eval-and-compile 1352 (eval-and-compile
1353 (defconst ruby-percent-literal-beg-re 1353 (defconst ruby-percent-literal-beg-re
1354 "\\(%\\)[qQrswWx]?\\([[:punct:]]\\)" 1354 "\\(%\\)[qQrswWxIi]?\\([[:punct:]]\\)"
1355 "Regexp to match the beginning of percent literal.") 1355 "Regexp to match the beginning of percent literal.")
1356 1356
1357 (defconst ruby-syntax-methods-before-regexp 1357 (defconst ruby-syntax-methods-before-regexp
@@ -1387,7 +1387,7 @@ It will be properly highlighted even when the call omits parens.")
1387 (funcall 1387 (funcall
1388 (syntax-propertize-rules 1388 (syntax-propertize-rules
1389 ;; $' $" $` .... are variables. 1389 ;; $' $" $` .... are variables.
1390 ;; ?' ?" ?` are ascii codes. 1390 ;; ?' ?" ?` are character literals (one-char strings in 1.9+).
1391 ("\\([?$]\\)[#\"'`]" 1391 ("\\([?$]\\)[#\"'`]"
1392 (1 (unless (save-excursion 1392 (1 (unless (save-excursion
1393 ;; Not within a string. 1393 ;; Not within a string.
@@ -1518,7 +1518,7 @@ It will be properly highlighted even when the call omits parens.")
1518 (save-match-data 1518 (save-match-data
1519 (save-excursion 1519 (save-excursion
1520 (goto-char (nth 8 parse-state)) 1520 (goto-char (nth 8 parse-state))
1521 (looking-at "%\\(?:[QWrx]\\|\\W\\)"))))))) 1521 (looking-at "%\\(?:[QWrxI]\\|\\W\\)")))))))
1522 1522
1523 (defun ruby-syntax-propertize-expansions (start end) 1523 (defun ruby-syntax-propertize-expansions (start end)
1524 (save-excursion 1524 (save-excursion
@@ -1848,8 +1848,11 @@ See `font-lock-syntax-table'.")
1848 '("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+" 1848 '("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+"
1849 0 font-lock-variable-name-face) 1849 0 font-lock-variable-name-face)
1850 ;; constants 1850 ;; constants
1851 '("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)" 1851 '("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)\\(?:\\_>[^\(]\\|::\\|\\'\\)"
1852 1 font-lock-type-face) 1852 1 (progn
1853 (when (eq ?: (char-before))
1854 (forward-char -2))
1855 font-lock-type-face))
1853 '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face) 1856 '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face)
1854 ;; expression expansion 1857 ;; expression expansion
1855 '(ruby-match-expression-expansion 1858 '(ruby-match-expression-expansion
@@ -1857,6 +1860,9 @@ See `font-lock-syntax-table'.")
1857 ;; negation char 1860 ;; negation char
1858 '("[^[:alnum:]_]\\(!\\)[^=]" 1861 '("[^[:alnum:]_]\\(!\\)[^=]"
1859 1 font-lock-negation-char-face) 1862 1 font-lock-negation-char-face)
1863 ;; character literals
1864 ;; FIXME: Support longer escape sequences.
1865 '("\\?\\\\?\\S " 0 font-lock-string-face)
1860 ) 1866 )
1861 "Additional expressions to highlight in Ruby mode.") 1867 "Additional expressions to highlight in Ruby mode.")
1862 1868