line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Goo::Thing::pm::Compiler; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
############################################################################### |
6
|
|
|
|
|
|
|
# Nigel Hamilton |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
9
|
|
|
|
|
|
|
# All Rights Reserved |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
12
|
|
|
|
|
|
|
# Filename: Compiler.pm |
13
|
|
|
|
|
|
|
# Description: Compile a Perl program |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Date Change |
16
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
# 01/08/05 Factored out of ProgramEditor as part of the new Goo |
18
|
|
|
|
|
|
|
# 30/08/2005 Added method: processError |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
############################################################################## |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4339
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use Goo::Object; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
5
|
use Goo::Thing::pm::TypeChecker; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
27
|
1
|
|
|
1
|
|
479
|
use Goo::Thing::pm::Perl5Compiler; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
28
|
1
|
|
|
1
|
|
497
|
use Goo::Thing::pm::Perl6Compiler; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
5
|
use base qw(Goo::Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
123
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
############################################################################### |
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# run - keep adding a thing to the program |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
############################################################################### |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub run { |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
1
|
|
my ($this, $thing) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
if (Goo::Thing::pm::TypeChecker::is_perl6($thing)) { |
44
|
0
|
|
|
|
|
|
Goo::Thing::pm::Perl6Compiler->new()->run($thing); |
45
|
|
|
|
|
|
|
} else { |
46
|
0
|
|
|
|
|
|
Goo::Thing::pm::Perl5Compiler->new()->run($thing); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Goo::Thing::pm::Compiler - Compile a Perl program |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SYNOPSIS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
use Goo::Thing::pm::Compiler; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 METHODS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item run |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Delegate compiling a Perl program to either a Goo::Thing::pm::Perl6Compiler or |
76
|
|
|
|
|
|
|
Goo::Thing::pm::Perl5Compiler. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=back |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SEE ALSO |
85
|
|
|
|
|
|
|
|