line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Declare::Parser::Emulate; |
2
|
1
|
|
|
1
|
|
1063
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use base 'Devel::Declare::Parser'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
81
|
|
5
|
1
|
|
|
1
|
|
6
|
use Data::Dumper; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
52
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->add_accessor( 'test_line' ); |
9
|
1
|
|
|
1
|
|
6
|
use Devel::Declare::Interface; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
536
|
|
10
|
|
|
|
|
|
|
Devel::Declare::Interface::register_parser( 'test' ); |
11
|
|
|
|
|
|
|
|
12
|
387
|
|
|
387
|
1
|
749
|
sub line { shift->test_line( @_ )} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub skipspace { |
15
|
70
|
|
|
70
|
1
|
61
|
my $self = shift; |
16
|
70
|
100
|
|
|
|
130
|
return unless $self->peek_remaining =~ m/^(\s+)/; |
17
|
20
|
|
|
|
|
72
|
$self->advance(length($1)); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#XXX !BEWARE! Will not work for nested quoting, even escaped |
21
|
|
|
|
|
|
|
# This is a very dumb implementation. |
22
|
|
|
|
|
|
|
sub _quoted_from_dd { |
23
|
8
|
|
|
8
|
|
9
|
my $self = shift; |
24
|
8
|
|
|
|
|
22
|
my $start = $self->peek_num_chars(1); |
25
|
8
|
|
|
|
|
29
|
my $end = $self->end_quote( $start ); |
26
|
8
|
|
|
|
|
18
|
my $regex = "^\\$start\([^$end]*)\\$end"; |
27
|
8
|
|
|
|
|
21
|
$self->peek_remaining =~ m/$regex/; |
28
|
8
|
|
|
|
|
24
|
my $quoted = $1; |
29
|
|
|
|
|
|
|
|
30
|
8
|
50
|
|
|
|
18
|
croak( "qfdd regex: |$regex| did not get complete quote." ) |
31
|
|
|
|
|
|
|
unless $quoted; |
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
|
|
31
|
return ( length( $quoted ) + 2, $quoted ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _peek_is_word { |
37
|
37
|
|
|
37
|
|
38
|
my $self = shift; |
38
|
37
|
|
|
|
|
65
|
my $start = $self->peek_num_chars(1); |
39
|
37
|
100
|
|
|
|
158
|
return 0 unless $start =~ m/^[A-Za-z_]$/; |
40
|
21
|
|
|
|
|
38
|
$self->peek_remaining =~ m/^(\w+)/; |
41
|
21
|
|
|
|
|
106
|
return length($1); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _linestr_offset_from_dd { |
45
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
46
|
1
|
|
|
|
|
3
|
return length($self->line); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub rewrite { |
50
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
51
|
2
|
|
|
|
|
5
|
$self->new_parts( $self->parts ); |
52
|
2
|
|
|
|
|
7
|
1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub write_line { |
56
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
57
|
2
|
|
|
|
|
18
|
$self->SUPER::write_line(); |
58
|
2
|
100
|
|
|
|
5
|
$self->_scope_end("$self") if $self->end_char eq '{'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Devel::Declare::Parser::Emulate - Parser that emulates Devel-Declare |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 TESTING ONLY |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
For testing purposes only. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHORS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Chad Granum L |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Copyright (C) 2010 Chad Granum |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Devel-Declare-Parser is free software; Standard perl licence. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Devel-Declare-Parser is distributed in the hope that it will be useful, but |
82
|
|
|
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
83
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. |