Permalink
Browse files

import version 1.04 from backpan

  • Loading branch information...
1 parent 62413e5 commit 82dd21f428299e32c5690b4333657f0a0d62dd91 @fperrad committed with Sep 17, 2002
Showing with 143 additions and 35 deletions.
  1. +6 −0 Changes
  2. +2 −1 MANIFEST
  3. +2 −2 Makefile.PL
  4. +1 −1 README
  5. +9 −0 TypeCode.idl
  6. +1 −1 ascii.pm
  7. +2 −2 idl → idl.pl
  8. +72 −1 lexer.pm
  9. +23 −3 node.pm
  10. +4 −4 parser20.pm
  11. +4 −4 parser21.pm
  12. +4 −4 parser22.pm
  13. +5 −5 parser23.pm
  14. +1 −1 parser23.yp
  15. +5 −5 parser24.pm
  16. +1 −1 parser24.yp
  17. +1 −0 symbtab.pm
View
6 Changes
@@ -1,5 +1,11 @@
Revision history for Perl extension CORBA::IDL.
+1.04 Tue Sep 17 08:30:00 2002
+ - add single line doc comment (/// comment)
+ - add getopts function
+ - add TypeCode.idl file
+ - use yapp version 1.05
+
1.03 Tue May 21 09:30:00 2002
- bug when reopen a module
View
3 MANIFEST
@@ -14,7 +14,8 @@ parser21.yp
parser22.yp
parser23.yp
parser24.yp
-idl
+idl.pl
+TypeCode.idl
makefile.yapp
Makefile.PL
MANIFEST
View
4 Makefile.PL
@@ -18,8 +18,8 @@ WriteMakefile(
'repos_id.pm' => '$(INST_LIBDIR)/IDL/repos_id.pm',
'symbtab.pm' => '$(INST_LIBDIR)/IDL/symbtab.pm',
},
- 'EXE_FILES' => ['idl'],
- 'AUTHOR' => "Francois PERRAD (perrad\@besancon.sema.slb.com)",
+ 'EXE_FILES' => ['idl.pl'],
+ 'AUTHOR' => "Francois PERRAD (francois.perrad\@gadz.org)",
'dist' => {
'COMPRESS' => 'gzip',
'SUFFIX' => '.gz',
View
2 README
@@ -39,4 +39,4 @@ Build/Installation:
$ make install
-Send bug reports, comments and suggestions to perrad@besancon.sema.slb.com
+Send bug reports, comments and suggestions to francois.perrad@gadz.org
View
9 TypeCode.idl
@@ -0,0 +1,9 @@
+#ifndef _TYPECODE_IDL_
+#define _TYPECODE_IDL_
+module CORBA {
+ // See CORBA Specifications - 3.14 CORBA Module
+ interface TypeCode {
+ };
+};
+#endif // _TYPECODE_IDL_
+
View
2 ascii.pm
@@ -226,7 +226,7 @@ sub visitBoxedValue {
$self->inc_tab();
print $self->get_tab(), "doc: $node->{doc}\n"
if (exists $node->{doc});
- $node->{expr}->visit($self);
+ $node->{type}->visit($self);
$self->dec_tab();
}
View
4 idl → idl.pl 100755 → 100644
@@ -102,7 +102,7 @@ =head1 DESCRIPTION
=head1 SEE ALSO
-cpp, perl
+cpp
=head1 COPYRIGHT
@@ -113,7 +113,7 @@ =head1 COPYRIGHT
=head1 AUTHOR
-Francois PERRAD E<lt>perrad@besancon.sema.slb.comE<gt>
+Francois PERRAD, francois.perrad@gadz.org
=cut
View
73 lexer.pm
@@ -84,6 +84,7 @@ sub _StringLexer {
while ($parser->YYData->{INPUT}) {
for ($parser->YYData->{INPUT}) {
+ study;
s/^\"//
and return($token,$str);
@@ -147,6 +148,7 @@ sub _CharLexer {
my($token) = @_;
$_ = $parser->YYData->{INPUT};
+ study;
s/^([^'\\])\'//
and return ($token,$1); # any character except single quote or backslash
@@ -259,6 +261,7 @@ sub _CommentLexer {
or return;
for ($parser->YYData->{INPUT}) {
+ study;
s/^\n//
and $parser->YYData->{lineno} ++,
last;
@@ -281,6 +284,7 @@ sub _DocLexer {
or return;
for ($parser->YYData->{INPUT}) {
+ study;
s/^(\n)//
and $parser->YYData->{lineno} ++,
$parser->YYData->{doc} .= $1,
@@ -309,6 +313,7 @@ sub _PragmaLexer { # 10.6.5 Pragma Directives for RepositoryId
my($line) = @_;
for ($line) {
+ study;
s/^ID[ \t]+([0-9A-Za-z_:]+)[ \t]+\"([^\s">]+)\"//
and $parser->YYData->{symbtab}->PragmaID($1,$2),
return;
@@ -324,6 +329,19 @@ sub _PragmaLexer { # 10.6.5 Pragma Directives for RepositoryId
}
}
+sub _AttachDoc {
+ my $parser = shift;
+ my($comment) = @_;
+
+ if (defined $parser->YYData->{curr_node}) {
+ if (exists $parser->YYData->{curr_node}->{doc}) {
+ $parser->YYData->{curr_node}->{doc} .= $comment;
+ } else {
+ $parser->YYData->{curr_node}->{doc} = $comment;
+ }
+ }
+}
+
sub _Lexer {
my $parser = shift;
@@ -347,42 +365,53 @@ sub _Lexer {
}
for ($parser->YYData->{INPUT}) {
+ study;
s/^# ([\d]+) ["<]([^\s">]+)[">] ([\d]+)\n// # cccp
and $parser->YYData->{lineno} = $1,
$parser->YYData->{filename} = $2,
$parser->YYData->{doc} = '',
+ $parser->YYData->{curr_node} = undef,
last;
s/^# ([\d]+) ["<]([^\s">]+)[">]\n// # cccp
and $parser->YYData->{lineno} = $1,
$parser->YYData->{filename} = $2,
$parser->YYData->{doc} = '',
+ $parser->YYData->{curr_node} = undef,
last;
s/^#line ([\d]+) ["<]([^\s">]+)[">]\n// # CL.EXE Microsoft VC
and $parser->YYData->{lineno} = $1,
$parser->YYData->{filename} = $2,
$parser->YYData->{doc} = '',
+ $parser->YYData->{curr_node} = undef,
last;
s/^[ \r\t\f\013]+//; # whitespaces
s/^\n//
and $parser->YYData->{lineno} ++,
+ $parser->YYData->{curr_node} = undef,
last;
s/^#pragma[ \t]+(.*)\n//
and $parser->_PragmaLexer($1),
$parser->YYData->{lineno} ++,
+ $parser->YYData->{curr_node} = undef,
last;
s/^\/\*\*// # documentation
and $parser->_DocLexer(),
last;
+ s/^\/\/\/(.*)\n// # single line documentation
+ and $parser->_AttachDoc($1),
+ and $parser->YYData->{lineno} ++,
+ last;
s/^\/\*// # multiple line comment
and $parser->_CommentLexer(),
last;
s/^\/\/(.*)\n// # single line comment
and $parser->YYData->{lineno} ++,
+ $parser->YYData->{curr_node} = undef,
last;
s/^([0-9]+)([Dd])//
@@ -537,15 +566,57 @@ sub _InitLexico {
$parser->YYData->{keyword} = \%keywords;
}
+sub getopts { # from Getopt::Std
+ no strict;
+ my $parser = shift;
+ local($argumentative) = @_;
+ local(@args,$_,$first,$rest);
+
+ $parser->YYData->{args} = [];
+ @args = split( / */, $argumentative );
+ while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
+ ($first,$rest) = ($1,$2);
+ if (/^--$/) { # early exit if --
+ shift(@ARGV);
+ last;
+ }
+ $pos = index($argumentative,$first);
+ if ($pos >= 0) {
+ if (defined($args[$pos+1]) and ($args[$pos+1] eq ':')) {
+ shift(@ARGV);
+ if ($rest eq '') {
+ $rest = shift(@ARGV);
+ }
+ $parser->YYData->{"opt_$first"} = $rest;
+ } else {
+ $parser->YYData->{"opt_$first"} = 1;
+ if ($rest eq '') {
+ shift(@ARGV);
+ } else {
+ $ARGV[0] = "-$rest";
+ }
+ }
+ } else {
+ push @{$parser->YYData->{args}}, shift(@ARGV);
+ }
+ }
+}
+
sub Run {
my $parser = shift;
my $preprocessor = $parser->YYData->{preprocessor};
+ my @args;
+
+ @args = @{$parser->YYData->{args}}
+ if (exists $parser->YYData->{args});
+ push @args, @_;
- open(YYIN,"$preprocessor @_|")
+ open(YYIN,"$preprocessor @args|")
|| die "can't open @_ ($!).\n";
$parser->_InitLexico();
$parser->YYData->{doc} = '';
+ $parser->YYData->{curr_node} = undef;
$parser->YYData->{curr_itf} = undef;
$parser->YYParse(
yylex => \&_Lexer,
View
26 node.pm
@@ -7,7 +7,7 @@ use UNIVERSAL;
package node;
use vars qw($VERSION);
-$VERSION = '1.03';
+$VERSION = '1.04';
sub new {
my $proto = shift;
@@ -110,9 +110,11 @@ sub new {
$parser->YYData->{symbtab}->Insert($self->{idf},new Dummy($self));
$self->line_stamp($parser);
if ($parser->YYData->{doc} ne '') {
- $self->{doc} = $parser->YYData->{doc};
+ $self->{doc} = $parser->YYData->{doc}
+ unless (exists $self->{doc});
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -191,6 +193,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -267,6 +270,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -434,6 +438,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -464,6 +469,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -504,6 +510,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -542,6 +549,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1053,6 +1061,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1237,6 +1246,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1507,6 +1517,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1579,6 +1590,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1598,6 +1610,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1624,6 +1637,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1781,6 +1795,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1828,6 +1843,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -1954,6 +1970,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -2019,6 +2036,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -2087,6 +2105,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
return $self;
}
@@ -2156,6 +2175,7 @@ sub new {
$self->{doc} = $parser->YYData->{doc};
$parser->YYData->{doc} = '';
}
+ $parser->YYData->{curr_node} = $self;
my $op = new Operation($parser,
type => $self->{type},
idf => '_get_' . $self->{idf}
@@ -2179,7 +2199,7 @@ sub new {
new Parameter($parser,
attr => 'in',
type => $self->{type},
- idf => $self->{idf}
+ idf => 'new' . ucfirst $self->{idf}
)
]
);
View
8 parser20.pm
@@ -1,6 +1,6 @@
####################################################################
#
-# This file was generated using Parse::Yapp version 1.02.
+# This file was generated using Parse::Yapp version 1.05.
#
# Don't edit this file, use source file instead.
#
@@ -25,7 +25,7 @@ use strict;
#
# This notice should remain unchanged.
#
-# (c) Copyright 1998-1999 Francois Desarmenien, all rights reserved.
+# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
# (see the pod text in Parse::Yapp module for use and distribution rights)
#
@@ -37,7 +37,7 @@ use strict;
use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-$VERSION = '1.02';
+$VERSION = '1.05';
$COMPATIBLE = '0.07';
$FILENAME=__FILE__;
@@ -496,7 +496,7 @@ sub new {
ref($class)
and $class=ref($class);
- my($self)=$class->SUPER::new( yyversion => '1.02',
+ my($self)=$class->SUPER::new( yyversion => '1.05',
yystates =>
[
{#State 0
View
8 parser21.pm
@@ -1,6 +1,6 @@
####################################################################
#
-# This file was generated using Parse::Yapp version 1.02.
+# This file was generated using Parse::Yapp version 1.05.
#
# Don't edit this file, use source file instead.
#
@@ -25,7 +25,7 @@ use strict;
#
# This notice should remain unchanged.
#
-# (c) Copyright 1998-1999 Francois Desarmenien, all rights reserved.
+# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
# (see the pod text in Parse::Yapp module for use and distribution rights)
#
@@ -37,7 +37,7 @@ use strict;
use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-$VERSION = '1.02';
+$VERSION = '1.05';
$COMPATIBLE = '0.07';
$FILENAME=__FILE__;
@@ -496,7 +496,7 @@ sub new {
ref($class)
and $class=ref($class);
- my($self)=$class->SUPER::new( yyversion => '1.02',
+ my($self)=$class->SUPER::new( yyversion => '1.05',
yystates =>
[
{#State 0
View
8 parser22.pm
@@ -1,6 +1,6 @@
####################################################################
#
-# This file was generated using Parse::Yapp version 1.02.
+# This file was generated using Parse::Yapp version 1.05.
#
# Don't edit this file, use source file instead.
#
@@ -25,7 +25,7 @@ use strict;
#
# This notice should remain unchanged.
#
-# (c) Copyright 1998-1999 Francois Desarmenien, all rights reserved.
+# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
# (see the pod text in Parse::Yapp module for use and distribution rights)
#
@@ -37,7 +37,7 @@ use strict;
use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-$VERSION = '1.02';
+$VERSION = '1.05';
$COMPATIBLE = '0.07';
$FILENAME=__FILE__;
@@ -496,7 +496,7 @@ sub new {
ref($class)
and $class=ref($class);
- my($self)=$class->SUPER::new( yyversion => '1.02',
+ my($self)=$class->SUPER::new( yyversion => '1.05',
yystates =>
[
{#State 0
View
10 parser23.pm
@@ -1,6 +1,6 @@
####################################################################
#
-# This file was generated using Parse::Yapp version 1.02.
+# This file was generated using Parse::Yapp version 1.05.
#
# Don't edit this file, use source file instead.
#
@@ -25,7 +25,7 @@ use strict;
#
# This notice should remain unchanged.
#
-# (c) Copyright 1998-1999 Francois Desarmenien, all rights reserved.
+# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
# (see the pod text in Parse::Yapp module for use and distribution rights)
#
@@ -37,7 +37,7 @@ use strict;
use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-$VERSION = '1.02';
+$VERSION = '1.05';
$COMPATIBLE = '0.07';
$FILENAME=__FILE__;
@@ -496,7 +496,7 @@ sub new {
ref($class)
and $class=ref($class);
- my($self)=$class->SUPER::new( yyversion => '1.02',
+ my($self)=$class->SUPER::new( yyversion => '1.05',
yystates =>
[
{#State 0
@@ -4814,7 +4814,7 @@ sub
{
new BoxedValue($_[0],
'idf' => $_[2],
- 'expr' => $_[3]
+ 'type' => $_[3]
);
}
],
View
2 parser23.yp
@@ -364,7 +364,7 @@ value_box_dcl
{
new BoxedValue($_[0],
'idf' => $_[2],
- 'expr' => $_[3]
+ 'type' => $_[3]
);
}
;
View
10 parser24.pm
@@ -1,6 +1,6 @@
####################################################################
#
-# This file was generated using Parse::Yapp version 1.02.
+# This file was generated using Parse::Yapp version 1.05.
#
# Don't edit this file, use source file instead.
#
@@ -25,7 +25,7 @@ use strict;
#
# This notice should remain unchanged.
#
-# (c) Copyright 1998-1999 Francois Desarmenien, all rights reserved.
+# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
# (see the pod text in Parse::Yapp module for use and distribution rights)
#
@@ -37,7 +37,7 @@ use strict;
use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-$VERSION = '1.02';
+$VERSION = '1.05';
$COMPATIBLE = '0.07';
$FILENAME=__FILE__;
@@ -496,7 +496,7 @@ sub new {
ref($class)
and $class=ref($class);
- my($self)=$class->SUPER::new( yyversion => '1.02',
+ my($self)=$class->SUPER::new( yyversion => '1.05',
yystates =>
[
{#State 0
@@ -4864,7 +4864,7 @@ sub
{
new BoxedValue($_[0],
'idf' => $_[2],
- 'expr' => $_[3]
+ 'type' => $_[3]
);
}
],
View
2 parser24.yp
@@ -366,7 +366,7 @@ value_box_dcl
{
new BoxedValue($_[0],
'idf' => $_[2],
- 'expr' => $_[3]
+ 'type' => $_[3]
);
}
;
View
1 symbtab.pm
@@ -182,6 +182,7 @@ sub OpenModule {
if ($prev->isa('Module')) {
# reopen
$node->{coll} = $g_name;
+ $node->{doc} = $prev->{doc} if (exists $prev->{doc});
return;
} else {
$self->{msg} ||= "Identifier '$name' already exists.\n";

0 comments on commit 82dd21f

Please sign in to comment.