line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Declare::Parser::Emulate; |
2
|
1
|
|
|
1
|
|
754
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
4
|
1
|
|
|
1
|
|
3
|
use base 'Devel::Declare::Parser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
5
|
1
|
|
|
1
|
|
5
|
use Data::Dumper; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->add_accessor( 'test_line' ); |
9
|
1
|
|
|
1
|
|
4
|
use Devel::Declare::Interface; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
365
|
|
10
|
|
|
|
|
|
|
Devel::Declare::Interface::register_parser( 'test' ); |
11
|
|
|
|
|
|
|
|
12
|
387
|
|
|
387
|
1
|
616
|
sub line { shift->test_line( @_ )} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub skipspace { |
15
|
70
|
|
|
70
|
1
|
49
|
my $self = shift; |
16
|
70
|
100
|
|
|
|
122
|
return unless $self->peek_remaining =~ m/^(\s+)/; |
17
|
20
|
|
|
|
|
52
|
$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
|
|
11
|
my $self = shift; |
24
|
8
|
|
|
|
|
15
|
my $start = $self->peek_num_chars(1); |
25
|
8
|
|
|
|
|
19
|
my $end = $self->end_quote( $start ); |
26
|
8
|
|
|
|
|
11
|
my $regex = "^\\$start\([^$end]*)\\$end"; |
27
|
8
|
|
|
|
|
13
|
$self->peek_remaining =~ m/$regex/; |
28
|
8
|
|
|
|
|
15
|
my $quoted = $1; |
29
|
|
|
|
|
|
|
|
30
|
8
|
50
|
|
|
|
17
|
croak( "qfdd regex: |$regex| did not get complete quote." ) |
31
|
|
|
|
|
|
|
unless $quoted; |
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
|
|
19
|
return ( length( $quoted ) + 2, $quoted ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _peek_is_word { |
37
|
37
|
|
|
37
|
|
33
|
my $self = shift; |
38
|
37
|
|
|
|
|
62
|
my $start = $self->peek_num_chars(1); |
39
|
37
|
100
|
|
|
|
111
|
return 0 unless $start =~ m/^[A-Za-z_]$/; |
40
|
21
|
|
|
|
|
32
|
$self->peek_remaining =~ m/^(\w+)/; |
41
|
21
|
|
|
|
|
81
|
return length($1); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _linestr_offset_from_dd { |
45
|
1
|
|
|
1
|
|
1
|
my $self = shift; |
46
|
1
|
|
|
|
|
2
|
return length($self->line); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub rewrite { |
50
|
2
|
|
|
2
|
1
|
1
|
my $self = shift; |
51
|
2
|
|
|
|
|
5
|
$self->new_parts( $self->parts ); |
52
|
2
|
|
|
|
|
5
|
1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub write_line { |
56
|
2
|
|
|
2
|
1
|
2
|
my $self = shift; |
57
|
2
|
|
|
|
|
7
|
$self->SUPER::write_line(); |
58
|
2
|
100
|
|
|
|
8
|
$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. |