line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Farly::ASA::Builder;
|
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
15887
|
use 5.008008;
|
|
8
|
|
|
|
|
32
|
|
|
8
|
|
|
|
|
309
|
|
4
|
8
|
|
|
8
|
|
44
|
use strict;
|
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
253
|
|
5
|
8
|
|
|
8
|
|
43
|
use warnings;
|
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
340
|
|
6
|
8
|
|
|
8
|
|
41
|
use Carp;
|
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
667
|
|
7
|
8
|
|
|
8
|
|
706
|
use Log::Any qw($log);
|
|
8
|
|
|
|
|
2046
|
|
|
8
|
|
|
|
|
68
|
|
8
|
8
|
|
|
8
|
|
4590
|
use Farly::Builder;
|
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
195
|
|
9
|
8
|
|
|
8
|
|
4315
|
use Farly::ASA::Filter;
|
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
245
|
|
10
|
8
|
|
|
8
|
|
4578
|
use Farly::ASA::Parser;
|
|
8
|
|
|
|
|
30
|
|
|
8
|
|
|
|
|
266
|
|
11
|
8
|
|
|
8
|
|
6073
|
use Farly::ASA::Annotator;
|
|
8
|
|
|
|
|
31
|
|
|
8
|
|
|
|
|
253
|
|
12
|
8
|
|
|
8
|
|
5094
|
use Farly::ASA::Rewriter;
|
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
263
|
|
13
|
8
|
|
|
8
|
|
4617
|
use Farly::ASA::Generator;
|
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
210
|
|
14
|
8
|
|
|
8
|
|
48
|
use Farly::ASA::PortFormatter;
|
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
157
|
|
15
|
8
|
|
|
8
|
|
41
|
use Farly::ASA::ProtocolFormatter;
|
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
143
|
|
16
|
8
|
|
|
8
|
|
35
|
use Farly::ASA::ICMPFormatter;
|
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
3116
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.26';
|
19
|
|
|
|
|
|
|
our @ISA = 'Farly::Builder';
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new {
|
22
|
6
|
|
|
6
|
0
|
22
|
my ($class) = @_;
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#call the constructor of the parent class
|
25
|
6
|
|
|
|
|
71
|
my $self = $class->SUPER::new();
|
26
|
6
|
|
|
|
|
18
|
bless $self, $class;
|
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
29
|
$log->info("$self NEW");
|
29
|
|
|
|
|
|
|
|
30
|
6
|
|
|
|
|
23
|
return $self;
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub run {
|
34
|
5
|
|
|
5
|
0
|
11
|
my ($self) = @_;
|
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
40
|
my $filter = Farly::ASA::Filter->new();
|
37
|
5
|
|
|
|
|
41
|
my $parser = Farly::ASA::Parser->new();
|
38
|
5
|
|
|
|
|
85
|
my $annotator = Farly::ASA::Annotator->new();
|
39
|
5
|
|
|
|
|
54
|
my $rewriter = Farly::ASA::Rewriter->new();
|
40
|
5
|
|
|
|
|
54
|
my $generator = Farly::ASA::Generator->new();
|
41
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
73
|
$filter->set_file( $self->file() );
|
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
39
|
my @preprocessed_file = $filter->run();
|
45
|
|
|
|
|
|
|
|
46
|
5
|
50
|
|
|
|
46
|
confess "configuration not recognized"
|
47
|
|
|
|
|
|
|
unless ( scalar(@preprocessed_file) > 0 );
|
48
|
|
|
|
|
|
|
|
49
|
5
|
|
|
|
|
11
|
my $parse_tree;
|
50
|
|
|
|
|
|
|
|
51
|
5
|
|
|
|
|
22
|
foreach my $line (@preprocessed_file) {
|
52
|
|
|
|
|
|
|
|
53
|
325
|
|
|
|
|
716
|
eval {
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#get the parse tree for the current line
|
56
|
325
|
|
|
|
|
1573
|
$parse_tree = $parser->parse($line);
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#turn the tokens into objects
|
59
|
325
|
|
|
|
|
9128
|
$annotator->visit($parse_tree);
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#rewrite the parse tree into an abstract syntax tree (AST)
|
62
|
325
|
|
|
|
|
1666
|
my $ast = $rewriter->rewrite($parse_tree);
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#convert the AST into an Farly::Object object
|
65
|
|
|
|
|
|
|
#which is stored in the generator's container object
|
66
|
325
|
|
|
|
|
1780
|
$generator->visit($ast);
|
67
|
|
|
|
|
|
|
};
|
68
|
325
|
50
|
|
|
|
1306
|
if ($@) {
|
69
|
0
|
|
|
|
|
0
|
my $err = $@;
|
70
|
0
|
|
|
|
|
0
|
$log->fatal( $self->file() . "\n: $line \n $err\n" );
|
71
|
0
|
|
|
|
|
0
|
chomp($line);
|
72
|
0
|
|
|
|
|
0
|
die "Problem at line :\n$line\nError : $@";
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
|
77
|
5
|
|
|
|
|
26
|
$self->{CONTAINER} = $generator->container();
|
78
|
|
|
|
|
|
|
|
79
|
5
|
|
|
|
|
392
|
return;
|
80
|
|
|
|
|
|
|
}
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub result {
|
83
|
5
|
|
|
5
|
0
|
47
|
return $_[0]->{CONTAINER};
|
84
|
|
|
|
|
|
|
}
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1;
|
87
|
|
|
|
|
|
|
__END__
|