idl.yy
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· YY 代码 · 共 2,230 行 · 第 1/5 页
YY
2,230 行
/* idl.yy,v 1.75 2003/11/04 05:26:14 parsons Exp */
/*
COPYRIGHT
Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
States of America. All Rights Reserved.
This product is protected by copyright and distributed under the following
license restricting its use.
The Interface Definition Language Compiler Front End (CFE) is made
available for your use provided that you include this license and copyright
notice on all media and documentation and the software program in whichlong
this product is incorporated in whole or part. You may copy and extend
functionality (but may not remove functionality) of the Interface
Definition Language CFE without charge, but you are not authorized to
license or distribute it to anyone else except as part of a product or
program developed by you or with the express written consent of Sun
Microsystems, Inc. ("Sun").
The names of Sun Microsystems, Inc. and any of its subsidiaries or
affiliates may not be used in advertising or publicity pertaining to
distribution of Interface Definition Language CFE as permitted herein.
This license is effective until terminated by Sun for failure to comply
with this license. Upon termination, you shall destroy or return all code
and documentation for the Interface Definition Language CFE.
INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
DEALING, USAGE OR TRADE PRACTICE.
INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Use, duplication, or disclosure by the government is subject to
restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
52.227-19.
Sun, Sun Microsystems and the Sun logo are trademarks or registered
trademarks of Sun Microsystems, Inc.
SunSoft, Inc.
2550 Garcia Avenue
Mountain View, California 94043
NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
*/
/*
* idl.yy - YACC grammar for IDL 1.1
*/
/* Declarations */
%{
#include "ast_argument.h"
#include "ast_array.h"
#include "ast_attribute.h"
#include "ast_field.h"
#include "ast_expression.h"
#include "ast_operation.h"
#include "ast_generator.h"
#include "ast_module.h"
#include "ast_valuetype.h"
#include "ast_valuetype_fwd.h"
#include "ast_eventtype.h"
#include "ast_eventtype_fwd.h"
#include "ast_component.h"
#include "ast_component_fwd.h"
#include "ast_home.h"
#include "ast_constant.h"
#include "ast_union.h"
#include "ast_union_fwd.h"
#include "ast_structure_fwd.h"
#include "ast_extern.h"
#include "ast_enum.h"
#include "ast_root.h"
#include "ast_sequence.h"
#include "ast_string.h"
#include "ast_factory.h"
#include "ast_exception.h"
#include "fe_declarator.h"
#include "fe_interface_header.h"
#include "utl_identifier.h"
#include "utl_err.h"
#include "utl_string.h"
#include "utl_strlist.h"
#include "utl_namelist.h"
#include "utl_exprlist.h"
#include "utl_labellist.h"
#include "utl_decllist.h"
#include "global_extern.h"
#include "nr_extern.h"
#if (defined(apollo) || defined(hpux)) && defined(__cplusplus)
extern "C" int yywrap();
#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus)
void yyerror (const char *);
int yylex (void);
extern "C" int yywrap (void);
extern char yytext[];
extern int yyleng;
AST_Decl *tao_enum_constant_decl = 0;
#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext)
// Force the pretty debugging code to compile.
#define YYDEBUG 1
%}
/*
* Declare the type of values in the grammar
*/
%union {
AST_Decl *dcval; /* Decl value */
UTL_StrList *slval; /* String list */
UTL_NameList *nlval; /* Name list */
UTL_ExprList *elval; /* Expression list */
UTL_LabelList *llval; /* Label list */
UTL_DeclList *dlval; /* Declaration list */
FE_InterfaceHeader *ihval; /* Interface header */
FE_OBVHeader *vhval; /* Valuetype header */
FE_EventHeader *ehval; /* Event header */
FE_ComponentHeader *chval; /* Component header */
FE_HomeHeader *hhval; /* Home header */
AST_Expression *exval; /* Expression value */
AST_UnionLabel *ulval; /* Union label */
AST_Field *ffval; /* Field value */
AST_Field::Visibility vival; /* N/A, pub or priv */
AST_Expression::ExprType etval; /* Expression type */
AST_Argument::Direction dival; /* Argument direction */
AST_Operation::Flags ofval; /* Operation flags */
FE_Declarator *deval; /* Declarator value */
idl_bool bval; /* Boolean value */
long ival; /* Long value */
ACE_UINT64 uival; /* Unsigned long value */
double dval; /* Double value */
float fval; /* Float value */
char cval; /* Char value */
ACE_CDR::WChar wcval; /* WChar value */
UTL_String *sval; /* String value */
char *wsval; /* WString value */
char *strval; /* char * value */
Identifier *idval; /* Identifier */
UTL_IdList *idlist; /* Identifier list */
}
/*
* Token types: These are returned by the lexer
*/
%token <strval> IDENTIFIER
%token IDL_CONST
%token IDL_MODULE
%token IDL_INTERFACE
%token IDL_TYPEDEF
%token IDL_LONG
%token IDL_SHORT
%token IDL_UNSIGNED
%token IDL_DOUBLE
%token IDL_FLOAT
%token IDL_CHAR
%token IDL_WCHAR
%token IDL_OCTET
%token IDL_BOOLEAN
%token IDL_FIXED
%token IDL_ANY
%token IDL_OBJECT
%token IDL_STRUCT
%token IDL_UNION
%token IDL_SWITCH
%token IDL_ENUM
%token IDL_SEQUENCE
%token IDL_STRING
%token IDL_WSTRING
%token IDL_EXCEPTION
%token IDL_CASE
%token IDL_DEFAULT
%token IDL_READONLY
%token IDL_ATTRIBUTE
%token IDL_ONEWAY
%token IDL_IDEMPOTENT
%token IDL_VOID
%token IDL_IN
%token IDL_OUT
%token IDL_INOUT
%token IDL_RAISES
%token IDL_CONTEXT
%token IDL_NATIVE
%token IDL_LOCAL
/* OBV tokens */
%token IDL_ABSTRACT
%token IDL_CUSTOM
%token IDL_FACTORY
%token IDL_PRIVATE
%token IDL_PUBLIC
%token IDL_SUPPORTS
%token IDL_TRUNCATABLE
%token IDL_VALUETYPE
/* Component tokens */
%token IDL_COMPONENT
%token IDL_CONSUMES
%token IDL_EMITS
%token IDL_EVENTTYPE
%token IDL_FINDER
%token IDL_GETRAISES
%token IDL_HOME
%token IDL_IMPORT
%token IDL_MULTIPLE
%token IDL_PRIMARYKEY
%token IDL_PROVIDES
%token IDL_PUBLISHES
%token IDL_SETRAISES
%token IDL_TYPEID
%token IDL_TYPEPREFIX
%token IDL_USES
%token IDL_MANAGES
%token <ival> IDL_INTEGER_LITERAL
%token <uival> IDL_UINTEGER_LITERAL
%token <sval> IDL_STRING_LITERAL
%token <cval> IDL_CHARACTER_LITERAL
%token <dval> IDL_FLOATING_PT_LITERAL
%token IDL_TRUETOK
%token IDL_FALSETOK
%token <strval> IDL_SCOPE_DELIMITOR
%token IDL_LEFT_SHIFT
%token IDL_RIGHT_SHIFT
%token <wcval> IDL_WCHAR_LITERAL
%token <wsval> IDL_WSTRING_LITERAL
/*
* These are production names:
*/
%type <dcval> type_spec simple_type_spec constructed_type_spec
%type <dcval> template_type_spec sequence_type_spec string_type_spec
%type <dcval> struct_type enum_type switch_type_spec union_type
%type <dcval> array_declarator op_type_spec seq_head wstring_type_spec
%type <dcval> param_type_spec
%type <idlist> scoped_name interface_type component_inheritance_spec
%type <idlist> home_inheritance_spec primary_key_spec
%type <slval> opt_context at_least_one_string_literal
%type <slval> string_literals
%type <nlval> at_least_one_scoped_name scoped_names inheritance_spec
%type <nlval> opt_raises opt_getraises opt_setraises supports_spec
%type <elval> at_least_one_array_dim array_dims
%type <llval> at_least_one_case_label case_labels
%type <dlval> at_least_one_declarator declarators
%type <dlval> at_least_one_simple_declarator simple_declarators
%type <ihval> interface_header
%type <vhval> value_header
%type <chval> component_header
%type <hhval> home_header
%type <ehval> event_rest_of_header
%type <exval> expression const_expr or_expr xor_expr and_expr shift_expr
%type <exval> add_expr mult_expr unary_expr primary_expr literal
%type <exval> positive_int_expr array_dim
%type <ulval> case_label
%type <ffval> element_spec
%type <etval> const_type integer_type char_type boolean_type
%type <etval> floating_pt_type fixed_type any_type signed_int
%type <etval> unsigned_int base_type_spec octet_type object_type
%type <dival> direction
%type <ofval> opt_op_attribute
%type <deval> declarator simple_declarator complex_declarator
%type <bval> opt_truncatable opt_multiple
%type <idval> interface_decl value_decl union_decl struct_decl id
%type <idval> event_header event_plain_header event_custom_header
%type <idval> event_abs_header
%type <ival> type_dcl
%%
/*
* Production starts here.
*/
start : definitions ;
definitions
: definitions definition
| /* empty */
;
definition
: type_dcl
{
// definition : type_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| typeid_dcl
{
// | typeid_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| typeprefix_dcl
{
// | typeprefix_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| const_dcl
{
// | const_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| exception
{
// | exception
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| interface_def
{
// | interface_def
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| module
{
// | module
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| value_def
{
// | value_def
idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| component
{
// | component
idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| home_decl
{
// | home_decl
idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| event
{
// | event
idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| error
{
// | error
idl_global->err()->syntax_error (idl_global->parse_state());
}
';'
{
// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
yyerrok;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?