all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Nathan Trapuzzano <nbtrap@nbtrap.com>
Cc: 11014@debbugs.gnu.org
Subject: bug#11014: cperl syntax highlighting breaking on certain complex regular expressions
Date: Wed, 14 Mar 2012 23:11:48 -0400	[thread overview]
Message-ID: <jwvr4wusgpg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20120314090534.66398623@nbtrap.com> (Nathan Trapuzzano's message of "Wed, 14 Mar 2012 09:05:34 -0400")

> Syntax highlighting in cperl-mode breaks for certain (or perhaps all)
> complex regular expressions modified by /e and/or /x.

I'm not familiar enough with cperl-mode's syntax fontification code to
help fix it, but FWIW, your second example works right in perl-mode, and
I've just fixed its code (with the patch below) so it also works right
on your first example.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-03-15 01:38:40 +0000
+++ lisp/ChangeLog	2012-03-15 03:09:10 +0000
@@ -1,5 +1,8 @@
 2012-03-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* progmodes/perl-mode.el (perl-syntax-propertize-special-constructs):
+	Fix up parsing of multiline twoarg non-paired elements (bug#11014).
+
 	* imenu.el: Fix multiple inheritance breakage (bug#9199).
 	(imenu-add-to-menubar): Don't add a redundant index.
 	(imenu-update-menubar): Handle a dynamically composed keymap.

=== modified file 'lisp/progmodes/perl-mode.el'
--- lisp/progmodes/perl-mode.el	2012-01-19 07:21:25 +0000
+++ lisp/progmodes/perl-mode.el	2012-03-15 03:05:36 +0000
@@ -388,7 +388,11 @@
                       ;; In case of error, make sure we don't move backward.
 		      (scan-error (goto-char startpos) nil))
 		  (not (or (nth 8 (parse-partial-sexp
-				   (point) limit nil nil state 'syntax-table))
+				   ;; Since we don't know if point is within
+				   ;; the first or the scond arg, we have to
+				   ;; start from the beginning.
+				   (if twoargs (1+ (nth 8 state)) (point))
+				   limit nil nil state 'syntax-table))
 			   ;; If we have a self-paired opener and a twoargs
 			   ;; command, the form is s/../../ so we have to skip
 			   ;; a second time.






  reply	other threads:[~2012-03-15  3:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 13:05 bug#11014: cperl syntax highlighting breaking on certain complex regular expressions Nathan Trapuzzano
2012-03-15  3:11 ` Stefan Monnier [this message]
2019-11-01 20:22 ` Stefan Kangas
2019-12-01  7:50   ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr4wusgpg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=11014@debbugs.gnu.org \
    --cc=nbtrap@nbtrap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.