Forum: Ruby-core emacs ruby-mode.el font-lock fails on symboled string ending with ?

Posted by dgutov (Dmitry Gutov) (Guest)
on 2012-12-03 21:45
(Received via mailing list)
Issue #3320 has been updated by dgutov (Dmitry Gutov).


All examples in this bug work fine for me with ruby-mode from the Emacs 
tree.
Not sure when they were fixed.
----------------------------------------
Bug #3320: emacs ruby-mode.el font-lock fails on symboled string ending 
with ?
https://bugs.ruby-lang.org/issues/3320#change-34382

Author: zev (Zev Blut)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: 1.9.4
ruby -v: 1.9.2 (trunk and 1.8.7)+


=begin
 Fontification breaks when emacs sees a symbol like
 :'this is a symbol?'

 example code:
 ----------
 class EmacsExample
   :symbol

   'this is a test'
   'is this a test?'
   "Can this be a test"
   :'this is an error?'

   def bar
     @help
   end
 end

 ----

 I have a very hacked fix in ruby-font-lock-syntactic-keywords
 for
     ;; the last $', $", $` in the respective string is not variable
     ;; the last ?', ?", ?` in the respective string is not ascii code
     ("\\(^\\|[\[ 
\t\n<+\(,=:]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)"
      (2 (7 . nil))
     (4 (7 . nil)))

 by adding : in the above matches with space tabs L etc...

 See the attached patch

 I am not sure this is the proper fix, but it fixes the above example.

 Thanks,
 Zev
=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.