GNU bug report logs - #7882
24.0.50; Bad regexp for javascript regexps

Previous Next

Package: emacs;

Reported by: Harald Hanche-Olsen <hanche <at> math.ntnu.no>

Date: Fri, 21 Jan 2011 17:43:02 UTC

Severity: normal

Found in version 24.0.50

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#7882: closed (24.0.50; Bad regexp for javascript regexps)
Date: Fri, 21 Jan 2011 20:43:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 21 Jan 2011 15:50:17 -0500
with message-id <jwvlj2ej8hj.fsf-monnier+emacs <at> gnu.org>
and subject line Re: bug#7882: 24.0.50; Bad regexp for javascript regexps
has caused the GNU bug report #7882,
regarding 24.0.50; Bad regexp for javascript regexps
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
7882: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7882
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Bad regexp for javascript regexps
Date: Fri, 21 Jan 2011 18:50:29 +0100 (CET)
Put the following four line code snippet in a new buffer:

replace(/\\/g,something);
// Now we're in trouble:
// Still in trouble.
// And all's well again.

and activate js-mode and font-lock-mode.

The syntax colouring is now off: The code starting with the first
slash on the first line and ending with the first slash on the second
line is coloured as a regexp; now the syntax highlighter is unaware
that we are in a comment, and reads the single quote as the start of a
string. After the second single quote things return to normal.

The problem seems to lie with the constant js--regexp-literal declared
in js.el, as this regexp does not treat backslashes with sufficient care.

In GNU Emacs 24.0.50.1 (x86_64-apple-darwin10.5.0, NS apple-appkit-1038.35)
 of 2010-12-27 on mack
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''

- Harald


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Cc: 7882-done <at> debbugs.gnu.org
Subject: Re: bug#7882: 24.0.50; Bad regexp for javascript regexps
Date: Fri, 21 Jan 2011 15:50:17 -0500
> replace(/\\/g,something);

Thanks, I've installed the patch below into the emacs-23 branch which
should fix this problem.  The highlighting is not reliable when the
regexp spans multiple lines, tho, so I wonder: are multi-line regexps
valid? common? important?


        Stefan


This bug report was last modified 14 years and 126 days ago.

Previous Next


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