blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/KeywordDeclare.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 51 SCAR 24.8
CC
3
Cov
0%
parse_keyword_args
6.0
parse_unkeyword_args
6.0
register
2.0
CRAP 12.0
1 package Perl::PrereqScanner::NotQuiteLite::Parser::KeywordDeclare;
2  
3 use strict;
4 use warnings;
5 use Perl::PrereqScanner::NotQuiteLite::Util;
6  
7 sub register { return {
8 use => {
9 'Keyword::Declare' => 'parse_keyword_declare_args',
10 },
11 }}
12  
13 sub parse_keyword_declare_args {
14 my ($class, $c, $used_module, $raw_tokens) = @_;
15  
16 $c->register_sub_keywords(qw/keyword/);
17 $c->register_keywords(qw/keytype is unkeyword/);
18 $c->register_op_keywords(qw/is/);
19  
20 $c->register_sub_parser(
21 'keyword',
22 [$class, 'parse_keyword_args', $used_module],
23 );
24 $c->register_keyword_parser(
25 'unkeyword',
26 [$class, 'parse_unkeyword_args', $used_module],
27 );
28 }
29  
30 sub parse_keyword_args {
31 my ($class, $c, $used_module, $raw_tokens) = @_;
32  
33 my $tokens = convert_string_tokens($raw_tokens);
34 shift @$tokens; # discard keyword
35  
36 if (ref $tokens->[0] and $tokens->[0][1]) {
37 $c->register_keywords($tokens->[0][1]);
38 }
39 }
40  
41 sub parse_unkeyword_args {
42 my ($class, $c, $used_module, $raw_tokens) = @_;
43  
44 my $tokens = convert_string_tokens($raw_tokens);
45 shift @$tokens; # discard unkeyword
46  
47 if (ref $tokens->[0] and $tokens->[0][1]) {
48 $c->remove_keywords($tokens->[0][0]);
49 }
50 }
51  
52 1;
53  
54 __END__