line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Interface Definition Language (OMG IDL CORBA v3.0)
|
4
|
|
|
|
|
|
|
#
|
5
|
|
|
|
|
|
|
# C++ Language Mapping Specification, New Edition June 1999
|
6
|
|
|
|
|
|
|
#
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package CORBA::Cplusplus::LiteralVisitor;
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.40';
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
985
|
use CORBA::C::LiteralVisitor;
|
|
1
|
|
|
|
|
3174
|
|
|
1
|
|
|
|
|
33
|
|
16
|
1
|
|
|
1
|
|
9
|
use base qw(CORBA::C::LiteralVisitor);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
486
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# needs $node->{cpp_name} (CplusplusNameVisitor) for Enum
|
19
|
|
|
|
|
|
|
# builds $node->{cpp_literal}
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new {
|
22
|
0
|
|
|
0
|
0
|
|
my $proto = shift;
|
23
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto;
|
24
|
0
|
|
|
|
|
|
my $self = {};
|
25
|
0
|
|
|
|
|
|
bless $self, $class;
|
26
|
0
|
|
|
|
|
|
my ($parser) = @_;
|
27
|
0
|
|
|
|
|
|
$self->{key} = 'cpp_literal';
|
28
|
0
|
|
|
|
|
|
$self->{symbtab} = $parser->YYData->{symbtab};
|
29
|
0
|
|
|
|
|
|
return $self;
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _Eval {
|
33
|
0
|
|
|
0
|
|
|
my $self = shift;
|
34
|
0
|
|
|
|
|
|
my ($list_expr, $type) = @_;
|
35
|
0
|
|
|
|
|
|
my $elt = pop @{$list_expr};
|
|
0
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
unless (ref $elt) {
|
37
|
0
|
|
|
|
|
|
$elt = $self->{symbtab}->Lookup($elt);
|
38
|
|
|
|
|
|
|
}
|
39
|
0
|
0
|
|
|
|
|
if ( $elt->isa('BinaryOp') ) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $right = $self->_Eval($list_expr, $type);
|
41
|
0
|
0
|
0
|
|
|
|
if ( $elt->{op} eq '>>'
|
42
|
|
|
|
|
|
|
or $elt->{op} eq '<<' ) {
|
43
|
0
|
|
|
|
|
|
$right =~ s/[LU]+$//;
|
44
|
|
|
|
|
|
|
}
|
45
|
0
|
|
|
|
|
|
my $left = $self->_Eval($list_expr, $type);
|
46
|
0
|
|
|
|
|
|
return '(' . $left . q{ } . $elt->{op} . q{ } . $right . ')';
|
47
|
|
|
|
|
|
|
}
|
48
|
|
|
|
|
|
|
elsif ( $elt->isa('UnaryOp') ) {
|
49
|
0
|
|
|
|
|
|
my $right = $self->_Eval($list_expr, $type);
|
50
|
0
|
|
|
|
|
|
return $elt->{op} . $right;
|
51
|
|
|
|
|
|
|
}
|
52
|
|
|
|
|
|
|
elsif ( $elt->isa('Constant') ) {
|
53
|
0
|
|
|
|
|
|
return $elt->{cpp_name};
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
elsif ( $elt->isa('Enum') ) {
|
56
|
0
|
|
|
|
|
|
return $elt->{cpp_name};
|
57
|
|
|
|
|
|
|
}
|
58
|
|
|
|
|
|
|
elsif ( $elt->isa('Literal') ) {
|
59
|
0
|
|
|
|
|
|
$elt->visit($self, $type);
|
60
|
0
|
|
|
|
|
|
return $elt->{$self->{key}};
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
else {
|
63
|
0
|
|
|
|
|
|
warn __PACKAGE__," _Eval: INTERNAL ERROR ",ref $elt,".\n";
|
64
|
0
|
|
|
|
|
|
return undef;
|
65
|
|
|
|
|
|
|
}
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub visitBooleanLiteral {
|
69
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
70
|
0
|
|
|
|
|
|
my ($node) = @_;
|
71
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'TRUE') {
|
72
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 'true';
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
else {
|
75
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 'false';
|
76
|
|
|
|
|
|
|
}
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1;
|
80
|
|
|
|
|
|
|
|