GNU bug report logs - #11014
cperl syntax highlighting breaking on certain complex regular expressions

Previous Next

Package: emacs;

Reported by: Nathan Trapuzzano <nbtrap <at> nbtrap.com>

Date: Wed, 14 Mar 2012 16:46:02 UTC

Severity: minor

Tags: moreinfo, unreproducible

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Cc: 11014 <at> debbugs.gnu.org
Subject: bug#11014: cperl syntax highlighting breaking on certain complex regular expressions
Date: Wed, 14 Mar 2012 23:11:48 -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 <at> 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.





This bug report was last modified 5 years and 230 days ago.

Previous Next


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