From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#9183: js-mode highlights quotes inside regexp character sets as string Date: Sat, 06 Aug 2011 13:34:17 +0200 Message-ID: <87vcua3hae.fsf@gmail.com> References: <87d3gv34nt.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1312630763 8993 80.91.229.12 (6 Aug 2011 11:39:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 6 Aug 2011 11:39:23 +0000 (UTC) To: 9183@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 06 13:39:18 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QpfDq-0007nx-GH for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Aug 2011 13:39:18 +0200 Original-Received: from localhost ([::1]:47619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpfDq-0001En-30 for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Aug 2011 07:39:18 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpfDm-0001Du-IB for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2011 07:39:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpfDl-0003PT-6q for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2011 07:39:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpfDl-0003PP-31 for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2011 07:39:13 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QpfEY-00049e-RS; Sat, 06 Aug 2011 07:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Aug 2011 11:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9183 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9183-submit@debbugs.gnu.org id=B9183.131263079515946 (code B ref 9183); Sat, 06 Aug 2011 11:40:02 +0000 Original-Received: (at 9183) by debbugs.gnu.org; 6 Aug 2011 11:39:55 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QpfEQ-000498-GW for submit@debbugs.gnu.org; Sat, 06 Aug 2011 07:39:55 -0400 Original-Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QpfEM-00048w-9d; Sat, 06 Aug 2011 07:39:52 -0400 Original-Received: by fxe6 with SMTP id 6so183406fxe.3 for ; Sat, 06 Aug 2011 04:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=Yfuu6XpXNfWXaSvvApqmg7r9CaXAglY3vst3X+cibsA=; b=l+/zJpCDCE4VWvRF4ikWhmCipki5t88yuLgVfvJV2gqcQ2cjZzjSr7t1BjEz5zQb3i g+aj1dZpRBVtYKM3pKtne40dd17JcHeb3GMXdP/z5ZG7oLee1T87gKNblw3YqEH3cq4o 6VGXAFq49Ds/9OGbk09XEmv8prxCbqTJPqbkM= Original-Received: by 10.223.76.201 with SMTP id d9mr4360125fak.119.1312630739071; Sat, 06 Aug 2011 04:38:59 -0700 (PDT) Original-Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id n27sm2635362faa.28.2011.08.06.04.38.56 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 06 Aug 2011 04:38:57 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Fri, 05 Aug 2011 12:54:45 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 06 Aug 2011 07:40:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49930 Archived-At: reopen 9183 thanks On Fri, 05 Aug 2011 18:54:45 +0200 Stefan Monnier wrote: >> The following is valid JavaScript: >> /[']/.test(str) > >> js-mode erroneously highlights everything following `'' as a string. >> Same problem with `"'. > > I installed the patch below which should fix this case and a few > others. Thanks, but it doesn't seem to fix anything, just mess things up in a somewhat different way. E.g., with the following in a JS buffer: /[']/.test(str); /ahoj/.test(str); /[']/.test(str); /[']/.test(str); All of the first /[']/ is highlighted as a string, and everything from the second single quote up to the third single quote is highlighted as a string. (Just in case, I downloaded the fixed js.el and loaded that with my oldish Emacs 24 (started as emacs -Q), but I don't think that should matter, right?) > But I don't know how to solve it completely because I don't know > Javascript enough to be sure exactly how to distinguish a /-division > from a /-regexp from a /-comment-starter in all cases: > - is something like > > x =3D 1 + /a/.test("foo"); > > valid? Yes, it's valid, although I suspect it would be considered bad style. (BTW, in Debian there is a spidermonkey-bin package, which has minimal dependencies and provides a `js' command, giving you a REPL.) > If so, is there a list of infix operators somewhere? I'd have to search for it just as you might have... There's this, for instance: https://developer.mozilla.org/en/JavaScript/Reference/Operators --=20 =C5=A0t=C4=9Bp=C3=A1n