Permalink
Browse files

import version 2.41 from backpan

  • Loading branch information...
1 parent 78f72c8 commit 8f196e8b92b2f51b00273f063aeed300d00aa6fc @fperrad committed Jun 7, 2004
Showing with 41 additions and 5 deletions.
  1. +3 −0 Changes
  2. +11 −0 ascii.pm
  3. +3 −0 lexer.pm
  4. +1 −1 node.pm
  5. +13 −0 repos_id.pm
  6. +10 −4 symbtab.pm
View
@@ -1,5 +1,8 @@
Revision history for Perl extension CORBA::IDL.
+2.41 Mon Jun 7 08:30:00 2004
+ - better support of 'import'
+
2.40 Tue May 18 18:30:00 2004
- modification of the AST (not compatible with 2.2x version) : add NativeType node
View
@@ -75,6 +75,12 @@ sub visitSpecification {
my ($node) = @_;
$self->reset_tab();
print "source $self->{srcname} \n\n";
+ if (exists $node->{list_import}) {
+ foreach (@{$node->{list_import}}) {
+ $self->_get_defn($_)->visit($self);
+ }
+ print "\n";
+ }
foreach (@{$node->{list_decl}}) {
$self->_get_defn($_)->visit($self);
}
@@ -88,6 +94,11 @@ sub visitImport {
my $self = shift;
my ($node) = @_;
print $self->get_tab(), "import $node->{value}\n";
+ $self->inc_tab();
+ foreach (@{$node->{list_decl}}) {
+ print $self->get_tab(),$_,"\n";
+ }
+ $self->dec_tab();
}
#
View
@@ -695,6 +695,9 @@ sub Run {
or die "can't open $file ($!).\n";
$parser->YYData->{srcname} = shift || $file;
}
+ my @st = stat($parser->YYData->{srcname});
+ $parser->YYData->{srcname_size} = $st[7];
+ $parser->YYData->{srcname_mtime} = $st[9];
}
$parser->_InitLexico();
View
@@ -8,7 +8,7 @@ use UNIVERSAL;
package CORBA::IDL::node;
use vars qw($VERSION);
-$VERSION = '2.40';
+$VERSION = '2.41';
sub _Build {
my $proto = shift;
View
@@ -65,6 +65,11 @@ sub visitType {
sub visitSpecification {
my $self = shift;
my ($node) = @_;
+ if (exists $node->{list_import}) {
+ foreach (@{$node->{list_import}}) {
+ $_->visit($self);
+ }
+ }
foreach (@{$node->{list_export}}) {
$self->{symbtab}->Lookup($_)->visit($self);
}
@@ -74,6 +79,14 @@ sub visitSpecification {
# 3.6 Import Declaration
#
+sub visitImport {
+ my $self = shift;
+ my ($node) = @_;
+ foreach (@{$node->{list_decl}}) {
+ $self->{symbtab}->Lookup($_)->visit($self);
+ }
+}
+
#
# 3.7 Module Declaration
#
View
@@ -398,7 +398,6 @@ sub InsertForward {
return;
}
}
- return;
}
} else {
$self->{msg} ||= "Identifier '$name' already exists.\n";
@@ -718,6 +717,7 @@ sub Import {
my $self = shift;
my($node) = @_;
+ my %imports = ($node->{value} => 1) ;
my $dirname = $self->{parser}->YYData->{opt_i};
my $fullname = $node->{value};
$fullname =~ s/::/_/g;
@@ -744,8 +744,9 @@ sub Import {
foreach (values %{$scope->{entry}}) {
next if (ref $_ ne 'Entry');
next if (exists $self->{scopes}->{$_->{scope}});
- $self->_Import($_->{scope});
+ $self->_Import($_->{scope}, \%imports);
}
+ $node->{list_decl} = [ keys %imports ];
} else {
$self->{parser}->Error("'$node->{value}' can't imported (bad type).\n");
}
@@ -756,8 +757,9 @@ sub Import {
sub _Import {
my $self = shift;
- my($full) = @_;
+ my($full, $r_import) = @_;
+ $r_import->{$full} = 1;
my $dirname = $self->{parser}->YYData->{opt_i};
my $fullname = $full;
$fullname =~ s/::/_/g;
@@ -767,10 +769,14 @@ sub _Import {
my $scope = eval('$main::' . $fullname);
if (defined $scope and $scope->isa('CORBA::IDL::Scope')) {
$self->{scopes}->{$full} = $scope;
+ my $root = $full;
+ $root =~ s/::([0-9A-Z_a-z]+)$//;
+ my $name = lc $1;
+ $self->{scopes}->{$root}->_Insert($name, bless({'scope' => $full}, 'Entry'));
foreach (values %{$scope->{entry}}) {
next if (ref $_ ne 'Entry');
next if (exists $self->{scopes}->{$_->{scope}});
- $self->_Import($_->{scope});
+ $self->_Import($_->{scope}, $r_import);
}
} else {
$self->{parser}->Error("_Import: INTERNAL_ERROR ($full).\n");

0 comments on commit 8f196e8

Please sign in to comment.