line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=============================================================================== |
2
|
|
|
|
|
|
|
# FILE: Games::Go::AGA::Parse |
3
|
|
|
|
|
|
|
# ABSTRACT: parsers for various AGA format files |
4
|
|
|
|
|
|
|
# AUTHOR: Reid Augustin (REID), |
5
|
|
|
|
|
|
|
# COMPANY: LucidPort Technology, Inc. |
6
|
|
|
|
|
|
|
# CREATED: 12/02/2010 08:51:22 AM PST |
7
|
|
|
|
|
|
|
#=============================================================================== |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1820
|
use 5.002; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
132
|
|
10
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
93
|
|
11
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
350
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Games::Go::AGA::Parse; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.042'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
3
|
|
|
3
|
0
|
1301
|
my ($proto, %opts) = @_; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
33
|
|
|
24
|
my $class = ref $proto || $proto; |
21
|
3
|
|
|
|
|
12
|
my $self = bless {}, $class; |
22
|
3
|
|
|
|
|
8
|
foreach my $key (qw( |
23
|
|
|
|
|
|
|
filename |
24
|
|
|
|
|
|
|
handle |
25
|
|
|
|
|
|
|
)) { |
26
|
6
|
100
|
|
|
|
22
|
if ($opts{$key}) { |
27
|
3
|
|
|
3
|
|
23
|
no strict 'refs'; ## no critic |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
912
|
|
28
|
1
|
|
|
|
|
6
|
$self->$key(delete $opts{$key}); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
3
|
50
|
|
|
|
16
|
if (%opts) { |
32
|
0
|
|
|
|
|
0
|
die "unknown option(s): ", join("\n", %opts); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
10
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub filename { |
39
|
6
|
|
|
6
|
0
|
9
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
6
|
100
|
|
|
|
34
|
$self->{filename} = $_[0] if(@_); |
42
|
6
|
|
|
|
|
44
|
return $self->{filename}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub handle { |
46
|
5
|
|
|
5
|
0
|
7
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
5
|
50
|
|
|
|
15
|
$self->{handle} = $_[0] if(@_); |
49
|
5
|
|
|
|
|
53
|
return $self->{handle}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
*parse = \&parse_line; # alias parse to parse_line |
53
|
|
|
|
|
|
|
sub parse_line { |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
0
|
0
|
Games::Go::AGA::Parse::Exception->throw( |
56
|
|
|
|
|
|
|
error => "Don't use Games::Go::AGA::Parse directly, use Games::Go::AGA::Parse::SOMETHING", |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _parse_error { |
61
|
5
|
|
|
5
|
|
28
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
5
|
|
|
|
|
30
|
Games::Go::AGA::Parse::Exception->throw( |
64
|
|
|
|
|
|
|
@_, |
65
|
|
|
|
|
|
|
filename => $self->filename, |
66
|
|
|
|
|
|
|
handle => $self->handle, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |