line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Document::AST; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
sub new { |
4
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
5
|
0
|
|
0
|
|
|
|
my $self = bless { @_ }, ref($class) || $class; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub init { |
9
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
10
|
0
|
|
|
|
|
|
die "You need to override Document::AST::insert"; |
11
|
|
|
|
|
|
|
# $self->{output} = []; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub content { |
15
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
16
|
0
|
|
|
|
|
|
return $self->{output}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub insert { |
20
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my $ast = shift; |
22
|
0
|
|
|
|
|
|
die "You need to override Document::AST::insert"; |
23
|
|
|
|
|
|
|
# $self->{output} .= $ast->{output}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub begin_node { |
27
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
28
|
0
|
|
|
|
|
|
my $tag = shift; |
29
|
0
|
|
|
|
|
|
die "You need to override Document::AST::begin_node"; |
30
|
|
|
|
|
|
|
# $self->{output} .= "+$tag\n"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub end_node { |
34
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
35
|
0
|
|
|
|
|
|
my $tag = shift; |
36
|
0
|
|
|
|
|
|
die "You need to override Document::AST::end_node"; |
37
|
|
|
|
|
|
|
# $self->{output} .= "-$tag\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub text_node { |
41
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
my $text = shift; |
43
|
0
|
|
|
|
|
|
die; |
44
|
|
|
|
|
|
|
# $self->{output} .= " $text\n"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |