CORBA-IDL

 view release on metacpan or  search on metacpan

lib/CORBA/IDL/ParserXp.yp  view on Meta::CPAN

            );
        }
|   /* empty */
        {
            $_[0]->Error("Empty specification.\n");
        }
|   error
        {
            $_[0]->Error("definition declaration expected.\n");
        }
;

imports
:   import
        {
            [$_[1]];
        }
|   import      imports
        {
            unshift @{$_[2]}, $_[1];
            $_[2];
        }
;

definitions
:   definition
        {
            [$_[1]->getRef()];
        }
|   definition  definitions
        {
            unshift @{$_[2]}, $_[1]->getRef();
            $_[2];
        }
|   definition  imports definitions
        {
            $_[0]->Error("import after definition.\n");
            unshift @{$_[3]}, $_[1]->getRef();
            $_[3];
        }
;

/* 2 */
definition
:   type_dcl        check_semicolon
                                        #default action
|   const_dcl       check_semicolon
                                        #default action
|   except_dcl      check_semicolon
                                        #default action
|   interface       check_semicolon
                                        #default action
|   module          check_semicolon
                                        #default action
|   value           check_semicolon
                                        #default action
|   type_id_dcl     check_semicolon
                                        #default action
|   type_prefix_dcl check_semicolon
                                        #default action
|   code_frag
                                        #default action
|   IDENTIFIER      error   ';'
        {
            # when IDENTIFIER is a future keyword
            $_[0]->Error("'$_[1]' unexpected.\n");
            $_[0]->YYErrok();
            new CORBA::IDL::Node($_[0],
                    'idf'                   =>  $_[1]
            );
        }
;

check_semicolon
:   ';'
                                        #default action
|   error
        {
            $_[0]->Warning("';' expected.\n");
            $_[0]->YYErrok();
        }
;

/* 3 */     /* 3.7  Module Declaration */
module
:   module_header   '{' definitions '}'
        {
            $_[0]->YYData->{symbtab}->PopCurrentRoot($_[1]);
            $_[1]->Configure($_[0],
                    'list_decl'         =>  $_[3]
            ) if (defined $_[1]);
        }
|   module_header   '{' error       '}'
        {
            $_[0]->YYData->{symbtab}->PopCurrentRoot($_[1]);
            $_[0]->Error("definition declaration expected.\n");
            $_[0]->YYErrok();
            $_[1];
        }
|   module_header   '{' '}'
        {
            $_[0]->YYData->{symbtab}->PopCurrentRoot($_[1]);
            $_[0]->Error("Empty module.\n");
            $_[0]->YYErrok();
            $_[1];
        }
|   module_header   error   '}'
        {
            $_[0]->YYData->{symbtab}->PopCurrentRoot($_[1]);
            $_[0]->Error("'\x7b' expected.\n");
            $_[0]->YYErrok();
            $_[1];
        }
;

module_header
:   declspec    MODULE  IDENTIFIER
        {
            new CORBA::IDL::Module($_[0],
                    'declspec'          =>  $_[1],
                    'idf'               =>  $_[3],

lib/CORBA/IDL/ParserXp.yp  view on Meta::CPAN

                        'inheritance'           =>  $_[6]
                );
            }
        }
|   declspec    props   interface_mod   INTERFACE   error
        {
            $_[0]->Error("Identifier expected.\n");
            $_[0]->YYErrok();
        }
;

/* 8 */     /* 3.8.3    Interface Body */
interface_body
:   exports
                                        #default action
;

exports
:   _export
        {
            [$_[1]->getRef()];
        }
|   _export exports
        {
            unshift @{$_[2]}, $_[1]->getRef();
            $_[2];
        }
;

/* 9 */
_export
:   export
                                        #default action
|   state_member
        {
            $_[0]->Error("state member unexpected.\n");
            $_[1];                      #default action
        }
|   init_dcl
        {
            $_[0]->Error("initializer unexpected.\n");
            $_[1];                      #default action
        }
;

export
:   type_dcl        check_semicolon
                                        #default action
|   const_dcl       check_semicolon
                                        #default action
|   except_dcl      check_semicolon
                                        #default action
|   attr_dcl        check_semicolon
                                        #default action
|   op_dcl          check_semicolon
                                        #default action
|   type_id_dcl     check_semicolon
                                        #default action
|   type_prefix_dcl check_semicolon
                                        #default action
|   code_frag
                                        #default action
;

/* 10 */    /* 3.8.5    Interface Inheritance */
interface_inheritance_spec
:   ':' interface_names
        {
            new CORBA::IDL::InheritanceSpec($_[0],
                    'list_interface'        =>  $_[2]
            );
        }
|   ':' error
        {
            $_[0]->Error("Interface name expected.\n");
            $_[0]->YYErrok();
        }
|   /* empty */
                                        #default action
;

interface_names
:   interface_name
        {
            [$_[1]];
        }
|   interface_name  ',' interface_names
        {
            unshift @{$_[3]}, $_[1];
            $_[3];
        }
;

/* 11 */
interface_name
:   scoped_name
        {
                CORBA::IDL::Interface->Lookup($_[0], $_[1]);
        }
;

/* 12 */
scoped_name
:   IDENTIFIER
                                        #default action
|   '::'    IDENTIFIER
        {
            $_[1] . $_[2];
        }
|   '::'    error
        {
            $_[0]->Error("Identifier expected.\n");
            $_[0]->YYErrok();
            '';
        }
|   scoped_name '::'    IDENTIFIER
        {
            $_[1] . $_[2] . $_[3];
        }
|   scoped_name '::'    error
        {

lib/CORBA/IDL/ParserXp.yp  view on Meta::CPAN

                'list_setraise'     => $_[2]
            };
        }
|   get_except_expr
        {
            {
                'list_getraise'     => $_[1],
            };
        }
|   set_except_expr
        {
            {
                'list_setraise'     => $_[1]
            };
        }
|   /* empty */
                                        #default action
;

/* 109 */
get_except_expr
:   GETRAISES   exception_list
        {
            $_[2];
        }
|   GETRAISES   error
        {
            $_[0]->Error("'(' expected.\n");
            $_[0]->YYErrok();
        }
;

/* 110 */
set_except_expr
:   SETRAISES   exception_list
        {
            $_[2];
        }
|   SETRAISES   error
        {
            $_[0]->Error("'(' expected.\n");
            $_[0]->YYErrok();
        }
;

/* 111 */
exception_list
:   '(' exception_names ')'
        {
            $_[2];
        }
|   '(' error           ')'
        {
            $_[0]->Error("name expected.\n");
            $_[0]->YYErrok();
        }
;

/* XPIDL */

code_frag
:   declspec CODE_FRAGMENT
        {
            new CORBA::IDL::CodeFragment($_[0],
                    'declspec'          =>  $_[1],
                    'value'             =>  $_[2],
            );
        }
;

declspec
:   /* empty */
                                        #default action
|   DECLSPEC
                                        #default action
;

props
:   /* empty */
                                        #default action
|   '['
        {
            $_[0]->YYData->{prop} = 1;
        }
            prop_list   ']'
        {
            $_[0]->YYData->{prop} = 0;
            $_[3];
        }
;

prop_list
:   PROP_KEY    PROP_VALUE
        {
            my $hash = {};
            $hash->{$_[1]} = $_[2];
            $hash;
        }
|   prop_list   ',' PROP_KEY    PROP_VALUE
        {
            $_[1]->{$_[3]} = $_[4];
            $_[1];
        }
|   PROP_KEY
        {
            my $hash = {};
            $hash->{$_[1]} = undef;
            $hash;
        }
|   prop_list   ',' PROP_KEY
        {
            $_[1]->{$_[3]} = undef;
            $_[1];
        }
;

%%

use warnings;

our $VERSION = '2.61';



( run in 0.772 second using v1.01-cache-2.11-cpan-364913b4093 )