GNU bug report logs - #25529
25.1.90; js-mode: Regexp literal with unbalanced brackets breaks font-lock

Previous Next

Package: emacs;

Reported by: Mikhail Gusarov <mikhail <at> hola.org>

Date: Wed, 25 Jan 2017 11:15:02 UTC

Severity: minor

Found in version 25.1.90

Done: Tom Tromey <tom <at> tromey.com>

Bug is archived. No further changes may be made.

Full log


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

From: Tom Tromey <tom <at> tromey.com>
To: 25529 <at> debbugs.gnu.org
Subject: diagnosis and one approach to a fix
Date: Sat, 04 Feb 2017 22:37:29 -0700
I think the problem here is that js-syntax-propertize-regexp is using
parse-partial-sexp to try to parse the regexp literal.  However, this
gets confused by the construct [^[], because it thinks that the brackets
aren't matched.

I don't think there is a way to teach parse-partial-sexp that "^" is a
quote only in this one specific instance.

One possible fix here would be to change this function to do a simple
parse of the regexp literal.  I think it would only really have to
handle parsing bracket syntax and looking for the terminating "/".  The
current code also looks for balanced parens, but I don't think this is
actually needed.

Tom




This bug report was last modified 8 years and 180 days ago.

Previous Next


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