Permalink
Browse files

import version 1.04 from backpan

  • Loading branch information...
1 parent 62413e5 commit 82dd21f428299e32c5690b4333657f0a0d62dd91 @fperrad committed 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
@@ -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
@@ -14,7 +14,8 @@ parser21.yp
parser22.yp
parser23.yp
parser24.yp
-idl
+idl.pl
+TypeCode.idl
makefile.yapp
Makefile.PL
MANIFEST
View
@@ -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
@@ -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
@@ -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
@@ -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,
Oops, something went wrong.

0 comments on commit 82dd21f

Please sign in to comment.