From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jimmy Yuen Ho Wong Newsgroups: gmane.emacs.bugs Subject: bug#26750: [PATCH] add missing keywords to js-mode Date: Sat, 28 Apr 2018 22:46:55 +0100 Message-ID: <9822cef6-7fb4-1b25-e056-a237fa706430@gmail.com> References: <87zi1nox8m.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1524951988 20313 195.159.176.226 (28 Apr 2018 21:46:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 28 Apr 2018 21:46:28 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 Cc: 26750@debbugs.gnu.org To: Noam Postavsky , Ruslan Bekenev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 28 23:46:24 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCXfj-0005BM-QK for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Apr 2018 23:46:24 +0200 Original-Received: from localhost ([::1]:53658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCXhq-00073y-Oz for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Apr 2018 17:48:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCXhO-0006re-3C for bug-gnu-emacs@gnu.org; Sat, 28 Apr 2018 17:48:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fCXhL-0008Mq-0D for bug-gnu-emacs@gnu.org; Sat, 28 Apr 2018 17:48:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fCXhK-0008MW-RT for bug-gnu-emacs@gnu.org; Sat, 28 Apr 2018 17:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fCXhK-0004QH-Bj for bug-gnu-emacs@gnu.org; Sat, 28 Apr 2018 17:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jimmy Yuen Ho Wong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Apr 2018 21:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26750 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26750-submit@debbugs.gnu.org id=B26750.152495202516932 (code B ref 26750); Sat, 28 Apr 2018 21:48:02 +0000 Original-Received: (at 26750) by debbugs.gnu.org; 28 Apr 2018 21:47:05 +0000 Original-Received: from localhost ([127.0.0.1]:42351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCXgO-0004P1-Nj for submit@debbugs.gnu.org; Sat, 28 Apr 2018 17:47:04 -0400 Original-Received: from mail-wr0-f181.google.com ([209.85.128.181]:34690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCXgM-0004OR-GV for 26750@debbugs.gnu.org; Sat, 28 Apr 2018 17:47:03 -0400 Original-Received: by mail-wr0-f181.google.com with SMTP id p18-v6so4785011wrm.1 for <26750@debbugs.gnu.org>; Sat, 28 Apr 2018 14:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=t1soDS5bORAmHelD4eNjHDiFNtn1dVVJDBPKILd5f9A=; b=dSuE7jra4kMovhV5HAFWhnUtV7/nnEy2UHtX9KwvV5h8+cwLoDSCecITSgY7f8yZnn RoYowjjFbfbxWq4gil+eau5xP+i7KINfvjLs0egx1iFItkhhBE9gaxzJ0nKeNf5eh8IT z+JKw5gyDJNxoWB2ZyngufDE2VdTt91MH7NSoIJftk+fIG9aKwcFXEK/dO8/R9TZ6e5W bPQWoF8H1xNTTLdjtfBHAPmj6x/KVyU/1gTUtWGcS0uXHPsbSCPYcnPK3hb3T29rnxc3 Z0wgTkn1B85mLL7aT3cX5SIR+QfL17wadHl4Mraf69SxBlarOYJF+BScGJzQYjg5cZRY HKww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=t1soDS5bORAmHelD4eNjHDiFNtn1dVVJDBPKILd5f9A=; b=WDKGOsQjOmqpYJekka4YZQvemL12kAyuzS6v61Xion9w4rXjU64GI/oSuDEnAtRqFq +wFXDL30CrsU3dukJmBM3ZAcsUZUI5GAW/MPN39n15OrfpnT+HZ4bLq0ww1A07hnIAEb GDc8+4Et9YP4yU1ScPG+4d+mL+pbnv++qzGA6rq+ZjSVNOXjjWGPspbVkLI/8K7rn/E8 8gFJBSydjWeJjC9TT9rGXmUa/gt0jyRep8T7TU9I9USmQczcwPGs6w1Hs2LNAQGY5NRI 57dz9GU14wal2l1cvTrp3jVu8tjE7tqajTwwnJ4GNSKSZ5Vh4hbiNntcMSAfFU4n06NA f0zg== X-Gm-Message-State: ALQs6tAm2TMP38Tr+oijwU8AQfuEikAiNSMruIIucj2D2FExPy4YrpIe LKuhdeBneigMQzsTen5QIwak5PXD X-Google-Smtp-Source: AB8JxZrQOO+x9V/WaMEmOdJVc+JF/c3CDjRAiGZbK189p9f2PMxC4WvOIzy0vcjW55dZCeLss09/HQ== X-Received: by 2002:adf:86b2:: with SMTP id 47-v6mr5094985wrx.256.1524952016684; Sat, 28 Apr 2018 14:46:56 -0700 (PDT) Original-Received: from MobileCat.local ([88.98.208.53]) by smtp.gmail.com with ESMTPSA id q34-v6sm6466396wrb.27.2018.04.28.14.46.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Apr 2018 14:46:55 -0700 (PDT) Openpgp: preference=signencrypt Autocrypt: addr=wyuenho@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFrSFY8BEADPCwJ+z3krWkYRMNlw3UkxtYlj3v5fuPzjxvpzegH7x0breoiF782EY1j6 Xr3U3yV6WKBRVNgCkF6xibSl1BXFYQMw+k/27OGr/v+7NB+HOORAKxMvYeepR9nMpQuIB5+4 BT2Jyk2bmnpS27eXscDFlS4KmUPztg1odVGlMwe0ltrNgmEb5AZ7OSGw9doq4KfwBLJ0K+YQ Se0LltI8DP/TTNgl/srmWxWER4DhNB7c5+Eu8k+OLSED1bborTZPOBN6xYVupv8KolQNMg3c EvQ11jvVCa5vDV1o/2IR2UT18fp2XjFQbJSHd6dKuXnBNlkyqhtgJzDBk6YtBhRlh+/2DcKA VCaxIFNjWAl1SmTb79rPYIVRHCN7WCj2wV+rjBb3DAQ4TAWjOiEBkBQIdWIA2Cv7nOsni4cT /s9yb7ZU0KUGdoFs5vVCk0z9fDKvzZKifPerT5zPzeEq6k7CvU2Gfkk7CMWUcmi/2gjKspXv POL2c5Wl+lTwrOYs4ZEwy1QHXq7DIdod0wjWBc8LmiezW8kdYJMNjBq6+4nRdQHgjh92oYjF Xn0NZy77wlpzq3AMRMCRe2KPfEFfe2JolsTpDG0JLQZ3YO2zEqGJS9l0lpJh8wRvnQgK8ZIb XkG4fnj84wnm3pQ2P8qmpeLcVeeBIZ+N6zLiw1PMCKbcYshYCQARAQABzSVKaW1teSBXb25n IDxqaW1teS53b25nQGhvbWV0YXN0eS5jb20+wsGUBBMBCAA+FiEEuxndnIwL3x6VsafhJzCH EBHFrC8FAlrSFY8CGy In-Reply-To: <87zi1nox8m.fsf@gmail.com> Content-Language: en-GB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:145814 Archived-At: Technically, "async", "await" and "yield" can also be identifiers. "async" should only be highlighted if it's followed by a function, arrow function or a method. "await" should only be highlighted if it's inside an async function, async arrow function or an async method. "yield" should only be highlighted inside a generator function/arrow function and method. But for all intends and purposes, you can put "await" and "yield" into the list of keywords or you'll have to write a full blown parser and AST in order to traverse back and forth. That's how Chrome devtools does it anyway. Only "async", "as", "of" and "from" need special handling. On 28/04/2018 22:08, Noam Postavsky wrote: > forcemerge 26750 31306 > quit > > Ruslan Bekenev writes: > >> Hi. It is my first contribution.=C2=A0 >> I hope everything is correct with this PATCH and submission itself.=C2= =A0 >> In this patch added two missed keywords to `js--keyword-re` which are = `as` and `of`.=C2=A0 >> `async` and `await` are already there.=C2=A0 > Hi, sorry your patch was overlooked for so long. Unfortunately, I thin= k > just adding keywords to js--keyword-re will not quite do the right > thing, based on https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31306#5= : > > Specially, "as" and "from" should only be highlighted in an import > statement. "of" should only be highlighted in a for statement. Any = other > occurrances of "as", "from" and "of" should not be highlighted as t= hey > are legal identifiers outside of import and for statements respecti= vely. > >