line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Goo::Thing::pm::TypeChecker; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
############################################################################### |
6
|
|
|
|
|
|
|
# Nigel Hamilton |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
9
|
|
|
|
|
|
|
# All Rights Reserved |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
12
|
|
|
|
|
|
|
# Filename: TypeChecker.pm |
13
|
|
|
|
|
|
|
# Description: What type of pm file is this? Perl6? Perl5? |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Date Change |
16
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
# 01/08/2005 Factored out of ProgramEditor as part of the new Goo |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
############################################################################## |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
############################################################################### |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
# is_perl6 - check if this Thing is Perl6? |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
############################################################################### |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub is_perl6 { |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
|
my ($thing) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Goo::Prompter::trace(caller() . " " . $thing->to_string()); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# check the #!/shebang/line? |
35
|
0
|
0
|
|
|
|
|
return 1 if ($thing->get_file() =~ /\#.*\/pugs/); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# if it's a class assume Perl6 |
38
|
0
|
0
|
|
|
|
|
return 1 if ($thing->get_file() =~ /^class/); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# use v6 |
41
|
0
|
0
|
|
|
|
|
return 1 if ($thing->get_file() =~ /use\s+v6/); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# what about the location? |
44
|
0
|
0
|
|
|
|
|
return 1 if ($thing->get_full_path() =~ /perl6/); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return 0; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Goo::Thing::pm::TypeChecker - What type of pm file is this? Perl6? Perl5? |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SYNOPSIS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
use Goo::Thing::pm::TypeChecker; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item is_perl6 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
check if this Thing is Perl6 by inspecting the #/shebang/line and whether or not |
73
|
|
|
|
|
|
|
is uses: use v6; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHOR |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SEE ALSO |
82
|
|
|
|
|
|
|
|