line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JavaScript::Code::Expression;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict;
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
8
|
use vars qw[ $VERSION ];
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
5
|
2
|
|
|
|
|
926
|
use base qw[
|
6
|
|
|
|
|
|
|
JavaScript::Code::Accessor
|
7
|
|
|
|
|
|
|
JavaScript::Code::Value
|
8
|
2
|
|
|
2
|
|
8
|
];
|
|
2
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors(qw[ tree ]);
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '0.08';
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
JavaScript::Code::Expression - A JavaScript Expression
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
A Expression Class
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 $self->command( )
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub command {
|
29
|
0
|
|
|
0
|
1
|
|
my ( $self, $op, $left, $right ) = @_;
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $class = 'JavaScript::Code::Expression::Op::' . $op;
|
32
|
0
|
|
|
|
|
|
eval "require $class";
|
33
|
0
|
0
|
|
|
|
|
die $@ if $@;
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $tree;
|
36
|
0
|
0
|
|
|
|
|
if ( $class->unary ) {
|
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
$tree = $class->new(
|
39
|
|
|
|
|
|
|
$left->isa('JavaScript::Code::Expression')
|
40
|
|
|
|
|
|
|
? $left->tree
|
41
|
|
|
|
|
|
|
: JavaScript::Code::Expression::Op::Term->new( $left->clone )
|
42
|
|
|
|
|
|
|
);
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
}
|
45
|
|
|
|
|
|
|
else {
|
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
$tree = $class->new(
|
|
|
0
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$left->isa('JavaScript::Code::Expression') ? $left->tree
|
49
|
|
|
|
|
|
|
: JavaScript::Code::Expression::Op::Term->new( $left->clone ),
|
50
|
|
|
|
|
|
|
$right->isa('JavaScript::Code::Expression') ? $right->tree
|
51
|
|
|
|
|
|
|
: JavaScript::Code::Expression::Op::Term->new( $right->clone )
|
52
|
|
|
|
|
|
|
);
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->{tree} = $tree;
|
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $self;
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 $self->tree( )
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Returns a tree of L's
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 $self->output( )
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub output {
|
71
|
0
|
|
|
0
|
1
|
|
my ($self) = @_;
|
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $tree = $self->tree;
|
74
|
0
|
0
|
|
|
|
|
return '' unless defined $tree;
|
75
|
0
|
|
|
|
|
|
return $tree->output;
|
76
|
|
|
|
|
|
|
}
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SEE ALSO
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Sascha Kiefer, C
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 LICENSE
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under
|
89
|
|
|
|
|
|
|
the same terms as Perl itself.
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1;
|