line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MS2::Parser; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
15555
|
use v5.12; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
159
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use namespace::autoclean; |
8
|
|
|
|
|
|
|
use MS2::Header; |
9
|
|
|
|
|
|
|
use MS2::Scan; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.062'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'header' => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => 'MS2::Header', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'scanlist' => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
isa => 'ArrayRef', |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub parse { |
25
|
|
|
|
|
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
my $path = shift; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
open (my $file, '<', $path) or die "[Error]: Could not opne file!\n"; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $header = MS2::Header->new(); |
31
|
|
|
|
|
|
|
my $scan; |
32
|
|
|
|
|
|
|
my @scanlist; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $flag = 0; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
while ( my $line = <$file> ) { |
37
|
|
|
|
|
|
|
chomp $line; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
if ( $line =~ m/^H/ ) { |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$flag = 1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} elsif ( $line =~ m/^S/ ) { |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
if ($scan) { |
46
|
|
|
|
|
|
|
push(@scanlist, $scan); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$flag = 2; |
50
|
|
|
|
|
|
|
$scan = MS2::Scan->new(); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} elsif ( $line =~ m/^[IZ]/ ) { |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$flag = 2; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} elsif ( $line =~ m/^\d/ ) { |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$flag = 3; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
if ( eof ) { |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
push(@scanlist, $scan); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
if ( $flag == 1 ) { |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$header->parse($line); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} elsif ( $flag == 2 ) { |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$scan->parse($line); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} elsif ( $flag == 3 ) { |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$scan->parse($line); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$self->header($header); |
82
|
|
|
|
|
|
|
$self->scanlist(\@scanlist); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |