GNU bug report logs - #5757
23.1; String literal parse problem in ruby-mode

Previous Next

Package: emacs;

Reported by: Rhett Sutphin <r-sutphin <at> northwestern.edu>

Date: Tue, 23 Mar 2010 16:23:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 5757 <at> debbugs.gnu.org (full text, mbox):

From: Pål de Vibe <pauldevibe <at> yahoo.no>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, Nobuyoshi Nakada <nobu <at> ruby-lang.org>,
	5757 <at> debbugs.gnu.org
Subject: Re: bug#5757: String literal parse problem in ruby-mode
Date: Mon, 4 Apr 2011 09:25:25 -0430
[Message part 1 (text/plain, inline)]
Hi. This wasn't really a proposed fix but more a hint to help debugging. I
haven't had time to really study the code. Thanks for the feedback.

On Mon, Apr 4, 2011 at 9:23 AM, Stefan Monnier <monnier <at> iro.umontreal.ca>wrote:

> > Could you help review Pål de Vibe's proposed fix to the following
> > problem in Emacs ruby-mode?  Thanks.
>
> His proposed fix is not correct: in ruby (like in Elisp) ?<char> is used
> for chars (including ?' and ?") and $' and $" are also special vars, so
> his fix just disables the special treatment of ?.
> For Emacs-24, we use a different chunk of code which doesn't suffer from
> this problem (mostly calling syntax-ppss to determine if we're inside
> a string).
>
>
>        Stefan
>
>
> > Pål de Vibe <pauldevibe <at> yahoo.no> writes:
>
> >>> 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.
> >>
> >> Line 1185:
> >> ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
> >>
> >> A workaround (with, to me, uknown consequences) is to remove the
> >> question mark from the line, like this:
> >>
> >> ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[$]\\([#\"'`]\\)" 3 (1 . nil))
>
>
>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 13 years and 364 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.