Subject: 23.1; String literal parse problem in ruby-mode

From: Rhett Sutphin <[email-masked]>
Date: Tue, 23 Mar 2010 11:21:10 -0500

ruby-mode will misunderstand a ruby double-quoted string literal which
contains a single quote and ends with a question mark.  It thinks that
the string literal is unterminated, which contaminates the syntax
highlighting for the remainder of the buffer.

Example ruby code which will demonstrate the problem:

["Is 'this' a string?"], [:something, :else]

If there's anything between the question mark and the terminating
double-quote, the string will be correctly interpreted.

Thanks,
Rhett Sutphin
[email-masked]

In GNU Emacs 23.1.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
  of 2009-08-16 on black.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: nil
   value of $XMODIFIERS: nil
   locale-coding-system: nil
   default-enable-multibyte-characters: t

Major mode: Ruby

Minor modes in effect:
   yas/global-mode: t
   yas/minor-mode: t
   auto-fill-function: do-auto-fill
   global-auto-revert-mode: t
   hi-lock-mode: t
   shell-dirtrack-mode: t
   hl-line-mode: t
   global-linum-mode: t
   linum-mode: t
   show-paren-mode: t
   nxhtml-global-minor-mode: t
   recentf-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   global-auto-composition-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
<right> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <left> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <left>
<left> <right> <right> ' <right> <left> " <left> <left>
<left> <left> <right> <left> <right> <right> <left>
<left> <right> <right> <right> <left> <left> <left>
<left> <right> <right> <right> <right> <right> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <right>
<right> <right> <right> <right> <right> <left> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <backspace> <left> <left> <backspace> ' <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> , SPC
[ : a ] <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <backspace> <right>
<right> <right> <right> <right> ' <right> <right> <right>
<right> <right> <right> ' <backspace> <left> <left>
<left> <left> <left> <left> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> ' '
' ' ' ' ' ' ' ' ' ' ' <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> " <right> <right> <right> <right> <right>
<right> ? <backspace> <left> <left> <left> ? <down-mouse-1>
<mouse-1> M-x r e p o r t - e m <tab> <return>

Recent messages:
Auto-saving...done
Quit
Mark set
Undo! [6 times]
Quit
Auto-saving...done
Making completion list...
Quit
ruby-indent-to: invalid nest [2 times]
call-interactively: End of buffer