blob: 83acbbdb272a9dfad4fe16af08f05c98b32dd68a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
package Parse::Keyword;
use strict;
use warnings;
use 5.014;
# ABSTRACT: write syntax extensions in perl
use Devel::CallParser;
use XSLoader;
XSLoader::load(
__PACKAGE__,
exists $Parse::Keyword::{VERSION} ? ${ $Parse::Keyword::{VERSION} } : (),
);
=head1 SYNOPSIS
=head1 DESCRIPTION
=cut
=func lex_peek
=func lex_read
=func lex_read_space
=func parse_block
=func compiling_package
=cut
sub import {
my $package = shift;
my ($keywords) = @_;
my $caller = caller;
for my $keyword (keys %$keywords) {
my $sub = do {
no strict 'refs';
\&{ $caller . '::' . $keyword };
};
install_keyword_handler($sub, $keywords->{$keyword});
}
my @helpers = qw(
lex_peek
lex_read_space
lex_read
parse_block
parse_arithexpr
compiling_package
lex_stuff
);
for my $helper (@helpers) {
no strict 'refs';
*{ $caller . '::' . $helper } = \&{ __PACKAGE__ . '::' . $helper };
}
}
=head1 BUGS
No known bugs.
Please report any bugs to GitHub Issues at
L<https://github.com/doy/parse-keyword/issues>.
=head1 SEE ALSO
L<Devel::Declare>
L<Devel::CallParser>
=head1 SUPPORT
You can find this documentation for this module with the perldoc command.
perldoc Parse::Keyword
You can also look for information at:
=over 4
=item * MetaCPAN
L<https://metacpan.org/release/Parse-Keyword>
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-Keyword>
=item * Github
L<https://github.com/doy/parse-keyword>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Parse-Keyword>
=back
=begin Pod::Coverage
install_keyword_handler
=end Pod::Coverage
=cut
1;
|