[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: perl-mode - fix syntax of anonymous sub prototypes
From: |
Giuliano Procida |
Subject: |
Re: perl-mode - fix syntax of anonymous sub prototypes |
Date: |
Sat, 29 Mar 2008 08:43:28 +0000 |
I have verified the problem against a recent Ubuntu snapshot.
GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.12.9) of
2008-03-19 on vernadsky, modified by Debian
However, it looks like the latest HEAD has a completely different regexp.
;; Funny things in sub arg specifications like `sub myfunc ($$)'
;; Be careful not to match "sub { (...) ... }".
("\\<sub[[:space:]]+[^{}[:punct:][:space:]]+[[:space:]]*(\\([^)]+\\))"
1 '(1))
It is still wrong for anonymous subs. Should be (untested):
"\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))"
Here is a simple test case.
#!/usr/bin/perl
use strict;
use warnings;
# the $ in the next line has syntax-table (1)
sub add ($) {
my ($a) = @_;
# the $ in the next line does not
return sub ($) {
my ($b) = @_;
return $a+$b;
# the brace on the next line will be misindented on TAB
};
}
# the following line will also be misindented on TAB
print "1+2=", &{add(1)}(2), "\n";
Regards,
Giuliano Procida.