emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113399: * lisp/progmodes/ruby-mode.el (ruby-percent


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r113399: * lisp/progmodes/ruby-mode.el (ruby-percent-literals-beg-re):
Date: Fri, 12 Jul 2013 20:28:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113399
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Sat 2013-07-13 00:28:53 +0400
message:
  * 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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/ruby-mode.el    
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-07-12 18:19:10 +0000
+++ b/lisp/ChangeLog    2013-07-12 20:28:53 +0000
@@ -1,3 +1,12 @@
+2013-07-12  Dmitry Gutov  <address@hidden>
+
+       * 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  <address@hidden>  (tiny change)
 
        * progmodes/gdb-mi.el (gdb-strip-string-backslash): New function.

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2013-07-09 01:17:48 +0000
+++ b/lisp/progmodes/ruby-mode.el       2013-07-12 20:28:53 +0000
@@ -1351,7 +1351,7 @@
     (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 @@
           (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 @@
             (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 @@
    '("\\(\\$\\|@\\|@@\\)\\(\\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 @@
    ;; 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.")
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]