GNU bug report logs -
#26037
25.1; perl-mode add syntax support for subroutine signatures
Previous Next
Reported by: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
Date: Thu, 9 Mar 2017 17:25:02 UTC
Severity: wishlist
Tags: fixed, patch
Found in version 25.1
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
The regex is now updated to include all the chars $%&*;@[\]
I got the list of chars from here
http://perldoc.perl.org/perlsub.html#Prototypes
This is the diff, please let me if it can be improved:
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index a516f07..43eb462 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -257,7 +257,7 @@
(1 (prog1 "\"" (perl-syntax-propertize-special-constructs end))))
;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'.
;; Be careful not to match "sub { (...) ... }".
- ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+\\))"
+
("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([][$%&*;@\\]+\\))"
(1 "."))
;; Turn __DATA__ trailer into a comment.
("^\\(_\\)_\\(?:DATA\\|END\\)__[
\t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)"
On Sat, Mar 18, 2017 at 5:58 PM, <npostavs <at> users.sourceforge.net> wrote:
> Евгени Колев <evgenysw <at> gmail.com> writes:
>
> >
> > After giving some thought to this, I think we can instead
> > make the regex more strict so that it matches only the
> > allowed characters in perl's prototypes. The allowed chars
> > are: $%&*;@[\]
> >
> > This is what I have in mind - diff is pasted below.
> > However, please note the change below doesn't handle
> > these 3 chars [ / ] I'll add them if you think this is the correct
> > approach:
>
> Yeah, that looks right to me (although I don't know perl very well).
>
[Message part 2 (text/html, inline)]
This bug report was last modified 8 years and 51 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.