From unknown Sat Sep 06 05:03:34 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#25529 <25529@debbugs.gnu.org> To: bug#25529 <25529@debbugs.gnu.org> Subject: Status: 25.1.90; js-mode: Regexp literal with unbalanced brackets breaks font-lock Reply-To: bug#25529 <25529@debbugs.gnu.org> Date: Sat, 06 Sep 2025 12:03:34 +0000 retitle 25529 25.1.90; js-mode: Regexp literal with unbalanced brackets bre= aks font-lock reassign 25529 emacs submitter 25529 Mikhail Gusarov severity 25529 minor thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 25 06:14:32 2017 Received: (at submit) by debbugs.gnu.org; 25 Jan 2017 11:14:32 +0000 Received: from localhost ([127.0.0.1]:41616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWLX5-0002Xe-EQ for submit@debbugs.gnu.org; Wed, 25 Jan 2017 06:14:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWHuY-0005XF-BJ for submit@debbugs.gnu.org; Wed, 25 Jan 2017 02:22:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWHuQ-0005A5-Qt for submit@debbugs.gnu.org; Wed, 25 Jan 2017 02:22:25 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38910) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cWHuQ-0005A1-NF for submit@debbugs.gnu.org; Wed, 25 Jan 2017 02:22:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWHuN-0007pP-UV for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 02:22:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWHuK-00059M-NU for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 02:22:19 -0500 Received: from mail.hola.org ([54.243.35.14]:50278) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cWHuK-00058c-Io for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 02:22:16 -0500 Received: from newton.local (wall-ext.hola.org [212.235.66.73]) (authenticated bits=0) by mail.hola.org (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v0P7M6eH031210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 25 Jan 2017 07:22:07 GMT To: bug-gnu-emacs@gnu.org From: Mikhail Gusarov Subject: 25.1.90; js-mode: Regexp literal with unbalanced brackets breaks font-lock Message-ID: <94a72ce0-f3c5-12bb-b2c7-13f685b7d4ad@hola.org> Date: Wed, 25 Jan 2017 09:22:05 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-jmail-Status: Pass, Flags=AUTH IP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 25 Jan 2017 06:14:30 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) 0. emacs -Q 1. Open a buffer, M-x js-mode 2. Enter the following text: /[^[]/ 3. Enter any text on the following line, note it is highlighted as a string literal 4. Remove ^[ from the regex literal, note that the following text is now highlighted correctly In GNU Emacs 25.1.90.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1212)) of 2016-12-26 built on newton.malta.dottedmag.net Repository revision: b5f1d2159db6c883f5adfe55a2cac8f450917afe Windowing system distributor 'Apple', version 10.3.1404 Configured using: 'configure --with-ns --with-tiff --with-jpeg --with-xpm --with-png --with-modules CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib' Configured features: JPEG RSVG DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES Important settings: value of $LANG: en_NO.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: savehist-mode: t which-function-mode: t show-paren-mode: t which-key-mode: t diff-auto-refine-mode: t magit-auto-revert-mode: t global-git-commit-mode: t async-bytecomp-package-mode: t shell-dirtrack-mode: t global-flycheck-mode: t flycheck-mode: t global-auto-revert-mode: t rainbow-delimiters-mode: t paredit-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t prettify-symbols-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Search failed. This means there is unmatched expression somewhere or we are at the beginning/end of file. [2 times] Undo! funcall-interactively: End of buffer Saving file /Users/hola/tmp/foo.js... Wrote /Users/hola/tmp/foo.js Note: file is write protected Type "q" in help window to restore its previous buffer. uncompressing js.el.gz...done Note: file is write protected Unable to find location in file Load-path shadows: /Users/hola/.var-emacs/el-get/org-mode/lisp/ox hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-texinfo hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-texinfo /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-publish hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-org hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-org /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-odt hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-odt /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-md hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-md /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-man hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-man /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-latex /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-icalendar hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-icalendar /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-html hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-html /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-beamer hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-beamer /Users/hola/.var-emacs/el-get/org-mode/lisp/ox-ascii hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-ascii /Users/hola/.var-emacs/el-get/org-mode/lisp/org hides /Applications/Emacs.app/Contents/Resources/lisp/org/org /Users/hola/.var-emacs/el-get/org-mode/lisp/org-w3m hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-w3m /Users/hola/.var-emacs/el-get/org-mode/lisp/org-version hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-version /Users/hola/.var-emacs/el-get/org-mode/lisp/org-timer hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-timer /Users/hola/.var-emacs/el-get/org-mode/lisp/org-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-table /Users/hola/.var-emacs/el-get/org-mode/lisp/org-src hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-src /Users/hola/.var-emacs/el-get/org-mode/lisp/org-rmail hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-rmail /Users/hola/.var-emacs/el-get/org-mode/lisp/org-protocol hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-protocol /Users/hola/.var-emacs/el-get/org-mode/lisp/org-plot hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-plot /Users/hola/.var-emacs/el-get/org-mode/lisp/org-pcomplete hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-pcomplete /Users/hola/.var-emacs/el-get/org-mode/lisp/org-mouse hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mouse /Users/hola/.var-emacs/el-get/org-mode/lisp/org-mobile hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mobile /Users/hola/.var-emacs/el-get/org-mode/lisp/org-mhe hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mhe /Users/hola/.var-emacs/el-get/org-mode/lisp/org-macs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macs /Users/hola/.var-emacs/el-get/org-mode/lisp/org-macro hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macro /Users/hola/.var-emacs/el-get/org-mode/lisp/org-loaddefs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-loaddefs /Users/hola/.var-emacs/el-get/org-mode/lisp/org-list hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-list /Users/hola/.var-emacs/el-get/org-mode/lisp/org-irc hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-irc /Users/hola/.var-emacs/el-get/org-mode/lisp/org-install hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-install /Users/hola/.var-emacs/el-get/org-mode/lisp/org-inlinetask hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-inlinetask /Users/hola/.var-emacs/el-get/org-mode/lisp/org-info hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-info /Users/hola/.var-emacs/el-get/org-mode/lisp/org-indent hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-indent /Users/hola/.var-emacs/el-get/org-mode/lisp/org-id hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-id /Users/hola/.var-emacs/el-get/org-mode/lisp/org-habit hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-habit /Users/hola/.var-emacs/el-get/org-mode/lisp/org-gnus hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-gnus /Users/hola/.var-emacs/el-get/org-mode/lisp/org-footnote hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-footnote /Users/hola/.var-emacs/el-get/org-mode/lisp/org-feed hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-feed /Users/hola/.var-emacs/el-get/org-mode/lisp/org-faces hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-faces /Users/hola/.var-emacs/el-get/org-mode/lisp/org-eshell hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-eshell /Users/hola/.var-emacs/el-get/org-mode/lisp/org-entities hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-entities /Users/hola/.var-emacs/el-get/org-mode/lisp/org-element hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-element /Users/hola/.var-emacs/el-get/org-mode/lisp/org-docview hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-docview /Users/hola/.var-emacs/el-get/org-mode/lisp/org-datetree hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-datetree /Users/hola/.var-emacs/el-get/org-mode/lisp/org-ctags hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-ctags /Users/hola/.var-emacs/el-get/org-mode/lisp/org-crypt hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-crypt /Users/hola/.var-emacs/el-get/org-mode/lisp/org-compat hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-compat /Users/hola/.var-emacs/el-get/org-mode/lisp/org-colview hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-colview /Users/hola/.var-emacs/el-get/org-mode/lisp/org-clock hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-clock /Users/hola/.var-emacs/el-get/org-mode/lisp/org-capture hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-capture /Users/hola/.var-emacs/el-get/org-mode/lisp/org-bibtex hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-bibtex /Users/hola/.var-emacs/el-get/org-mode/lisp/org-bbdb hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-bbdb /Users/hola/.var-emacs/el-get/org-mode/lisp/org-attach hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-attach /Users/hola/.var-emacs/el-get/org-mode/lisp/org-archive hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-archive /Users/hola/.var-emacs/el-get/org-mode/lisp/org-agenda hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-agenda /Users/hola/.var-emacs/el-get/org-mode/lisp/ob hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-tangle hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-tangle /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-table /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-sqlite hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sqlite /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-sql hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sql /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-shen hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-shen /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-screen hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-screen /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-scheme hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-scheme /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-scala hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-scala /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-sass hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sass /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-ruby hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ruby /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-ref hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ref /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-R hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-R /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-python hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-python /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-plantuml hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-plantuml /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-picolisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-picolisp /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-perl hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-perl /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-org hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-org /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-octave hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-octave /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-ocaml hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ocaml /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-mscgen hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-mscgen /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-maxima hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-maxima /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-matlab hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-matlab /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-makefile hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-makefile /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-lob hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lob /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-lisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lisp /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-lilypond hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lilypond /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-ledger hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ledger /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-latex /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-keys hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-keys /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-js hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-js /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-java hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-java /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-io hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-io /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-haskell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-haskell /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-gnuplot hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-gnuplot /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-fortran hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-fortran /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-exp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-exp /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-eval hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-eval /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-emacs-lisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-emacs-lisp /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-dot hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-dot /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-ditaa hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ditaa /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-css hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-css /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-core hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-core /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-comint hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-comint /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-clojure hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-clojure /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-calc hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-calc /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-C hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-C /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-awk hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-awk /Users/hola/.var-emacs/el-get/org-mode/lisp/ob-asymptote hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-asymptote /Users/hola/.var-emacs/el-get/seq/seq hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/seq Features: (shadow sort mail-extr emacsbug sendmail ibuf-ext ibuffer vc-git log-view vc-rcs grep vc-annotate vc vc-dispatcher parse-time vc-cvs dired-aux misearch multi-isearch jka-compr eieio-opt speedbar sb-image ezimage dframe disp-table tramp-cmds tramp-cache rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok dm-x avoid woman man dm-whitespace dm-tiddlywiki tid-mode dm-smartparens smartparens-config smartparens-python smartparens-rust smartparens-html smartparens dm-scheme geiser-mode geiser-xref geiser-compile geiser-debug geiser-chibi geiser-mit geiser-chez geiser-chicken geiser-racket geiser-guile info-look info geiser-repl geiser-image geiser-company geiser-doc geiser-menu geiser-edit geiser-completion geiser-autodoc geiser-eval geiser-connection tq geiser-syntax scheme geiser-log geiser-popup view geiser-impl geiser-custom geiser-base geiser-load geiser savehist dm-rust flycheck-rust rust-mode python which-func dm-popup popup cperl-mode dm-parens paren dm-org-mode org-mobile org-agenda org-element avl-tree org org-macro org-footnote org-pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs cal-menu calendar cal-loaddefs org-install org-loaddefs dm-objc dm-misc ido finder-inf which-key dm-json json-mode json-reformat json-snatcher js sgml-mode imenu dm-go go-eldoc go-mode url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap find-file ffap thingatpt url-parse url-vars etags xref project compile whitespace dm-git magit-obsolete magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-branch magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode diff-mode magit-core magit-autorevert magit-process magit-margin magit-mode magit-git crm magit-section magit-popup git-commit magit-utils log-edit message rfc822 mml mml-sec epg mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor async-bytecomp async tramp-sh tramp tramp-compat auth-source eieio eieio-core gnus-util mm-util help-fns mail-prsvr password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color ring format-spec advice dm-elisp dm-flycheck flycheck json map find-func rx dash server assoc easy-mmode autorevert filenotify dired-x dm-clojure dm-prettify-symbols dm-rainbow cl-macs rainbow-delimiters dm-paredit paredit edmacro kmacro cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs dm-path exec-path-from-shell dm-el-get .loaddefs el-get el-get-autoloading el-get-list-packages el-get-dependencies el-get-build el-get-status pp el-get-methods el-get-fossil el-get-svn el-get-pacman el-get-github-zip el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify el-get-emacsmirror el-get-github el-get-git el-get-elpa package epg-config seq byte-opt el-get-darcs el-get-cvs el-get-bzr el-get-brew el-get-builtin el-get-apt-get el-get-recipes el-get-byte-compile subr-x el-get-custom cl-seq el-get-core autoload lisp-mnt bytecomp byte-compile cl-extra help-mode easymenu cconv cl gv cl-loaddefs pcase cl-lib dired dm-functions dm-look time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win ucs-normalize term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 578417 497407) (symbols 48 51155 64) (miscs 40 520 3222) (strings 32 130093 345819) (string-bytes 1 4086693) (vectors 16 81276) (vector-slots 8 1890698 414414) (floats 8 610 3479) (intervals 56 11420 10783) (buffers 976 75)) From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 00:37:53 2017 Received: (at 25529) by debbugs.gnu.org; 5 Feb 2017 05:37:53 +0000 Received: from localhost ([127.0.0.1]:56426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caFWK-0004MY-SN for submit@debbugs.gnu.org; Sun, 05 Feb 2017 00:37:53 -0500 Received: from gproxy8-pub.mail.unifiedlayer.com ([67.222.33.93]:59619) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1caFWJ-0004MK-21 for 25529@debbugs.gnu.org; Sun, 05 Feb 2017 00:37:51 -0500 Received: (qmail 25021 invoked by uid 0); 5 Feb 2017 05:37:34 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy8.mail.unifiedlayer.com with SMTP; 5 Feb 2017 05:37:34 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id gtdW1u00R2f2jeq01tdZvV; Sat, 04 Feb 2017 22:37:34 -0700 X-Authority-Analysis: v=2.1 cv=NJxGpSKg c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=A9IJXKNBxMsh5eWRTNQA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jMxxkP8NvJSRwk5uAZvKz33Fbr99AST1zthnoK8OFyo=; b=RGjpXtoP+Cy/6ai2wd8KyuLOVl PoMXdpiGHOiIp6vqLsOimOvcgCpJv4+/cp47KgkJ1wUyaLw5/6noUTktYw8obFblYKHhjhN7J2KT2 45Z1CB3sHEHAELn4ebEn6zR/J; Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:56440 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1caFVy-0007XN-HR; Sat, 04 Feb 2017 22:37:30 -0700 From: Tom Tromey To: 25529@debbugs.gnu.org Subject: diagnosis and one approach to a fix X-Attribution: Tom Date: Sat, 04 Feb 2017 22:37:29 -0700 Message-ID: <87wpd58ag6.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1caFVy-0007XN-HR X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (bapiya) [174.16.146.181]:56440 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 25529 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) 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 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 01:02:22 2017 Received: (at 25529) by debbugs.gnu.org; 5 Feb 2017 06:02:22 +0000 Received: from localhost ([127.0.0.1]:56433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caFu1-0004uI-V7 for submit@debbugs.gnu.org; Sun, 05 Feb 2017 01:02:22 -0500 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:47133) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1caFu0-0004u4-D2 for 25529@debbugs.gnu.org; Sun, 05 Feb 2017 01:02:20 -0500 Received: (qmail 9997 invoked by uid 0); 5 Feb 2017 06:02:03 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy2.mail.unifiedlayer.com with SMTP; 5 Feb 2017 06:02:03 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id gu1z1u00X2f2jeq01u22Hw; Sat, 04 Feb 2017 23:02:03 -0700 X-Authority-Analysis: v=2.1 cv=NJxGpSKg c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=RRKnn34OjR7MtBwWI5MA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=sQN5ppcVGlkhdx1goT40sF4N6NqNybH5hQC64WZf60U=; b=QjCKaackITlof086lXyDCoN0gA YTP8f+WCV8NJz2VqzpE9lX0aBQ5WVcXZhLsblKFww3SIFnUBoMElUO42gJnB8n0ChDNcYEpL0/EGG MPEdpim08Erd8H07bknaF5lFQ; Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:56866 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1caFtf-0002s1-96; Sat, 04 Feb 2017 23:01:59 -0700 From: Tom Tromey To: Tom Tromey Subject: Re: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> X-Attribution: Tom Date: Sat, 04 Feb 2017 23:01:57 -0700 In-Reply-To: <87wpd58ag6.fsf@tromey.com> (Tom Tromey's message of "Sat, 04 Feb 2017 22:37:29 -0700") Message-ID: <87shnt89be.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1caFtf-0002s1-96 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (bapiya) [174.16.146.181]:56866 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -0.8 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Tom> I don't think there is a way to teach parse-partial-sexp that "^" is a Tom> quote only in this one specific instance. This doesn't actually make sense anyway. The "^" is a distraction, as this is valid: let x = /[[]/; Tom> One possible fix here would be to change this function to do a simple Tom> parse of the regexp literal. I think it would only really have to Tom> handle parsing bracket syntax and looking for the terminating "/". The Tom> current code also looks for balanced parens, but I don't think this is Tom> actually needed. I've appended a patch implementing this idea. Tom diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e42e014..083cef9 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1698,18 +1698,30 @@ js-syntax-propertize-regexp (let ((ppss (syntax-ppss))) (when (eq (nth 3 ppss) ?/) ;; A /.../ regexp. - (while - (when (re-search-forward "\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*/" - end 'move) - (if (nth 1 (with-syntax-table - js--syntax-propertize-regexp-syntax-table - (let ((parse-sexp-lookup-properties nil)) - (parse-partial-sexp (nth 8 ppss) (point))))) - ;; A / within a character class is not the end of a regexp. - t - (put-text-property (1- (point)) (point) - 'syntax-table (string-to-syntax "\"/")) - nil)))))) + (let ((keep-going t) + (backslash nil) + (in-bracket nil)) + (while keep-going + (forward-char) + (let ((c (char-after))) + (cond + (backslash + (setq backslash nil)) + ((eq c ?\\) + (setq backslash t)) + ((eq c ?\[) + ;; Note that inside a bracket we can see another unescaped open + ;; bracket. + (setq in-bracket t)) + ((eq c ?\]) + (setq in-bracket nil)) + ((eq c ?/) + (unless in-bracket + ;; We're done. + (setq keep-going nil) + (put-text-property + (point) (1+ (point)) + 'syntax-table (string-to-syntax "\"/"))))))))))) (defun js-syntax-propertize (start end) ;; JavaScript allows immediate regular expression objects, written /.../. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 13:06:07 2017 Received: (at 25529) by debbugs.gnu.org; 5 Feb 2017 18:06:07 +0000 Received: from localhost ([127.0.0.1]:56846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caRCR-0007zf-Lh for submit@debbugs.gnu.org; Sun, 05 Feb 2017 13:06:07 -0500 Received: from gproxy5-pub.mail.unifiedlayer.com ([67.222.38.55]:35251) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1caRCP-0007z8-5G for 25529@debbugs.gnu.org; Sun, 05 Feb 2017 13:06:05 -0500 Received: (qmail 30036 invoked by uid 0); 5 Feb 2017 18:05:55 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy5.mail.unifiedlayer.com with SMTP; 5 Feb 2017 18:05:55 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id h65m1u01w2f2jeq0165pVa; Sun, 05 Feb 2017 11:05:55 -0700 X-Authority-Analysis: v=2.1 cv=Pets2ERd c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=-DvV8ZXa530hOBIlvD4A:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7f3zXANd0+6TBN1bcMrXfsGH1AAvmx3tzy+aWTVIIxw=; b=aZ/7GUOePPTXUtkmK/p77SvMMS HZ5LYdcJlrxJ9SGk5ozLmyi+WMUIZZkQzPhqr3SW3MDK/aUDSJSyGE3Wxd+tqTr3F4LDIkx5JHIjB EL3p4mRnFXmAkyL1eEa1H4QRt; Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:57686 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1caRC6-0006o2-PR; Sun, 05 Feb 2017 11:05:46 -0700 From: Tom Tromey To: Tom Tromey Subject: Re: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> X-Attribution: Tom Date: Sun, 05 Feb 2017 11:05:45 -0700 In-Reply-To: <87shnt89be.fsf@tromey.com> (Tom Tromey's message of "Sat, 04 Feb 2017 23:01:57 -0700") Message-ID: <87o9yg8qdi.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1caRC6-0006o2-PR X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (bapiya) [174.16.146.181]:57686 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) Tom> I've appended a patch implementing this idea. Another way is to use a regexp, see appended. I'll try to write a test for this soon. Tom diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e42e014..2b4ae8e 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1694,22 +1694,32 @@ js--syntax-propertize-regexp-syntax-table (modify-syntax-entry ?\\ "\\" st) st)) +(defconst js--syntax-propertize-regexp-regexp + (rx + ;; Start of regexp. + "/" + (0+ (or + ;; Match characters outside of a character class. + (not (any ?\[ ?/ ?\\)) + ;; Match backslash quoted characters. + (and "\\" not-newline) + ;; Match character class. + (and + "[" + (0+ (or + (not (any ?\] ?\\)) + (and "\\" not-newline))) + "]"))) + (group "/"))) + (defun js-syntax-propertize-regexp (end) (let ((ppss (syntax-ppss))) (when (eq (nth 3 ppss) ?/) ;; A /.../ regexp. - (while - (when (re-search-forward "\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*/" - end 'move) - (if (nth 1 (with-syntax-table - js--syntax-propertize-regexp-syntax-table - (let ((parse-sexp-lookup-properties nil)) - (parse-partial-sexp (nth 8 ppss) (point))))) - ;; A / within a character class is not the end of a regexp. - t - (put-text-property (1- (point)) (point) - 'syntax-table (string-to-syntax "\"/")) - nil)))))) + (goto-char (nth 8 ppss)) + (when (looking-at js--syntax-propertize-regexp-regexp) + (put-text-property (match-beginning 1) (match-end 1) + 'syntax-table (string-to-syntax "\"/")))))) (defun js-syntax-propertize (start end) ;; JavaScript allows immediate regular expression objects, written /.../. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 13:43:29 2017 Received: (at 25529) by debbugs.gnu.org; 5 Feb 2017 18:43:29 +0000 Received: from localhost ([127.0.0.1]:56872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caRmb-0000PZ-JF for submit@debbugs.gnu.org; Sun, 05 Feb 2017 13:43:29 -0500 Received: from gproxy3-pub.mail.unifiedlayer.com ([69.89.30.42]:59258) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1caRmZ-0000PH-Kn for 25529@debbugs.gnu.org; Sun, 05 Feb 2017 13:43:28 -0500 Received: (qmail 14007 invoked by uid 0); 5 Feb 2017 18:43:11 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy3.mail.unifiedlayer.com with SMTP; 5 Feb 2017 18:43:11 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id h6j61u00M2f2jeq016j9LQ; Sun, 05 Feb 2017 11:43:11 -0700 X-Authority-Analysis: v=2.1 cv=NJxGpSKg c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=zstS-IiYAAAA:8 a=k0DwgZvpFiRD_Sh1wb0A:9 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rMAGzlW3axTdAe9v4bKBOdr2GKzzS78AiGINLWs6Mi8=; b=bWBximhwWUDOiiFt6FFbiKocge ENjpD8JppJqiU/U6Hf8q2YyWS2Sin0jRHCyd81lcFShX6R4S/TMv1uCLpwoi3lJTDY+K8axJSR8Z+ 229WE9VRL+NRtkL7KnfxklY0U; Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:58020 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1caRmE-0000xf-4U; Sun, 05 Feb 2017 11:43:06 -0700 From: Tom Tromey To: Tom Tromey Subject: Re: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> X-Attribution: Tom Date: Sun, 05 Feb 2017 11:43:04 -0700 In-Reply-To: <87o9yg8qdi.fsf@tromey.com> (Tom Tromey's message of "Sun, 05 Feb 2017 11:05:45 -0700") Message-ID: <87k2948onb.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1caRmE-0000xf-4U X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (bapiya) [174.16.146.181]:58020 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) Tom> Another way is to use a regexp, see appended. Tom> I'll try to write a test for this soon. Now with a test. Dmitry, I'd appreciate your comments on this. Tom commit 0841c586b5a933773e770579b4a9cd6f86b2dcf7 Author: Tom Tromey Date: Sun Feb 5 11:40:18 2017 -0700 Recognize JS regexp literals more correctly * lisp/progmodes/js.el (js--syntax-propertize-regexp-regexp): New constant. (js-syntax-propertize-regexp): Use it. * test/lisp/progmodes/js-tests.el (js-mode-regexp-syntax-bug-25529): New test. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e42e014..145aa6f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1694,22 +1694,33 @@ js--syntax-propertize-regexp-syntax-table (modify-syntax-entry ?\\ "\\" st) st)) +(defconst js--syntax-propertize-regexp-regexp + (rx + ;; Start of regexp. + "/" + (0+ (or + ;; Match characters outside of a character class. + (not (any ?\[ ?/ ?\\)) + ;; Match backslash quoted characters. + (and "\\" not-newline) + ;; Match character class. + (and + "[" + (0+ (or + (not (any ?\] ?\\)) + (and "\\" not-newline))) + "]"))) + (group "/")) + "Regular expression matching the body of a JavaScript regexp literal.") + (defun js-syntax-propertize-regexp (end) (let ((ppss (syntax-ppss))) (when (eq (nth 3 ppss) ?/) ;; A /.../ regexp. - (while - (when (re-search-forward "\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*/" - end 'move) - (if (nth 1 (with-syntax-table - js--syntax-propertize-regexp-syntax-table - (let ((parse-sexp-lookup-properties nil)) - (parse-partial-sexp (nth 8 ppss) (point))))) - ;; A / within a character class is not the end of a regexp. - t - (put-text-property (1- (point)) (point) - 'syntax-table (string-to-syntax "\"/")) - nil)))))) + (goto-char (nth 8 ppss)) + (when (looking-at js--syntax-propertize-regexp-regexp) + (put-text-property (match-beginning 1) (match-end 1) + 'syntax-table (string-to-syntax "\"/")))))) (defun js-syntax-propertize (start end) ;; JavaScript allows immediate regular expression objects, written /.../. diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 7cb737c..d1a8db0 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -99,6 +99,15 @@ (forward-line) (should (looking-at " \\* test")))) +(ert-deftest js-mode-regexp-syntax-bug-25529 () + (with-temp-buffer + (js-mode) + (insert "let x = /[^[]/;\n") + (save-excursion (insert "something();\n")) + ;; The failure mode was that the regexp literal was not + ;; recognized, causing the next line to be given string syntax. + (should-not (nth 3 (syntax-ppss))))) + (provide 'js-tests) ;;; js-tests.el ends here From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 20:12:43 2017 Received: (at 25529) by debbugs.gnu.org; 6 Feb 2017 01:12:43 +0000 Received: from localhost ([127.0.0.1]:57026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caXrH-0002V0-AK for submit@debbugs.gnu.org; Sun, 05 Feb 2017 20:12:43 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caXrD-0002Um-QR for 25529@debbugs.gnu.org; Sun, 05 Feb 2017 20:12:40 -0500 Received: by mail-wm0-f68.google.com with SMTP id r18so18901977wmd.3 for <25529@debbugs.gnu.org>; Sun, 05 Feb 2017 17:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YFT8rAYfc8sAf1+C3Gesx246CfS3L0FkQyMbWdMf/a0=; b=INJ1PlYIOri20rEQRA6JhaZmfvIDV2nEiC71srQZO1Dj6Xzjt6epWfyJbiYBNllTg5 EG6fD7iRkMf5uST8uDZA9KC0nCYkEQZ4il+FN8zJ004O4pzADxfkqvxSOWGx2LO9gpj6 qESNmHBYFFfJ9jmle1i/IMPTFoZCL9UwDOmMLV6krAXl4h2lP0oWe9Mm/hDUPsrdPgKf HsUvpPhDHWsQkQruxP4Xpwwzfcly1rzk8UO1vHW05HOoq7j4awm1bg5MmCIUdNm6yQKx cGerv9JcH0IfEYOd7G6t4a96g2J50ed3vi2lhUrBP1O1JIgx8ljRGEQbc8ESHo6gODdg AVEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YFT8rAYfc8sAf1+C3Gesx246CfS3L0FkQyMbWdMf/a0=; b=cYhk9fGcIAdqLzaHA8TDNI5lpAtnIp85rI3lksDZZLPDrYZHDyrxqWsp/99ncBZARS 3YM2V5n28OhUbewnjV/RxphuteWpHC1fe8w8F9fIpEXgD/zrikpYlIvTuGM9S4iudodb dwD3yx0MRoIN1OtLVOWDb++PAmKSTZKR6CBM3BUh4PoTAxbpX8xBnsMOpgsM1PlIpq5o X9mZy/hGz3IT57lDD5L9/tq8gpyM5zqA0jAHVyVl9nvhSfisxAUORE6SOGQxPZPG0Zra Qnz3GosG19iGKH4ecvBA3BezbHGa+UM2kPf5JECnGV3vmodjqNFSteXU6xaLnyEI0KFK XkRw== X-Gm-Message-State: AIkVDXJVZURSMxthjN94aIuuTVaU0NDIzTeJhE2RetCeWboe7ZlUgZaoLHScuLAbC7htBw== X-Received: by 10.223.178.87 with SMTP id y23mr6686677wra.91.1486343553716; Sun, 05 Feb 2017 17:12:33 -0800 (PST) Received: from [10.8.0.14] (v-2-eu19-d3962-07.webazilla.com. [78.140.151.7]) by smtp.googlemail.com with ESMTPSA id i189sm9922317wmg.7.2017.02.05.17.12.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Feb 2017 17:12:32 -0800 (PST) Subject: Re: bug#25529: diagnosis and one approach to a fix To: Tom Tromey References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> From: Dmitry Gutov Message-ID: <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> Date: Mon, 6 Feb 2017 03:12:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <87k2948onb.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Hey Tom, On 05.02.2017 20:43, Tom Tromey wrote: > Tom> Another way is to use a regexp, see appended. > Tom> I'll try to write a test for this soon. > > Now with a test. This is very good, thank you. Here's just one example I've come so far that works with the old code, but not with yours: let x = /[/]/; And that's probably just because the new js-syntax-propertize-regexp doesn't move point forward after matching (the current one leaves it after the closing slash), because the regexp in js-syntax-propertize is too primitive. We could try to combine the regexps together, though. Then we'd move the syntax-ppss status check inside the rule for the opening delimiter, and use a simple one for the closer. > + "Regular expression matching the body of a JavaScript regexp literal.") Maybe remove "the body of". The regexp matches the delimiters as well. Thanks! From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 06 12:27:55 2017 Received: (at 25529) by debbugs.gnu.org; 6 Feb 2017 17:27:55 +0000 Received: from localhost ([127.0.0.1]:58011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1can51-0001FY-J5 for submit@debbugs.gnu.org; Mon, 06 Feb 2017 12:27:55 -0500 Received: from gproxy7-pub.mail.unifiedlayer.com ([70.40.196.235]:46265) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1can4z-0001FK-Jf for 25529@debbugs.gnu.org; Mon, 06 Feb 2017 12:27:54 -0500 Received: (qmail 15621 invoked by uid 0); 6 Feb 2017 17:27:43 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy7.mail.unifiedlayer.com with SMTP; 6 Feb 2017 17:27:43 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id hVTd1u0072f2jeq01VTgFc; Mon, 06 Feb 2017 10:27:43 -0700 X-Authority-Analysis: v=2.1 cv=H5NInYoi c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=JlnJdhbEixGRL0der6IA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Sx7+n79FKarWda5I1n5kqPGuKVOSn+sK1SQ30kNl+Q8=; b=SnTuxx1GZ5ZHdWKcBpSR8Qboet KsBvJeo9gwVEnqm5a1tGLs15Ls4mD4BL3dWA5RFc7pmO0zcrlZczc/a1DSoKpRruXEHOab9zqKbpy iiWjoKLm4JLHd1rfhls8apciG; Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:34884 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1can4i-0003QJ-Ut; Mon, 06 Feb 2017 10:27:37 -0700 From: Tom Tromey To: Dmitry Gutov Subject: Re: bug#25529: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> X-Attribution: Tom Date: Mon, 06 Feb 2017 10:27:34 -0700 In-Reply-To: <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> (Dmitry Gutov's message of "Mon, 6 Feb 2017 03:12:31 +0200") Message-ID: <87bmuf8c1l.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1can4i-0003QJ-Ut X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (bapiya) [174.16.146.181]:34884 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Dmitry> This is very good, thank you. Here's just one example I've come so far Dmitry> that works with the old code, but not with yours: Dmitry> let x = /[/]/; Dmitry> And that's probably just because the new js-syntax-propertize-regexp Dmitry> doesn't move point forward after matching Yep, adding a goto-char at the end of the function fixed this. Thanks for pointing that out; I'll add a test case for it. Dmitry> We could try to combine the regexps together, though. Then we'd move Dmitry> the syntax-ppss status check inside the rule for the opening Dmitry> delimiter, and use a simple one for the closer. I think I understand combining the regexps. But what does using a simple regexp for the closer mean? Also, what is the purpose of the first call to js-syntax-propertize-regexp in js-syntax-propertize? Tom From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 06 21:20:50 2017 Received: (at 25529) by debbugs.gnu.org; 7 Feb 2017 02:20:50 +0000 Received: from localhost ([127.0.0.1]:58184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cavOk-000575-Dt for submit@debbugs.gnu.org; Mon, 06 Feb 2017 21:20:50 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cavOj-00056t-5w for 25529@debbugs.gnu.org; Mon, 06 Feb 2017 21:20:49 -0500 Received: by mail-wr0-f196.google.com with SMTP id k90so4319615wrc.3 for <25529@debbugs.gnu.org>; Mon, 06 Feb 2017 18:20:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=O8sxVgROmOq2gr9wN0y7IXgcUsl2a7xLSa4kI9hkMX8=; b=TZCdCm+chkW//tYyvJZ2395f6W/r9uRzuJpAROylBHC7Lter6FpHjdQBjRII/NIiBe itdhacCFNkFWmjMNsaRBdpk5IlvfK0bJSGYMa+fX9OflqCN/gBKbyNmxwtrwjJr6P4ef bdOLTkUhGNS7n8YbJBQ61aV0jkjzLHavhrnyX+szrNZhUjiEKWA2BeTWYCtYU1Ea7uMZ dPz5ulpsHhmHt7Mm3MBq4voygVUlj5Q0+g8aymRkq42eKB84FjgsXgBKwG0/DZGALJ4I R7h9fJbArDdqr24AbAwY9ri2CbOy60CpwHcmwxXyO2T8b4pvAgM9hKnQ46/uRiQQy58I zpsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=O8sxVgROmOq2gr9wN0y7IXgcUsl2a7xLSa4kI9hkMX8=; b=hdanKfpeHHKronmdqxTbkvlumrOWyfoG4Nrj74261X57R96EuebvdQNeQx9LiL0mCV tJXxbxrtmKnuYSbZIi4cx6RfplylNeADI7Q8pmBOmXWCeZgVsBv1Nk3p+a73RUo3+FAJ MAmbkSnGGFK3X+x/ajTMTe6LvTg7sI3JkhMpcCJRWnDSdQuK1zQurW+J+sF2r/n9o5ZA icTzZldSby/U11+zeuKOpK1YGE/wS1JW2zcfno+oi81rnRA+dU0BU3bztVqu7+RiKpRs 2Na/4TqxSW/UUua7buA6vPcYQBuU2yw5TCJSE59NHsvUYHojlRfRXGB0f28oOwJzqh4g Ucuw== X-Gm-Message-State: AIkVDXJPts2OtKOq1vpnvvEqVCxrm6vKLBmII1eZTL5Yp3F2YMw6lY2EG1hiaf3la8KAmw== X-Received: by 10.223.153.98 with SMTP id x89mr11387222wrb.181.1486434043370; Mon, 06 Feb 2017 18:20:43 -0800 (PST) Received: from [192.168.1.3] ([185.105.173.41]) by smtp.googlemail.com with ESMTPSA id b51sm4696151wrd.39.2017.02.06.18.20.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 18:20:42 -0800 (PST) Subject: Re: bug#25529: diagnosis and one approach to a fix To: Tom Tromey References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> From: Dmitry Gutov Message-ID: Date: Tue, 7 Feb 2017 04:20:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <87bmuf8c1l.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On 06.02.2017 19:27, Tom Tromey wrote: > Yep, adding a goto-char at the end of the function fixed this. > Thanks for pointing that out; I'll add a test case for it. Thanks. > I think I understand combining the regexps. But what does using a simple > regexp for the closer mean? Simple handler (not regexp), for the group corresponding to the closer (what's called a HIGHLIGHTn in syntax-propertize-rules docstring). The string "\"/", probably. > Also, what is the purpose of the first call to > js-syntax-propertize-regexp in js-syntax-propertize? I'm not sure. Normally, that helps deal with multiline literals, but regexps in JavaScript are single-line. Maybe Stefan remembers. Or maybe it was a result of confusion: the code deleted in 6cd18349 includes this mistaken sentence: "XXX: Javascript can continue a regexp literal across lines so long as the newline is escaped with \." From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 07 08:07:43 2017 Received: (at 25529) by debbugs.gnu.org; 7 Feb 2017 13:07:43 +0000 Received: from localhost ([127.0.0.1]:58403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb5Ul-0006nd-6A for submit@debbugs.gnu.org; Tue, 07 Feb 2017 08:07:43 -0500 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:50374) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1cb5Ui-0006nO-MG for 25529@debbugs.gnu.org; Tue, 07 Feb 2017 08:07:41 -0500 Received: (qmail 18359 invoked by uid 0); 7 Feb 2017 13:07:27 -0000 Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy2.mail.unifiedlayer.com with SMTP; 7 Feb 2017 13:07:27 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id hp7J1u00G2f2jeq01p7MEt; Tue, 07 Feb 2017 06:07:21 -0700 X-Authority-Analysis: v=2.1 cv=WOnsABcR c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=vaJtXVxTAAAA:8 a=1T4yIHi5z5I-p8NItC4A:9 a=hCt-GehETBxEYQOojhlW:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=aLlZDrbjqjLRSji5seDDaUWqvnn+cHirUcsPjwdxgcA=; b=gRW8x3BFGK0a7NqXTP1extxrlN 5lkltu+2U1M9b25h2AfG34PjEv8YSKzFqn3ZOYyJIRa9jO871okUdWWMQW3DlOWX3eUOtoqc7gKP+ c6OiTLHdi9gKLPlw4mHW7fNLk; Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:44214 helo=pokyo) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cb5UL-0006Ko-Vb; Tue, 07 Feb 2017 06:07:18 -0700 From: Tom Tromey To: Dmitry Gutov Subject: Re: bug#25529: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> X-Attribution: Tom Date: Tue, 07 Feb 2017 06:07:16 -0700 In-Reply-To: (Dmitry Gutov's message of "Tue, 7 Feb 2017 04:20:40 +0200") Message-ID: <87a89y87zv.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1cb5UL-0006Ko-Vb X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (pokyo) [174.16.146.181]:44214 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) >>>>> "Dmitry" == Dmitry Gutov writes: >> Also, what is the purpose of the first call to >> js-syntax-propertize-regexp in js-syntax-propertize? Dmitry> I'm not sure. Normally, that helps deal with multiline literals, but Dmitry> regexps in JavaScript are single-line. Maybe Stefan remembers. Based on discussion in the multi-mode thread, I'm thinking perhaps it handles the case where the start of the regexp literal was syntax-ified but not the end. Tom From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 07 08:11:25 2017 Received: (at 25529) by debbugs.gnu.org; 7 Feb 2017 13:11:25 +0000 Received: from localhost ([127.0.0.1]:58412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb5YK-0006tG-Uc for submit@debbugs.gnu.org; Tue, 07 Feb 2017 08:11:25 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb5YI-0006sz-K7 for 25529@debbugs.gnu.org; Tue, 07 Feb 2017 08:11:22 -0500 Received: by mail-wm0-f68.google.com with SMTP id u63so28210939wmu.2 for <25529@debbugs.gnu.org>; Tue, 07 Feb 2017 05:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=863BeJr9YCXDT+c5R92um+prPW/AyGdYgLg+Ilxh0ZM=; b=uKzPx69TvWx5eC79cQxPa0prcbs3hLRZ2/ePnAbYrtVbW9D8VqDhj2zqdeGnGslXnY mVaBnVhiYmYnkeWsKhvLskt2AR6QTmUdxagiCgFym2A273Txmw2vGa06iAcF9IYMETOH 4MxyU69ZG1z3aDyeROfheIcfKeaDmmmH+HByXhlTxqODKL6MWdiGznXpbHHzy0uSKoW6 aotRY7bYeBJXshUIt4rrAlAFL5KTGkaM6mitLsnZ0Uy0HRuP5BE4m+HdWKs+Z+W9XTjL LliTbqL/ftHHjd/v1/64qgQURQUdF/wQQViYt9awXDVMlod7rDrt06NDBk2pVFLAKQii tRIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=863BeJr9YCXDT+c5R92um+prPW/AyGdYgLg+Ilxh0ZM=; b=hiDC0z4+T5F3yj2uiYHQE71w44EnBm4wqEK6hNIDwq8lmQckEQ5H6/zfLMsPx2CVP8 7pUekiPLR9gXJBj2TBpm9qd+RiMEyqAQ/tTCaCP0nrsr8vZxxG5mVx+CCxPBAaZAGhTq tq1Q1STITvPR9sotjCPISGFYW85k2V0a/b5xJgtz5T4pHWOTJv6Hl44A5kMTDZpYnNDa epjkrXhtpBfUd5J1SdYNatdDSj333eNiDyyX4hck8VpiLQ179uQ2IczslCYNpNvaPGO+ zm8j+nxNmU6OrEdm7UHa7R9ysx/Xips+9r9nNnWHhuKSoFpq0akJgf/liUGzLJT9hhRA oOCg== X-Gm-Message-State: AMke39loMLVVUBSrguKt6VPxje/iupl9wZuA1RIOs/Woc7NVlvPtsK73f3CGY0iCwe6PJg== X-Received: by 10.28.93.68 with SMTP id r65mr14317944wmb.133.1486473076876; Tue, 07 Feb 2017 05:11:16 -0800 (PST) Received: from [192.168.0.133] ([212.50.99.193]) by smtp.googlemail.com with ESMTPSA id w17sm7305214wra.28.2017.02.07.05.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2017 05:11:16 -0800 (PST) Subject: Re: bug#25529: diagnosis and one approach to a fix To: Tom Tromey References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87a89y87zv.fsf@tromey.com> From: Dmitry Gutov Message-ID: <0c64a77a-fc01-e1dc-54d2-5564dde3f17f@yandex.ru> Date: Tue, 7 Feb 2017 15:11:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <87a89y87zv.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On 07.02.2017 15:07, Tom Tromey wrote: > Dmitry> I'm not sure. Normally, that helps deal with multiline literals, but > Dmitry> regexps in JavaScript are single-line. Maybe Stefan remembers. > > Based on discussion in the multi-mode thread, I'm thinking perhaps it > handles the case where the start of the regexp literal was syntax-ified > but not the end. That's the idea, but syntax-propertize runs syntax-propertize-extend-region-functions, which extends to the beginning of the line of the edited region. So if we made an edit inside a line containing a regexp, START should be at the beginning of that line. There could be some edge cases, though. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 07 09:56:49 2017 Received: (at 25529) by debbugs.gnu.org; 7 Feb 2017 14:56:49 +0000 Received: from localhost ([127.0.0.1]:59109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb7CK-00016R-Qq for submit@debbugs.gnu.org; Tue, 07 Feb 2017 09:56:48 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:12805) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb7CI-00016B-N0 for 25529@debbugs.gnu.org; Tue, 07 Feb 2017 09:56:47 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AcKQAu3EVY//7rSC1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnAImAZZehhwEAgKCEUQQAQIBAQEBAQEBYiiEaQEEAVYjBQsLDiYSFBgNJIh6CK0Ui0QBAQEHAgEkixmKKQWPfIpqmxqGOpIPNiB4Ew6FcyCJLQEBAQ X-IPAS-Result: A0AcKQAu3EVY//7rSC1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnAImAZZehhwEAgKCEUQQAQIBAQEBAQEBYiiEaQEEAVYjBQsLDiYSFBgNJIh6CK0Ui0QBAQEHAgEkixmKKQWPfIpqmxqGOpIPNiB4Ew6FcyCJLQEBAQ X-IronPort-AV: E=Sophos;i="5.33,749,1477972800"; d="scan'208";a="292261434" Received: from 45-72-235-254.cpe.teksavvy.com (HELO pastel.home) ([45.72.235.254]) by smtp.teksavvy.com with ESMTP; 07 Feb 2017 09:56:38 -0500 Received: by pastel.home (Postfix, from userid 20848) id 7A0DC657D7; Tue, 7 Feb 2017 09:56:38 -0500 (EST) From: Stefan Monnier To: Dmitry Gutov Subject: Re: bug#25529: diagnosis and one approach to a fix Message-ID: References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> Date: Tue, 07 Feb 2017 09:56:38 -0500 In-Reply-To: (Dmitry Gutov's message of "Tue, 7 Feb 2017 04:20:40 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> Also, what is the purpose of the first call to >> js-syntax-propertize-regexp in js-syntax-propertize? It tests if the start point is inside a regexp, and if so, does what's needed with it and moves to its end since the rest of the js-syntax-propertize code assumes we're outside of a regexp. > I'm not sure. Normally, that helps deal with multiline literals, but regexps > in JavaScript are single-line. Maybe Stefan remembers. I think I just didn't want to presume that the start point is never inside a regexp (not sure if I was aware that Javascrit doesn't support multiline regexps, but in any case I'd be surprised if there isn't some Javascript implementation somewhere which does). IOW I just reproduced the pattern I've used in many other syntax-propertize-functions. Maybe it's not needed, but it doesn't hurt. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 20:52:27 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 01:52:27 +0000 Received: from localhost ([127.0.0.1]:35205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccMrT-0005ef-I8 for submit@debbugs.gnu.org; Fri, 10 Feb 2017 20:52:27 -0500 Received: from gproxy7-pub.mail.unifiedlayer.com ([70.40.196.235]:59841) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ccMrQ-0005eO-8h for 25529@debbugs.gnu.org; Fri, 10 Feb 2017 20:52:25 -0500 Received: (qmail 22758 invoked by uid 0); 11 Feb 2017 01:52:13 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy7.mail.unifiedlayer.com with SMTP; 11 Feb 2017 01:52:13 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id jDs81u00c2f2jeq01DsBfV; Fri, 10 Feb 2017 18:52:13 -0700 X-Authority-Analysis: v=2.1 cv=H5NInYoi c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=zstS-IiYAAAA:8 a=v-9_DkjcF2juT0TuyBIA:9 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FUotk2qYBQ+yA37Beh4AsfkfV8P/0QRvm+TToHaiC7M=; b=lhXDGohhFPBJ1Ci255+VzYmyyw Mc4Nd7Q9hkYhTYO80sF8JyjE/ZdCb3A2IjL9uPWKA3OpNd4hj23OnAoPopFDu3Qu9aHBlOE9Et5xl aZsEMOzAoV1jF4C/H2flJNrzN; Received: from 75-171-188-196.hlrn.qwest.net ([75.171.188.196]:49386 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1ccMrA-00079P-LH; Fri, 10 Feb 2017 18:52:08 -0700 From: Tom Tromey To: Dmitry Gutov Subject: Re: bug#25529: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> X-Attribution: Tom Date: Fri, 10 Feb 2017 18:52:07 -0700 In-Reply-To: (Dmitry Gutov's message of "Tue, 7 Feb 2017 04:20:40 +0200") Message-ID: <87vash5wag.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.171.188.196 X-Exim-ID: 1ccMrA-00079P-LH X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-171-188-196.hlrn.qwest.net (bapiya) [75.171.188.196]:49386 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) >> I think I understand combining the regexps. But what does using a simple >> regexp for the closer mean? Dmitry> Simple handler (not regexp), for the group corresponding to the closer Dmitry> (what's called a HIGHLIGHTn in syntax-propertize-rules docstring). The Dmitry> string "\"/", probably. Ok, I looked at this a bit. My idea was to change js-syntax-propertize to incorporate the new regexp I wrote. However, after looking at this a bit, I think it's actually better the way it is. The reason is that the existing regexp in js-syntax-propertize ends with "[^/*]" -- to prevent recognizing "let x = /* comment */" as if it were using a regexp literal. While it's possible to add this to the new regexp, it's kind of ugly, since the regexp has to duplicate much of the body of the regexp just to exclude "*" as the first character. Conversely I don't think there's a drawback to the current approach. Here's the latest version of my patch. Let me know what you think. Tom commit 2518a9ca4ab59dbbfedc42a023267ae78476fc2e Author: Tom Tromey Date: Sun Feb 5 11:40:18 2017 -0700 Recognize JS regexp literals more correctly * lisp/progmodes/js.el (js--syntax-propertize-regexp-regexp): New constant. (js-syntax-propertize-regexp): Use it. Remove "end" argument. (js--syntax-propertize-regexp-syntax-table): Remove. (js-syntax-propertize): Update. * test/lisp/progmodes/js-tests.el (js-mode-regexp-syntax-bug-25529): New test. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e42e014..3d9c1b4 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1687,34 +1687,39 @@ js--font-lock-keywords js--font-lock-keywords-3) "Font lock keywords for `js-mode'. See `font-lock-keywords'.") -(defconst js--syntax-propertize-regexp-syntax-table - (let ((st (make-char-table 'syntax-table (string-to-syntax ".")))) - (modify-syntax-entry ?\[ "(]" st) - (modify-syntax-entry ?\] ")[" st) - (modify-syntax-entry ?\\ "\\" st) - st)) - -(defun js-syntax-propertize-regexp (end) +(defconst js--syntax-propertize-regexp-regexp + (rx + ;; Start of regexp. + "/" + (0+ (or + ;; Match characters outside of a character class. + (not (any ?\[ ?/ ?\\)) + ;; Match backslash quoted characters. + (and "\\" not-newline) + ;; Match character class. + (and + "[" + (0+ (or + (not (any ?\] ?\\)) + (and "\\" not-newline))) + "]"))) + (group "/")) + "Regular expression matching a JavaScript regexp literal.") + +(defun js-syntax-propertize-regexp () (let ((ppss (syntax-ppss))) (when (eq (nth 3 ppss) ?/) ;; A /.../ regexp. - (while - (when (re-search-forward "\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*/" - end 'move) - (if (nth 1 (with-syntax-table - js--syntax-propertize-regexp-syntax-table - (let ((parse-sexp-lookup-properties nil)) - (parse-partial-sexp (nth 8 ppss) (point))))) - ;; A / within a character class is not the end of a regexp. - t - (put-text-property (1- (point)) (point) - 'syntax-table (string-to-syntax "\"/")) - nil)))))) + (goto-char (nth 8 ppss)) + (when (looking-at js--syntax-propertize-regexp-regexp) + (put-text-property (match-beginning 1) (match-end 1) + 'syntax-table (string-to-syntax "\"/")) + (goto-char (match-end 0)))))) (defun js-syntax-propertize (start end) ;; JavaScript allows immediate regular expression objects, written /.../. (goto-char start) - (js-syntax-propertize-regexp end) + (js-syntax-propertize-regexp) (funcall (syntax-propertize-rules ;; Distinguish /-division from /-regexp chars (and from /-comment-starter). @@ -1736,7 +1741,7 @@ js-syntax-propertize (eval-when-compile (append "=({[,:;" '(nil)))))) (put-text-property (match-beginning 1) (match-end 1) 'syntax-table (string-to-syntax "\"/")) - (js-syntax-propertize-regexp end))))) + (js-syntax-propertize-regexp))))) ("\\`\\(#\\)!" (1 "< b"))) (point) end)) diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 7cb737c..d61f084 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -23,6 +23,7 @@ (require 'ert) (require 'js) +(require 'syntax) (ert-deftest js-mode-fill-bug-19399 () (with-temp-buffer @@ -99,6 +100,22 @@ (forward-line) (should (looking-at " \\* test")))) +(ert-deftest js-mode-regexp-syntax-bug-25529 () + (dolist (regexp-contents '("[^[]" + "[/]" + ;; A comment with the regexp on the next + ;; line. + "*comment*/\n/regexp")) + (with-temp-buffer + (js-mode) + (insert "let x = /" regexp-contents "/;\n") + (save-excursion (insert "something();\n")) + ;; The failure mode was that the regexp literal was not + ;; recognized, causing the next line to be given string syntax; + ;; but check for comment syntax as well to prevent an + ;; implementation not recognizing the comment example. + (should-not (syntax-ppss-context (syntax-ppss)))))) + (provide 'js-tests) ;;; js-tests.el ends here From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 22:46:04 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 03:46:04 +0000 Received: from localhost ([127.0.0.1]:35235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccOdQ-0001Xu-Ez for submit@debbugs.gnu.org; Fri, 10 Feb 2017 22:46:04 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:11336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccOdN-0001XG-5h for 25529@debbugs.gnu.org; Fri, 10 Feb 2017 22:46:02 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AgKQAu3EVY//7rSC1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnBAYAZZeGYYDBAICghFEEAECAQEBAQEBAWIohGkGViMQCzQSFBgNJIkCrRSLRAEBCAIBJIsZiikBBI98hQCFapJzAYgmhjqSDzYgeBMOhXMgiS0BAQE X-IPAS-Result: A0AgKQAu3EVY//7rSC1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnBAYAZZeGYYDBAICghFEEAECAQEBAQEBAWIohGkGViMQCzQSFBgNJIkCrRSLRAEBCAIBJIsZiikBBI98hQCFapJzAYgmhjqSDzYgeBMOhXMgiS0BAQE X-IronPort-AV: E=Sophos;i="5.33,749,1477972800"; d="scan'208";a="292617377" Received: from 45-72-235-254.cpe.teksavvy.com (HELO fmsmemgm.homelinux.net) ([45.72.235.254]) by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Feb 2017 22:45:54 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 3BFF1AE0F1; Fri, 10 Feb 2017 22:45:54 -0500 (EST) From: Stefan Monnier To: Tom Tromey Subject: Re: bug#25529: diagnosis and one approach to a fix Message-ID: References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> Date: Fri, 10 Feb 2017 22:45:54 -0500 In-Reply-To: <87vash5wag.fsf@tromey.com> (Tom Tromey's message of "Fri, 10 Feb 2017 18:52:07 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > -(defun js-syntax-propertize-regexp (end) > +(defun js-syntax-propertize-regexp () Removing the `end` argument is fundamentally wrong. It's OK to play it fast-and-loose and ignore that argument, but the function *should* keep the buffer untouched after `end`. > + (put-text-property (match-beginning 1) (match-end 1) ^^^^^^^^^^^^^ (min end (match-end 1)) should do it. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 23:06:48 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 04:06:48 +0000 Received: from localhost ([127.0.0.1]:35239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccOxU-00020o-8K for submit@debbugs.gnu.org; Fri, 10 Feb 2017 23:06:48 -0500 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:36253) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ccOxS-00020Z-Kx for 25529@debbugs.gnu.org; Fri, 10 Feb 2017 23:06:47 -0500 Received: (qmail 30795 invoked by uid 0); 11 Feb 2017 04:06:32 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy2.mail.unifiedlayer.com with SMTP; 11 Feb 2017 04:06:32 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id jG6R1u00b2f2jeq01G6UmX; Fri, 10 Feb 2017 21:06:32 -0700 X-Authority-Analysis: v=2.1 cv=Pets2ERd c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=KG2WNKdU-cRD97Zh_uAA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZjiCtssUDzUock0EY4h98kFsxv4OgfRRvt8r/S38uD4=; b=tWQ+337ae0DBZoCJOrgtiHnOWR dPZumQhrUXMIth9pnUv+ycbl6NacDke06Mmkb4kgqBzeUwftsLobL6rlpoTa4lp/3n5RvLVoviBWl POuKA6V1fhIG7OSpvUCdjgfKR; Received: from 75-171-188-196.hlrn.qwest.net ([75.171.188.196]:49604 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1ccOx7-0007IO-B6; Fri, 10 Feb 2017 21:06:25 -0700 From: Tom Tromey To: Stefan Monnier Subject: Re: bug#25529: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> X-Attribution: Tom Date: Fri, 10 Feb 2017 21:06:20 -0700 In-Reply-To: (Stefan Monnier's message of "Fri, 10 Feb 2017 22:45:54 -0500") Message-ID: <87r3355q2r.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.171.188.196 X-Exim-ID: 1ccOx7-0007IO-B6 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-171-188-196.hlrn.qwest.net (bapiya) [75.171.188.196]:49604 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) >>>>> "Stefan" == Stefan Monnier writes: >> -(defun js-syntax-propertize-regexp (end) >> +(defun js-syntax-propertize-regexp () Stefan> Removing the `end` argument is fundamentally wrong. It's OK to play it Stefan> fast-and-loose and ignore that argument, but the function *should* keep Stefan> the buffer untouched after `end`. I thought it was ok because the region is always extended to the end of the line, and I think this regexp can't span lines. >> + (put-text-property (match-beginning 1) (match-end 1) Stefan> ^^^^^^^^^^^^^ Stefan> (min end (match-end 1)) Stefan> should do it. If this change is still needed, should the final goto-char also be treated this way? Tom From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 23:22:32 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 04:22:32 +0000 Received: from localhost ([127.0.0.1]:35253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccPCi-0002O2-K0 for submit@debbugs.gnu.org; Fri, 10 Feb 2017 23:22:32 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:54831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccPCg-0002Np-RQ for 25529@debbugs.gnu.org; Fri, 10 Feb 2017 23:22:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AcKQAu3EVY//7rSC1XBhoBAQEBAgEBAQEIAQEBAYM4AQEBAQEfhFuFVJwCJgGWXoYcBAICghFEEAECAQEBAQEBAWIohGkBBAFWIwULCzQSFBgNJIh6CK0Ui0QBAQEHAgEkixmEOoVvBY98imqbGoY6kg82IHgTDoNcHIF7IIktAQEB X-IPAS-Result: A0AcKQAu3EVY//7rSC1XBhoBAQEBAgEBAQEIAQEBAYM4AQEBAQEfhFuFVJwCJgGWXoYcBAICghFEEAECAQEBAQEBAWIohGkBBAFWIwULCzQSFBgNJIh6CK0Ui0QBAQEHAgEkixmEOoVvBY98imqbGoY6kg82IHgTDoNcHIF7IIktAQEB X-IronPort-AV: E=Sophos;i="5.33,749,1477972800"; d="scan'208";a="292618527" Received: from 45-72-235-254.cpe.teksavvy.com (HELO ceviche.home) ([45.72.235.254]) by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Feb 2017 23:22:25 -0500 Received: by ceviche.home (Postfix, from userid 20848) id B748D6629F; Fri, 10 Feb 2017 23:22:23 -0500 (EST) From: Stefan Monnier To: Tom Tromey Subject: Re: bug#25529: diagnosis and one approach to a fix Message-ID: References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> <87r3355q2r.fsf@tromey.com> Date: Fri, 10 Feb 2017 23:22:23 -0500 In-Reply-To: <87r3355q2r.fsf@tromey.com> (Tom Tromey's message of "Fri, 10 Feb 2017 21:06:20 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) Stefan> Removing the `end` argument is fundamentally wrong. It's OK to play it Stefan> fast-and-loose and ignore that argument, but the function *should* keep Stefan> the buffer untouched after `end`. > I thought it was ok because the region is always extended to the end of > the line, and I think this regexp can't span lines. Why come up with complex semantic arguments when a simple `max` ensures the right behavior regardless of other assumptions? > If this change is still needed, should the final goto-char also be > treated this way? It's not needed there, no: the important part is to avoid modifying the buffer after `end` (although, as I said, it's not terribly bad if you do it: you'd only get burned by it in very unusual cases). Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 11 10:27:34 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 15:27:34 +0000 Received: from localhost ([127.0.0.1]:35831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccZaI-0004tw-6z for submit@debbugs.gnu.org; Sat, 11 Feb 2017 10:27:34 -0500 Received: from gproxy7-pub.mail.unifiedlayer.com ([70.40.196.235]:43440) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ccZaG-0004tk-BK for 25529@debbugs.gnu.org; Sat, 11 Feb 2017 10:27:32 -0500 Received: (qmail 17841 invoked by uid 0); 11 Feb 2017 15:27:16 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy7.mail.unifiedlayer.com with SMTP; 11 Feb 2017 15:27:16 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id jTTA1u00V2f2jeq01TTD3T; Sat, 11 Feb 2017 08:27:16 -0700 X-Authority-Analysis: v=2.1 cv=H5NInYoi c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=EH5AKhaK2ebAwYdbQ1UA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jkaOqvtRQsfNXv/u3NCZjrocg6C+/0hzB9Lhm4QvKqo=; b=q0oFP8ZoziW6fLW6pDNcB9DF6V KdjD3bpfqplygbVTVI2qLBa5+J+62K+eVhcbn2uv+d7GT6cdbSDTysmDdxu/joLe0yB4IodLmzwUM Ycy5UReXA9qljrsWvjOZ1Cgmn; Received: from 75-171-188-196.hlrn.qwest.net ([75.171.188.196]:49964 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1ccZZu-00074I-94; Sat, 11 Feb 2017 08:27:10 -0700 From: Tom Tromey To: Stefan Monnier Subject: Re: bug#25529: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> <87r3355q2r.fsf@tromey.com> X-Attribution: Tom Date: Sat, 11 Feb 2017 08:27:04 -0700 In-Reply-To: (Stefan Monnier's message of "Fri, 10 Feb 2017 23:22:23 -0500") Message-ID: <8737fk694n.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.171.188.196 X-Exim-ID: 1ccZZu-00074I-94 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-171-188-196.hlrn.qwest.net (bapiya) [75.171.188.196]:49964 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) >> I thought it was ok because the region is always extended to the end of >> the line, and I think this regexp can't span lines. Stefan> Why come up with complex semantic arguments when a simple `max` ensures Stefan> the right behavior regardless of other assumptions? I had already done it, so inertia. I'm making the change, but I think the fix has to look like this: (when (and (looking-at js--syntax-propertize-regexp-regexp) ;; Don't touch text after END. (<= (match-end 1) end)) (put-text-property (match-beginning 1) (match-end 1) 'syntax-table (string-to-syntax "\"/")) (goto-char (match-end 0)))))) ... the reason being, in the new regexp match #1 is just the terminating "/", which is the only character whose syntax we want to modify here. Let me know what you think. Tom From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 11 10:41:49 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 15:41:49 +0000 Received: from localhost ([127.0.0.1]:35847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccZo5-0005Em-BO for submit@debbugs.gnu.org; Sat, 11 Feb 2017 10:41:49 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:6064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccZo3-0005EZ-1w for 25529@debbugs.gnu.org; Sat, 11 Feb 2017 10:41:47 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AbKQAu3EVY//7rSC1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnAImAZZehhwEAgKCEUQQAQIBAQEBAQEBYiiEaQEEAVYjBQsLNBIUGA0kiHoIrRSLRAEBAQcCASSLGYopBY98imqSc4gnhjqSDzYgeBMOhXMgiS0BAQE X-IPAS-Result: A0AbKQAu3EVY//7rSC1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnAImAZZehhwEAgKCEUQQAQIBAQEBAQEBYiiEaQEEAVYjBQsLNBIUGA0kiHoIrRSLRAEBAQcCASSLGYopBY98imqSc4gnhjqSDzYgeBMOhXMgiS0BAQE X-IronPort-AV: E=Sophos;i="5.33,749,1477972800"; d="scan'208";a="292650621" Received: from 45-72-235-254.cpe.teksavvy.com (HELO ceviche.home) ([45.72.235.254]) by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 Feb 2017 10:41:40 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 4649B66206; Sat, 11 Feb 2017 10:41:40 -0500 (EST) From: Stefan Monnier To: Tom Tromey Subject: Re: bug#25529: diagnosis and one approach to a fix Message-ID: References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> <87r3355q2r.fsf@tromey.com> <8737fk694n.fsf@tromey.com> Date: Sat, 11 Feb 2017 10:41:40 -0500 In-Reply-To: <8737fk694n.fsf@tromey.com> (Tom Tromey's message of "Sat, 11 Feb 2017 08:27:04 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > I'm making the change, but I think the fix has to look like this: > (when (and (looking-at js--syntax-propertize-regexp-regexp) > ;; Don't touch text after END. > (<= (match-end 1) end)) > (put-text-property (match-beginning 1) (match-end 1) > 'syntax-table (string-to-syntax "\"/")) > (goto-char (match-end 0)))))) > ... the reason being, in the new regexp match #1 is just the terminating > "/", which is the only character whose syntax we want to modify here. Ah, I had misunderstood the code. Then yes. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 11 12:13:45 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 17:13:45 +0000 Received: from localhost ([127.0.0.1]:35875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccbF3-0007MM-9y for submit@debbugs.gnu.org; Sat, 11 Feb 2017 12:13:45 -0500 Received: from gproxy9-pub.mail.unifiedlayer.com ([69.89.20.122]:42510 helo=gproxy9.mail.unifiedlayer.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccbF1-0007M5-9K for 25529@debbugs.gnu.org; Sat, 11 Feb 2017 12:13:43 -0500 Received: from cmgw4 (unknown [10.0.90.85]) by gproxy9.mail.unifiedlayer.com (Postfix) with ESMTP id ABFEC1E0787 for <25529@debbugs.gnu.org>; Sat, 11 Feb 2017 10:13:35 -0700 (MST) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id jVDY1u00R2f2jeq01VDb41; Sat, 11 Feb 2017 10:13:35 -0700 X-Authority-Analysis: v=2.1 cv=Pets2ERd c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=h141kUg5biYyxMbhsogA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Peg+zuGGh029GjuxeNJ09C1EKsV7vlOXcdT//UtEnHI=; b=iffMjJGRaMqVUVrJdwqnxeOXTN kj9VOyic0R0dcpCWTcdr86HDhdHh4xzKmb5Cqf8YIZd/taNgVPfPk+zxmtUdo5sQ3o6/HLJoTW6pe +rqqT+F6lTxMWNyJYsraU2T/U; Received: from 75-171-188-196.hlrn.qwest.net ([75.171.188.196]:50494 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1ccbEq-0007PG-3y; Sat, 11 Feb 2017 10:13:32 -0700 From: Tom Tromey To: Stefan Monnier Subject: Re: bug#25529: diagnosis and one approach to a fix References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> <87r3355q2r.fsf@tromey.com> <8737fk694n.fsf@tromey.com> X-Attribution: Tom Date: Sat, 11 Feb 2017 10:13:31 -0700 In-Reply-To: (Stefan Monnier's message of "Sat, 11 Feb 2017 10:41:40 -0500") Message-ID: <87shnk4pms.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.171.188.196 X-Exim-ID: 1ccbEq-0007PG-3y X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-171-188-196.hlrn.qwest.net (bapiya) [75.171.188.196]:50494 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 25529 Cc: Tom Tromey , 25529@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) Stefan> Ah, I had misunderstood the code. Then yes. Thanks. I'll wait a little while in case Dmitry has comments, then I'll check it in. Tom From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 11 14:11:42 2017 Received: (at 25529) by debbugs.gnu.org; 11 Feb 2017 19:11:43 +0000 Received: from localhost ([127.0.0.1]:35897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccd5B-0001Y8-3a for submit@debbugs.gnu.org; Sat, 11 Feb 2017 14:11:41 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccd59-0001Xw-Ol for 25529@debbugs.gnu.org; Sat, 11 Feb 2017 14:11:40 -0500 Received: by mail-wm0-f68.google.com with SMTP id r18so11866049wmd.3 for <25529@debbugs.gnu.org>; Sat, 11 Feb 2017 11:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=owBKgVAK4nTa/n3uxHPu8erF8RmBZey8GltfPk5+8Us=; b=tOY0Yf5J6HFrrIB05T+rFzN5jjYmgAfhsBspsOSE4pNJBx0b0nydbvM+3xYSErYLCC mOj6i/fI6/KMPjVUdboV9A7cBQSqson9lBW6zlKhC9Zt9jk8esfGZ2qHQZNPQMI/62RM L4C1OdK9vw+RmZRfFPNTmDym+Ltp4ISsZ17f46dozH+E7gLtdn8t7Zu+llRw6k+pymKp wvLRhf6HycaB3UqIRYjlQg4O5dRVXyMDlgbW5PyDgfgv24cmF2Ls8gtykzusHsltxb+9 3MmzytI+tUlKwhnSAfDR7OMAUDGtI90TZpU/lZNqvbn4fOmWbgCxr23vcaOuDROnVp0B ApnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=owBKgVAK4nTa/n3uxHPu8erF8RmBZey8GltfPk5+8Us=; b=REJUN8meCy7Qbi2dgjNSDzPkdZm40w2xoIhMrWsK7MFXhNlHBdNhhDU7KrfB9UHrs/ q3EDFxsCUUmYtdzV87e4fm/LMGB10V7Em4DyqVyVzBpWWAJdYAO4yzvSilK+f8Zghe95 knBFVvI/bG05L8SUvKYWg+fs1GCqsZ8qeXvYdJZHEFf2cbOtjHl8B6P4OItrlNpioejd H0MIxWzFrZhF4/29wCR/A3sGX1W5CSyuZNwIw7JY64IZcOOe7hSbdz/T3P1Y1CPWiZfE 8NQZHaMRLhKwAO3CFV1pTtHShs87zFxFsaw5zjx0N9rB9WZyOjkwIkdw7GSis835dBWJ V9QA== X-Gm-Message-State: AMke39l94JEEtLiMHgd8ftDjDuhSXpA+5nobHgfX3kWTE8EDC7856DJLdmbrG09/DB2cIg== X-Received: by 10.28.54.90 with SMTP id d87mr32909517wma.89.1486840293677; Sat, 11 Feb 2017 11:11:33 -0800 (PST) Received: from [192.168.1.3] ([185.105.173.41]) by smtp.googlemail.com with ESMTPSA id 133sm4288326wmj.27.2017.02.11.11.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Feb 2017 11:11:32 -0800 (PST) Subject: Re: bug#25529: diagnosis and one approach to a fix To: Tom Tromey , Stefan Monnier References: <87wpd58ag6.fsf@tromey.com> <87shnt89be.fsf@tromey.com> <87o9yg8qdi.fsf@tromey.com> <87k2948onb.fsf@tromey.com> <183374a4-6469-44af-6ae6-fec02874547a@yandex.ru> <87bmuf8c1l.fsf@tromey.com> <87vash5wag.fsf@tromey.com> <87r3355q2r.fsf@tromey.com> <8737fk694n.fsf@tromey.com> <87shnk4pms.fsf@tromey.com> From: Dmitry Gutov Message-ID: Date: Sat, 11 Feb 2017 21:11:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <87shnk4pms.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25529 Cc: 25529@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On 11.02.2017 19:13, Tom Tromey wrote: > I'll wait a little while in case Dmitry has comments, then I'll > check it in. LGTM, thanks! From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 11 14:37:44 2017 Received: (at 25529-done) by debbugs.gnu.org; 11 Feb 2017 19:37:44 +0000 Received: from localhost ([127.0.0.1]:35914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccdUO-000295-Es for submit@debbugs.gnu.org; Sat, 11 Feb 2017 14:37:44 -0500 Received: from gproxy9-pub.mail.unifiedlayer.com ([69.89.20.122]:35252 helo=gproxy9.mail.unifiedlayer.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccdUM-00028q-M1 for 25529-done@debbugs.gnu.org; Sat, 11 Feb 2017 14:37:43 -0500 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy9.mail.unifiedlayer.com (Postfix) with ESMTP id E9BDA1E1783 for <25529-done@debbugs.gnu.org>; Sat, 11 Feb 2017 12:37:32 -0700 (MST) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id jXdR1u0042f2jeq01XdURm; Sat, 11 Feb 2017 12:37:32 -0700 X-Authority-Analysis: v=2.1 cv=U+QBU4bu c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=n2v9WMKugxEA:10 a=h0JqVpTDDR_UVJJZ95UA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9royt92FP4AiUfH1Q0/qmoU6DplYlZ3auJzrx6XZSSU=; b=NzYV2l4iqX1VHPyWVxsZJs6+jA O+LvYg7Bojg/CyJalLi3gUBmYEewHRbJUmtwN0pheBhFTrHsbwIjPJOdvXVXoonyIb0io6Nv/USmt /EtUesVFUCD9brbo3wKgKPA3E; Received: from 75-171-188-196.hlrn.qwest.net ([75.171.188.196]:51068 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1ccdU4-0000Qu-Ra; Sat, 11 Feb 2017 12:37:24 -0700 From: Tom Tromey To: 25529-done@debbugs.gnu.org Subject: done X-Attribution: Tom Date: Sat, 11 Feb 2017 12:37:22 -0700 Message-ID: <871sv44iz1.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.171.188.196 X-Exim-ID: 1ccdU4-0000Qu-Ra X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-171-188-196.hlrn.qwest.net (bapiya) [75.171.188.196]:51068 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 25529-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) I've checked in the patch. Tom From unknown Sat Sep 06 05:03:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 12 Mar 2017 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator