I'm trying to update a xml-file for syntax-highlighting and therefor I was wondering what's the simplest way to get a list of all Perl built-in-functions.
Here is quick implementation of cnicutar's idea:
use Pod::Find qw(pod_where);
my $perlfunc_path = pod_where({ -inc => 1 }, 'perlfunc');
open my $in, "<", $perlfunc_path or die "$perlfunc_path: $!";
while(<$in>) {
last if /=head2 Alphabetical/;
}
while(<$in>) {
print "$1\n" if /=item (.{2,})/;
}
Gives you list including parameters like this:
-X FILEHANDLE
-X EXPR
-X DIRHANDLE
-X
abs VALUE
abs
...
Look at the toke.c file in the perl
source:
$ perl -nE 'next unless /case KEY_(\S+):/; say $1' toke.c | sort | uniq
You'll find many of the things that won't show up in perlfunc. However, that depends on how you want to segment that various things that you want to color.
You could also look at PPI, a static Perl parser, or the existing Perl syntax highlighters.
I would parse perldoc perlfunc
(the part "Perl Functions by Category").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With