unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: "Pål de Vibe" <pauldevibe@yahoo.no>,
	"Nobuyoshi Nakada" <nobu@ruby-lang.org>,
	5757@debbugs.gnu.org
Subject: bug#5757: String literal parse problem in ruby-mode
Date: Mon, 04 Apr 2011 09:53:45 -0400	[thread overview]
Message-ID: <jwvd3l22kmv.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87k4fcma4c.fsf_-_@stupidchicken.com> (Chong Yidong's message of "Sat, 02 Apr 2011 20:50:11 -0400")

> 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@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))








  reply	other threads:[~2011-04-04 13:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 16:21 bug#5757: 23.1; String literal parse problem in ruby-mode Rhett Sutphin
2011-03-30 22:08 ` bug#5757: The line which causes the bug is 1185 Pål de Vibe
2011-04-03  0:50   ` bug#5757: String literal parse problem in ruby-mode Chong Yidong
2011-04-04 13:53     ` Stefan Monnier [this message]
2011-04-04 13:55       ` Pål de Vibe
2011-04-09 20:34       ` Chong Yidong
2011-04-12  3:16         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvd3l22kmv.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=5757@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=nobu@ruby-lang.org \
    --cc=pauldevibe@yahoo.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).