5 Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
6 States of America. All Rights Reserved.
8 This product is protected by copyright and distributed under the following
9 license restricting its use.
11 The Interface Definition Language Compiler Front End (CFE) is made
12 available for your use provided that you include this license and copyright
13 notice on all media and documentation and the software program in whichlong
14 this product is incorporated in whole or part. You may copy and extend
15 functionality (but may not remove functionality) of the Interface
16 Definition Language CFE without charge, but you are not authorized to
17 license or distribute it to anyone else except as part of a product or
18 program developed by you or with the express written consent of Sun
19 Microsystems, Inc. ("Sun").
21 The names of Sun Microsystems, Inc. and any of its subsidiaries or
22 affiliates may not be used in advertising or publicity pertaining to
23 distribution of Interface Definition Language CFE as permitted herein.
25 This license is effective until terminated by Sun for failure to comply
26 with this license. Upon termination, you shall destroy or return all code
27 and documentation for the Interface Definition Language CFE.
29 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
30 ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
32 DEALING, USAGE OR TRADE PRACTICE.
34 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
35 ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
36 TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
38 SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
39 RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
40 INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
42 IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
43 ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
44 DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
46 Use, duplication, or disclosure by the government is subject to
47 restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
48 Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
56 Mountain View, California 94043
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
67 * \brief Bison grammar for IDL
73 #include <utl_identifier.h>
75 #include <utl_string.h>
76 #include <utl_strlist.h>
77 #include <utl_namelist.h>
78 #include <utl_exprlist.h>
79 #include <utl_labellist.h>
80 #include <utl_decllist.h>
82 #include <global_extern.h>
83 #include <nr_extern.h>
85 #include <ast_argument.h>
86 #include <ast_array.h>
87 #include <ast_attribute.h>
88 #include <ast_field.h>
89 #include <ast_fixed.h>
90 #include <ast_expression.h>
91 #include <ast_operation.h>
92 #include <ast_generator.h>
93 #include <ast_template_module.h>
94 #include <ast_template_module_inst.h>
95 #include <ast_template_module_ref.h>
96 #include <ast_typedef.h>
97 #include <ast_valuebox.h>
98 #include <ast_valuetype.h>
99 #include <ast_valuetype_fwd.h>
100 #include <ast_eventtype.h>
101 #include <ast_eventtype_fwd.h>
102 #include <ast_component.h>
103 #include <ast_component_fwd.h>
104 #include <ast_home.h>
105 #include <ast_porttype.h>
106 #include <ast_connector.h>
107 #include <ast_uses.h>
108 #include <ast_constant.h>
109 #include <ast_union.h>
110 #include <ast_union_fwd.h>
111 #include <ast_structure_fwd.h>
112 #include <ast_extern.h>
113 #include <ast_enum.h>
114 #include <ast_root.h>
115 #include <ast_sequence.h>
116 #include <ast_string.h>
117 #include <ast_factory.h>
118 #include <ast_finder.h>
119 #include <ast_exception.h>
120 #include <ast_param_holder.h>
121 #include <ast_visitor_tmpl_module_inst.h>
122 #include <ast_visitor_tmpl_module_ref.h>
123 #include <ast_visitor_context.h>
124 #include <ast_annotation_appl.h>
125 #include <ast_union_branch.h>
126 #include <ast_enum_val.h>
127 #include <ast_annotation_member.h>
128 #include <ast_provides.h>
129 #include <ast_emits.h>
130 #include <ast_publishes.h>
131 #include <ast_consumes.h>
132 #include <ast_extended_port.h>
133 #include <ast_mirror_port.h>
135 #include <fe_declarator.h>
136 #include <fe_interface_header.h>
137 #include <fe_obv_header.h>
138 #include <fe_component_header.h>
139 #include <fe_home_header.h>
140 #include <fe_utils.h>
142 void tao_yyerror (const char *);
143 int tao_yylex (void);
144 extern "C" int tao_yywrap (void);
146 extern char tao_yytext[];
147 extern int tao_yyleng;
149 AST_Enum *tao_enum_constant_decl = 0;
150 AST_String *tao_string_decl = 0;
151 AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none;
152 bool stack_based_lookup_for_primary_expr = false;
154 #define TAO_YYDEBUG_LEXER_TEXT (tao_yytext[tao_yyleng] = '\0', tao_yytext)
155 // Compile Optional Tracing Output for Parser, can be enabled with --bison-trace
160 * Declare the type of values in the grammar
164 AST_Decl *dcval; /* Decl value */
165 UTL_StrList *slval; /* String list */
166 UTL_NameList *nlval; /* Name list */
167 UTL_ExprList *elval; /* Expression list */
168 UTL_LabelList *llval; /* Label list */
169 UTL_DeclList *dlval; /* Declaration list */
170 FE_InterfaceHeader *ihval; /* Interface header */
171 FE_OBVHeader *vhval; /* Valuetype header */
172 FE_ComponentHeader *chval; /* Component header */
173 FE_HomeHeader *hhval; /* Home header */
174 AST_Expression *exval; /* Expression value */
175 AST_UnionLabel *ulval; /* Union label */
176 AST_Field *ffval; /* Field value */
177 AST_Field::Visibility vival; /* N/A, pub or priv */
178 AST_Expression::ExprType etval; /* Expression type */
179 AST_Argument::Direction dival; /* Argument direction */
180 AST_Operation::Flags ofval; /* Operation flags */
181 FE_Declarator *deval; /* Declarator value */
182 ACE_CDR::Boolean bval; /* Boolean value */
183 ACE_CDR::LongLong ival; /* Long Long value */
184 ACE_CDR::ULongLong uival; /* Unsigned long long */
185 ACE_CDR::Double dval; /* Double value */
186 ACE_CDR::Float fval; /* Float value */
187 ACE_CDR::Char cval; /* Char value */
188 ACE_CDR::WChar wcval; /* WChar value */
189 ACE_CDR::Fixed fixval; /* Fixed point value */
190 UTL_String *sval; /* String value */
191 char *wsval; /* WString value */
192 char *strval; /* char * value */
193 Identifier *idval; /* Identifier */
194 UTL_IdList *idlist; /* Identifier list */
195 AST_Decl::NodeType ntval; /* Node type value */
196 FE_Utils::T_Param_Info *pival; /* Template interface param */
197 FE_Utils::T_PARAMLIST_INFO *plval; /* List of template params */
198 FE_Utils::T_ARGLIST *alval; /* List of template args */
199 AST_Annotation_Appl *annotation_val;
200 AST_Annotation_Appls *annotations_val;
201 AST_Annotation_Appl::Param *annotation_param_val;
202 AST_Annotation_Appl::Params *annotation_params_val;
203 AST_Annotation_Decl *annotation_decl_val;
204 AST_Decls *decls_val;
205 Decl_Annotations_Pair *decl_annotations_pair_val;
209 * Token types: These are returned by the lexer
212 %token <strval> IDENTIFIER
243 %token IDL_IDEMPOTENT
259 %token IDL_TRUNCATABLE
261 /* Component tokens */
271 %token IDL_PRIMARYKEY
276 %token IDL_TYPEPREFIX
279 /* Extended ports tokens */
282 %token IDL_MIRRORPORT
287 %token <ival> IDL_INTEGER_LITERAL
288 %token <uival> IDL_UINTEGER_LITERAL
289 %token <sval> IDL_STRING_LITERAL
290 %token <cval> IDL_CHARACTER_LITERAL
291 %token <dval> IDL_FLOATING_PT_LITERAL
292 %token <fixval> IDL_FIXED_PT_LITERAL
296 /* stdint like types defined in IDL4.2 7.4.13 */
306 %token <strval> IDL_SCOPE_DELIMITOR
307 %token IDL_LEFT_SHIFT
308 %token IDL_RIGHT_SHIFT
309 %token <wcval> IDL_WCHAR_LITERAL
310 %token <wsval> IDL_WSTRING_LITERAL
312 %token IDL_ANNOTATION_DECL
313 %token IDL_ANNOTATION_SYMBOL
316 * These are production names:
319 %type <dcval> type_spec simple_type_spec constructed_type_spec
320 %type <dcval> template_type_spec sequence_type_spec string_type_spec
321 %type <dcval> struct_type enum_type switch_type_spec union_type
322 %type <dcval> array_declarator op_type_spec wstring_type_spec
323 %type <dcval> param_type_spec type_dcl type_declarator actual_parameter
324 %type <dcval> fixed_type_spec
325 %type <dcval> definition fixed_definition module const_dcl struct_forward_type
326 %type <dcval> interface_def interface interface_forward
327 %type <dcval> export operation attribute attribute_readonly attribute_readwrite
328 %type <dcval> template_module template_module_inst annotation_dcl typeid_dcl
329 %type <dcval> typeprefix_dcl exception component home_decl
330 %type <dcval> event_decl event_abs_decl event_forward_decl
331 %type <dcval> event_abs_forward_decl event_concrete_forward_decl
332 %type <dcval> porttype_decl connector_decl value_def
333 %type <dcval> valuetype value_abs_decl value_forward_decl value_box_decl
334 %type <dcval> value_concrete_decl component_forward_decl component_decl
335 %type <dcval> init_decl provides_decl uses_decl port_export
336 %type <dcval> component_export emits_decl publishes_decl consumes_decl
337 %type <dcval> extended_port_decl
339 %type <idlist> scoped_name interface_type component_inheritance_spec
340 %type <idlist> home_inheritance_spec primary_key_spec module_header
341 %type <idlist> template_module_header
343 %type <slval> opt_context at_least_one_string_literal
344 %type <slval> string_literals formal_parameter_names
345 %type <slval> at_least_one_formal_parameter_name
347 %type <nlval> at_least_one_scoped_name scoped_names inheritance_spec
348 %type <nlval> opt_raises opt_getraises opt_setraises supports_spec
350 %type <elval> at_least_one_array_dim array_dims
352 %type <llval> at_least_one_case_label case_labels
354 %type <dlval> at_least_one_declarator declarators
355 %type <dlval> at_least_one_simple_declarator simple_declarators
357 %type <ihval> interface_header
359 %type <vhval> value_header event_rest_of_header
361 %type <chval> component_header
363 %type <hhval> home_header
365 %type <exval> expression const_expr or_expr xor_expr and_expr shift_expr
366 %type <exval> add_expr mult_expr unary_expr primary_expr literal
367 %type <exval> positive_int_expr array_dim annotation_member_default
369 %type <ulval> case_label
371 %type <ffval> element_spec
373 %type <etval> const_type integer_type char_type boolean_type
374 %type <etval> floating_pt_type fixed_type any_type signed_int
375 %type <etval> unsigned_int base_type_spec octet_type object_type
376 %type <etval> annotation_member_type
378 %type <dival> direction
380 %type <ofval> opt_op_attribute
382 %type <deval> declarator simple_declarator complex_declarator
384 %type <bval> opt_truncatable opt_multiple uses_opt_multiple
386 %type <idval> interface_decl value_decl union_decl struct_decl id
387 %type <idval> defining_id
388 %type <idval> event_header event_plain_header event_custom_header
389 %type <idval> event_abs_header
391 %type <ntval> formal_parameter_type
393 %type <pival> formal_parameter
394 %type <plval> formal_parameters at_least_one_formal_parameter
396 %type <sval> formal_parameter_name
398 %type <alval> actual_parameters at_least_one_actual_parameter
400 %type <annotations_val> at_least_one_annotation annotations_maybe
401 %type <annotation_val> annotation_appl
402 %type <annotation_params_val> annotation_appl_params_maybe annotation_appl_params
403 %type <annotation_params_val> named_annotation_appl_params more_named_annotation_appl_params
404 %type <annotation_param_val> named_annotation_appl_param
405 %type <decl_annotations_pair_val> seq_head
407 %type <decls_val> member_i state_member value_element
408 %type <vival> visibility
412 * Production starts here.
414 start : definitions ;
417 : at_least_one_definition
421 at_least_one_definition
423 * This is broken up into 2 rules to avoid a grammer ambiguity which
424 * manifests as bison complaining about shift/reduce conflicts.
426 : definitions at_least_one_annotation definition
428 AST_Annotation_Appls *&annotations = $2;
429 AST_Decl *&node = $3;
432 node->annotation_appls (*annotations);
436 idl_global->err ()-> unsupported_warning (
437 "Annotating this is not supported");
441 | definitions definition
446 | template_module ';'
447 | template_module_inst ';'
453 idl_global->set_parse_state (IDL_GlobalData::PS_AnnotationDeclSeen);
457 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
461 idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
465 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
469 idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
473 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
477 idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
481 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
485 idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
489 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
493 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
497 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
501 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
505 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
509 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
513 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
517 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
521 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
525 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
529 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
533 idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
537 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
541 idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
545 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
549 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeDeclSeen);
553 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
557 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorDeclSeen);
561 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
565 idl_global->err ()->syntax_error (idl_global->parse_state ());
569 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
578 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
589 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen);
591 // The module_header rule is common to template module, fixed
592 // module and instantiated template module. In the last
593 // case, a fully scoped name is allowed, but here we
594 // allow only an identifier (a scoped name of length
595 // 1). If not satisfied, we output a parse error with
596 // the appropriate message.
597 if ($1->length () != 1)
599 idl_global->err ()->syntax_error (
600 IDL_GlobalData::PS_ModuleIDSeen);
604 UTL_Scope *s = idl_global->scopes ().top_non_null ();
607 * Make a new module and add it to the enclosing scope
611 m = idl_global->gen ()->create_module (s, $1);
612 (void) s->fe_add_module (m);
620 * Push it on the stack
622 idl_global->scopes ().push (m);
628 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen);
630 at_least_one_definition
632 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen);
636 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen);
638 * Finished with this module - pop it from the scope stack.
641 idl_global->scopes ().pop ();
646 template_module_header
649 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleIDSeen);
654 : template_module_header
656 // The module_header rule is common to template module, fixed
657 // module and instantiated template module. In the last
658 // case, a fully scoped name is allowed, but here we
659 // allow only an identifier (a scoped name of length
660 // 1). If not satisfied, we output a syntax error with
661 // the appropriate message.
662 if ($1->length () != 1)
664 idl_global->err ()->syntax_error (
665 IDL_GlobalData::PS_ModuleIDSeen);
668 at_least_one_formal_parameter
670 if (FE_Utils::duplicate_param_id ($3))
672 idl_global->err ()->duplicate_param_id (
680 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleParamsSeen);
682 AST_Template_Module *tm =
683 idl_global->gen ()->create_template_module ($1,
686 UTL_Scope *s = idl_global->scopes ().top_non_null ();
687 AST_Module *m = s->fe_add_module (tm);
689 // We've probably tried to reopen a template module,
690 // going further will cause a crash.
697 * Push it on the stack
699 idl_global->scopes ().push (tm);
701 // Contained items not part of an alias will get flag set.
702 idl_global->in_tmpl_mod_no_alias (true);
704 // Store these for reference as we parse the scope
705 // of the template module.
706 idl_global->current_params ($3);
710 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleSqSeen);
712 at_least_one_tpl_definition
714 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleBodySeen);
718 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleQsSeen);
721 * Finished with this module - pop it from the scope stack.
723 idl_global->scopes ().pop ();
725 // Unset the flag, the no_alias version because any scope
726 // traversal triggered by an alias would have ended by now.
727 idl_global->in_tmpl_mod_no_alias (false);
729 // Clear the pointer so scoped name lookup will know
730 // that we are no longer in a template module scope.
731 idl_global->current_params (0);
737 at_least_one_tpl_definition
738 : tpl_definition tpl_definitions
742 : tpl_definitions tpl_definition
748 | template_module_ref ';'
752 : IDL_ALIAS scoped_name
754 idl_global->set_parse_state (
755 IDL_GlobalData::PS_ModuleRefSeen);
757 '<' at_least_one_formal_parameter_name '>'
759 idl_global->set_parse_state (
760 IDL_GlobalData::PS_ModuleRefParamsSeen);
764 idl_global->set_parse_state (
765 IDL_GlobalData::PS_ModuleRefIDSeen);
767 UTL_Scope *s = idl_global->scopes ().top_non_null ();
769 s->lookup_by_name ($2);
773 idl_global->err ()->lookup_error ($2);
777 AST_Template_Module *ref =
778 dynamic_cast<AST_Template_Module*> (d);
782 idl_global->err ()->template_module_expected (d);
787 ref->match_param_refs ($5,
792 // Error message is already output.
796 UTL_ScopedName sn ($8, 0);
798 AST_Template_Module_Ref *tmr =
799 idl_global->gen ()->create_template_module_ref (
804 (void) s->fe_add_template_module_ref (tmr);
811 // Save the current flag value to be restored below.
812 bool itmna_flag = idl_global->in_tmpl_mod_no_alias ();
813 idl_global->in_tmpl_mod_no_alias (false);
814 idl_global->in_tmpl_mod_alias (true);
816 ast_visitor_context ctx;
817 ctx.template_params (ref->template_params ());
818 ast_visitor_tmpl_module_ref v (&ctx);
820 // The implied IDL resulting from this reference is
821 // created here, in the template module scope. Upon
822 // instantiation of the enclosing template module, the
823 // visitor copies this implied IDL to the instantiated
824 // module scope. The extra copy is less than ideal, but
825 // otherwise we have ugly lookup issues when the
826 // referenced template module's contents are referenced
827 // using the aliased scoped name.
828 if (v.visit_template_module_ref (tmr) != 0)
830 ACE_ERROR ((LM_ERROR,
831 ACE_TEXT ("visit_template_module_ref")
832 ACE_TEXT (" failed\n")));
834 idl_global->set_err_count (idl_global->err_count () + 1);
837 idl_global->in_tmpl_mod_no_alias (itmna_flag);
838 idl_global->in_tmpl_mod_alias (false);
843 : template_module_header
845 idl_global->set_parse_state (
846 IDL_GlobalData::PS_InstModuleSeen);
848 at_least_one_actual_parameter '>'
850 idl_global->set_parse_state (
851 IDL_GlobalData::PS_InstModuleArgsSeen);
855 idl_global->set_parse_state (
856 IDL_GlobalData::PS_InstModuleIDSeen);
858 UTL_Scope *s = idl_global->scopes ().top_non_null ();
859 UTL_ScopedName *sn = $1;
860 AST_Template_Module *ref = 0;
861 AST_Decl *d = s->lookup_by_name (sn);
865 idl_global->err ()->lookup_error (sn);
870 ref = dynamic_cast<AST_Template_Module*> (d);
874 idl_global->err ()->template_module_expected (d);
884 if (! ref->match_arg_names ($3))
894 AST_Template_Module_Inst *tmi =
895 idl_global->gen ()->create_template_module_inst (
900 (void) s->fe_add_template_module_inst (tmi);
902 ast_visitor_context ctx;
903 ctx.template_args ($3);
904 ast_visitor_tmpl_module_inst v (&ctx);
906 if (v.visit_template_module_inst (tmi) != 0)
908 ACE_ERROR ((LM_ERROR,
909 ACE_TEXT ("visit_template_module_inst")
910 ACE_TEXT (" failed\n")));
912 idl_global->set_err_count (idl_global->err_count () + 1);
927 UTL_Scope *s = idl_global->scopes ().top_non_null ();
928 AST_Interface *i = 0;
930 FE_InterfaceHeader *header = $1;
934 * Make a new interface node and add it to its enclosing scope.
938 i = idl_global->gen ()->create_interface (
941 header->n_inherits (),
942 header->inherits_flat (),
943 header->n_inherits_flat (),
945 header->is_abstract ()
947 AST_Interface::fwd_redefinition_helper (i, s);
949 * Add the interface to its definition scope.
951 s->fe_add_interface (i);
953 // This FE_InterfaceHeader class isn't destroyed with the AST.
959 * Push it on the scope stack.
961 idl_global->scopes ().push (i);
965 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
969 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
973 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
975 $$ = dynamic_cast<AST_Decl *> (idl_global->scopes ().top_non_null ());
977 * Done with this interface - pop it off the scopes stack
979 idl_global->scopes ().pop ();
986 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen);
990 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen);
996 interface_decl inheritance_spec
998 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1000 if ($2 != 0 && $2->truncatable ())
1002 idl_global->err ()->syntax_error (
1003 IDL_GlobalData::PS_InheritColonSeen
1008 * Create an AST representation of the information in the header
1009 * part of an interface - this representation contains a computed
1010 * list of all interfaces which this interface inherits from,
1013 UTL_ScopedName *n = 0;
1015 UTL_ScopedName ($1, 0),
1018 FE_InterfaceHeader (n,
1033 IDL_LOCAL interface_decl inheritance_spec
1035 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1038 * Create an AST representation of the information in the header
1039 * part of an interface - this representation contains a computed
1040 * list of all interfaces which this interface inherits from,
1043 UTL_ScopedName *n = 0;
1045 UTL_ScopedName ($2, 0),
1048 FE_InterfaceHeader (n,
1063 IDL_ABSTRACT interface_decl inheritance_spec
1065 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1068 * Create an AST representation of the information in the header
1069 * part of an interface - this representation contains a computed
1070 * list of all interfaces which this interface inherits from,
1073 UTL_ScopedName *n = 0;
1075 UTL_ScopedName ($2, 0),
1078 FE_InterfaceHeader (n,
1095 : ':' opt_truncatable
1097 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
1099 at_least_one_scoped_name
1101 $4->truncatable ($2);
1113 | value_forward_decl
1118 : IDL_CUSTOM value_concrete_decl
1120 idl_global->err ()->unsupported_error ("custom is not supported");
1123 | value_concrete_decl
1126 value_concrete_decl :
1129 FE_OBVHeader *&valuetype_header = $1;
1130 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
1131 AST_ValueType *valuetype = 0;
1133 if (scope && valuetype_header)
1135 valuetype = idl_global->gen ()->create_valuetype (
1136 valuetype_header->name (),
1137 valuetype_header->inherits (),
1138 valuetype_header->n_inherits (),
1139 valuetype_header->inherits_concrete (),
1140 valuetype_header->inherits_flat (),
1141 valuetype_header->n_inherits_flat (),
1142 valuetype_header->supports (),
1143 valuetype_header->n_supports (),
1144 valuetype_header->supports_concrete (),
1146 valuetype_header->truncatable (),
1149 AST_Interface *valuetype_as_interface =
1150 dynamic_cast<AST_Interface *> (valuetype);
1151 AST_Interface::fwd_redefinition_helper (
1152 valuetype_as_interface, scope);
1153 valuetype = dynamic_cast<AST_ValueType *> (
1154 valuetype_as_interface);
1157 * Add the valuetype to its definition scope
1159 scope->fe_add_valuetype (valuetype);
1161 // FE_OBVHeader is not automatically destroyed in the AST
1162 valuetype_header->destroy ();
1163 delete valuetype_header;
1164 valuetype_header = 0;
1168 * Push it on the scope stack
1170 idl_global->scopes ().push (valuetype);
1172 $<dcval>$ = valuetype;
1176 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
1180 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
1184 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
1187 dynamic_cast<AST_ValueType*> (
1188 idl_global->scopes ().top_non_null ()
1191 if (vt != 0 && vt->will_have_factory ())
1193 idl_global->valuefactory_seen_ = true;
1197 * Done with this value type - pop it off the scopes stack
1199 idl_global->scopes ().pop ();
1209 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1210 AST_ValueType *v = 0;
1211 AST_Interface *i = 0;
1213 if (s != 0 && $2 != 0)
1216 idl_global->gen ()->create_valuetype (
1220 $2->inherits_concrete (),
1221 $2->inherits_flat (),
1222 $2->n_inherits_flat (),
1225 $2->supports_concrete (),
1230 i = dynamic_cast<AST_Interface*> (v);
1231 AST_Interface::fwd_redefinition_helper (i,
1234 * Add the valuetype to its definition scope
1236 v = dynamic_cast<AST_ValueType*> (i);
1237 (void) s->fe_add_valuetype (v);
1239 // FE_OBVHeader is not automatically destroyed in the AST
1246 * Push it on the scope stack.
1248 idl_global->scopes ().push (v);
1252 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
1256 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
1260 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
1263 * Done with this valuetype - pop it off the scopes stack.
1265 idl_global->scopes ().pop ();
1275 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1279 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
1281 UTL_ScopedName *sn = 0;
1283 UTL_ScopedName ($1, 0),
1290 ? $2->truncatable ()
1313 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
1317 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
1335 at_least_one_scoped_name
1345 value_forward_decl :
1349 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1350 UTL_ScopedName n ($2,
1352 AST_ValueTypeFwd *f = 0;
1353 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
1356 * Create a node representing a forward declaration of an
1357 * valuetype. Store it in the enclosing scope
1361 f = idl_global->gen ()->create_valuetype_fwd (&n,
1363 (void) s->fe_add_valuetype_fwd (f);
1373 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1374 UTL_ScopedName n ($1,
1376 AST_ValueTypeFwd *f = 0;
1377 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
1380 * Create a node representing a forward declaration of an
1381 * valuetype. Store it in the enclosing scope
1385 f = idl_global->gen ()->create_valuetype_fwd (&n,
1387 (void) s->fe_add_valuetype_fwd (f);
1399 : value_decl type_spec /* in this order %!?*/
1401 idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
1403 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1404 UTL_ScopedName n ($1,
1407 if (s != 0 && $2 != 0)
1410 * Get the type_spec associated with the valuebox
1414 = dynamic_cast<AST_Typedef*> ($2);
1418 tp = dynamic_cast<AST_Type*> ($2);
1422 tp = td->primitive_base_type ();
1427 // The <type_spec> given is a valid type
1428 idl_global->err ()->not_a_type ($2);
1432 AST_Decl::NodeType nt = tp->node_type ();
1434 if (nt == AST_Decl::NT_valuetype
1435 || nt == AST_Decl::NT_eventtype)
1437 // valuetype is not allowed as <type_spec>
1439 idl_global->err ()->error0 (
1440 UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
1446 * Add the valuebox to its definition scope
1449 idl_global->gen ()->create_valuebox (&n,
1451 (void) s->fe_add_valuebox (vb);
1465 : value_elements at_least_one_annotation value_element
1467 AST_Annotation_Appls *&annotations = $2;
1468 AST_Decls *&decls = $3;
1471 for (size_t i = 0; i < decls->size (); i++)
1473 (*decls)[i]->annotation_appls (*annotations);
1478 idl_global->err ()-> unsupported_warning (
1479 "Annotating this is not supported");
1484 | value_elements value_element
1495 AST_Decl *&node = $1;
1496 AST_Decls *value = 0;
1499 value = new AST_Decls;
1500 value->push_back (node);
1506 AST_Decl *&node = $1;
1507 AST_Decls *value = 0;
1510 value = new AST_Decls;
1511 value->push_back (node);
1513 $<decls_val>$ = value;
1524 $$ = AST_Field::vis_PUBLIC;
1528 $$ = AST_Field::vis_PRIVATE;
1533 : visibility member_i
1535 AST_Field::Visibility &visibility = $1;
1536 AST_Decls *&decls_ptr = $2;
1539 AST_Decls &decls = *decls_ptr;
1540 for (size_t i = 0; i < decls.size (); i++)
1542 AST_Field *field = dynamic_cast<AST_Field *> (decls[i]);
1545 field->visibility (visibility);
1554 : at_least_one_export
1559 : exports at_least_one_annotation export
1561 AST_Annotation_Appls *annotations = $2;
1565 d->annotation_appls (*annotations);
1569 idl_global->err ()-> unsupported_warning (
1570 "Annotating this is not supported");
1580 idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
1584 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1588 idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
1592 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1596 idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
1600 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1604 idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
1608 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1612 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
1616 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1620 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
1624 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1628 idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen);
1632 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1636 idl_global->err ()->syntax_error (idl_global->parse_state ());
1640 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1646 at_least_one_scoped_name :
1647 scoped_name scoped_names
1649 ACE_NEW_RETURN ($<nlval>$,
1660 idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
1664 idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
1666 UTL_NameList *nl = 0;
1691 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1698 | IDL_SCOPE_DELIMITOR
1700 idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
1704 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1710 ACE::strdelete ($1);
1717 ACE_NEW_RETURN ($<idlist>$,
1725 idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
1727 // This cleans up all the non-global "::"s in scoped names.
1728 // If there is a global one, it gets put into the UTL_IdList,
1729 // so we clean it up in the case above.
1730 ACE::strdelete ($2);
1735 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1752 ACE::strdelete ($1);
1757 defining_id : IDENTIFIER
1759 /* defining_id is a defining identifier
1760 whereas id is usually a reference to a defining identifier */
1761 ACE_NEW_RETURN ($$, Identifier ($1), 1);
1762 ACE::strdelete ($1);
1770 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1771 UTL_ScopedName n ($1, 0);
1773 if (ACE_OS::strcmp ($1->get_string (),
1775 && !idl_global->in_main_file ())
1777 AST_PredefinedType *pdt =
1778 idl_global->gen ()->create_predefined_type (
1779 AST_PredefinedType::PT_pseudo,
1783 s->add_to_scope (pdt);
1792 AST_InterfaceFwd *f = 0;
1793 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
1796 * Create a node representing a forward declaration of an
1797 * interface. Store it in the enclosing scope
1801 f = idl_global->gen ()->create_interface_fwd (&n,
1804 (void) s->fe_add_interface_fwd (f);
1812 IDL_LOCAL interface_decl
1814 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1815 UTL_ScopedName n ($2,
1817 AST_InterfaceFwd *f = 0;
1818 idl_global->set_parse_state (
1819 IDL_GlobalData::PS_InterfaceForwardSeen
1823 * Create a node representing a forward declaration of an
1824 * interface. Store it in the enclosing scope
1828 f = idl_global->gen ()->create_interface_fwd (&n,
1831 (void) s->fe_add_interface_fwd (f);
1839 IDL_ABSTRACT interface_decl
1841 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1842 UTL_ScopedName n ($2,
1844 AST_InterfaceFwd *f = 0;
1845 idl_global->set_parse_state (
1846 IDL_GlobalData::PS_InterfaceForwardSeen
1850 * Create a node representing a forward declaration of an
1851 * interface. Store it in the enclosing scope
1855 f = idl_global->gen ()->create_interface_fwd (&n,
1858 (void) s->fe_add_interface_fwd (f);
1865 $$ = dynamic_cast<AST_Decl *> (f);
1872 idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen);
1876 idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen);
1880 idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen);
1884 idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen);
1889 UTL_ScopedName n ($5, 0);
1891 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1892 AST_Constant *c = 0;
1893 idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen);
1896 * Create a node representing a constant declaration. Store
1897 * it in the enclosing scope.
1899 if ($9 != 0 && s != 0)
1901 AST_Param_Holder *param_holder = $9->param_holder ();
1903 AST_Expression::AST_ExprValue *result =
1904 $9->check_and_coerce ($3, tao_enum_constant_decl);
1905 tao_enum_constant_decl = 0;
1907 // If the expression is a template parameter place
1908 // holder, 'result' will be 0, but it's ok.
1909 if (result == 0 && param_holder == 0)
1911 idl_global->err ()->coercion_error ($9, $3);
1918 AST_Expression::ExprType et = $3;
1920 if (param_holder != 0
1921 && et != param_holder->info ()->const_type_)
1923 idl_global->err ()->mismatched_template_param (
1924 param_holder->info ()->name_.c_str ());
1928 c = idl_global->gen ()->create_constant ($3, $9, &n);
1929 (void) s->fe_add_constant (c);
1953 $$ = AST_Expression::EV_string;
1957 $$ = AST_Expression::EV_wstring;
1961 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1962 AST_PredefinedType *c = 0;
1964 UTL_ScopedName *sn = $1;
1967 * If the constant's type is a scoped name, it must resolve
1968 * to a scalar constant type
1971 s->lookup_by_name (sn);
1973 if (s != 0 && d != 0)
1976 * Look through typedefs.
1978 while (d->node_type () == AST_Decl::NT_typedef)
1980 t = dynamic_cast<AST_Typedef*> (d);
1987 d = t->base_type ();
1990 if (d->node_type () == AST_Decl::NT_pre_defined)
1992 c = dynamic_cast<AST_PredefinedType*> (d);
1994 $$ = FE_Utils::PredefinedTypeToExprType (c->pt ());
1996 else if (d->node_type () == AST_Decl::NT_string)
1998 $$ = AST_Expression::EV_string;
2000 else if (d->node_type () == AST_Decl::NT_wstring)
2002 $$ = AST_Expression::EV_wstring;
2004 else if (d->node_type () == AST_Decl::NT_enum)
2006 $$ = AST_Expression::EV_enum;
2007 tao_enum_constant_decl =
2008 dynamic_cast<AST_Enum*> (d);
2012 idl_global->err ()->constant_expected (sn, d);
2017 idl_global->err ()->lookup_error (sn);
2027 expression : const_expr ;
2029 const_expr : or_expr ;
2032 | or_expr '|' xor_expr
2035 idl_global->gen ()->create_expr (
2036 AST_Expression::EC_or,
2045 | xor_expr '^' and_expr
2048 idl_global->gen ()->create_expr (
2049 AST_Expression::EC_xor,
2058 | and_expr '&' shift_expr
2061 idl_global->gen ()->create_expr (
2062 AST_Expression::EC_and,
2071 | shift_expr IDL_LEFT_SHIFT add_expr
2074 idl_global->gen ()->create_expr (
2075 AST_Expression::EC_left,
2080 | shift_expr IDL_RIGHT_SHIFT add_expr
2083 idl_global->gen ()->create_expr (
2084 AST_Expression::EC_right,
2093 | add_expr '+' mult_expr
2096 idl_global->gen ()->create_expr (
2097 AST_Expression::EC_add,
2102 | add_expr '-' mult_expr
2105 idl_global->gen ()->create_expr (
2106 AST_Expression::EC_minus,
2115 | mult_expr '*' unary_expr
2118 idl_global->gen ()->create_expr (
2119 AST_Expression::EC_mul,
2124 | mult_expr '/' unary_expr
2127 idl_global->gen ()->create_expr (
2128 AST_Expression::EC_div,
2133 | mult_expr '%' unary_expr
2136 idl_global->gen ()->create_expr (
2137 AST_Expression::EC_mod,
2149 idl_global->gen ()->create_expr (
2150 AST_Expression::EC_u_plus,
2158 idl_global->gen ()->create_expr (
2159 AST_Expression::EC_u_minus,
2167 idl_global->gen ()->create_expr (
2168 AST_Expression::EC_bit_neg,
2178 UTL_ScopedName *name = $1;
2181 * An expression which is a scoped name is not resolved now,
2182 * but only when it is evaluated (such as when it is assigned
2183 * as a constant value).
2185 AST_Expression *expr = 0;
2187 AST_Decl *node = stack_based_lookup_for_primary_expr ?
2188 idl_global->scopes ().lookup_by_name (name) :
2189 idl_global->scopes ().top_non_null ()->lookup_by_name (name);
2192 if (!idl_global->ignore_lookup_errors_)
2194 idl_global->err ()->lookup_error (name);
2198 else if (node->node_type () == AST_Decl::NT_const)
2201 * If the scoped name is an IDL constant, it
2202 * may be used in an array dim, a string
2203 * bound, or a sequence bound. If so, it
2204 * must be unsigned and > 0. We assign the
2205 * constant's value and type to the
2206 * expression created here so we can check
2209 AST_Constant *c = dynamic_cast<AST_Constant *> (node);
2210 expr = idl_global->gen ()->create_expr (
2211 c->constant_value (),
2216 // An AST_Expression owns the scoped name
2217 // passed in this constructor, so we copy it
2218 // and destroy it below no matter which case
2220 expr = idl_global->gen ()->create_expr (name->copy ());
2221 if (node->node_type () == AST_Decl::NT_enum_val)
2224 dynamic_cast<AST_EnumVal *> (node)->enum_parent ());
2234 | '(' const_expr ')'
2241 : IDL_INTEGER_LITERAL
2243 $$ = idl_global->gen ()->create_expr ($1);
2245 | IDL_UINTEGER_LITERAL
2248 idl_global->gen ()->create_expr ($1);
2250 | IDL_STRING_LITERAL
2252 $$ = idl_global->gen ()->create_expr ($1);
2257 | IDL_WSTRING_LITERAL
2259 char *wide_string = $1;
2260 $$ = idl_global->gen ()->create_expr (wide_string);
2261 ACE_OS::free (wide_string);
2264 | IDL_CHARACTER_LITERAL
2266 $$ = idl_global->gen ()->create_expr ($1);
2270 ACE_OutputCDR::from_wchar wc ($1);
2271 $$ = idl_global->gen ()->create_expr (wc);
2273 | IDL_FIXED_PT_LITERAL
2275 $$ = idl_global->gen ()->create_expr ($1);
2277 | IDL_FLOATING_PT_LITERAL
2279 $$ = idl_global->gen ()->create_expr ($1);
2283 $$ = idl_global->gen ()->create_expr (true);
2287 $$ = idl_global->gen ()->create_expr (false);
2294 int good_expression = 1;
2295 $1->evaluate (AST_Expression::EK_positive_int);
2296 AST_Expression::AST_ExprValue *ev = $1->ev ();
2299 * If const_expr is an enum value (AST_EnumVal inherits from
2300 * AST_Constant), the AST_ExprValue will probably not be set,
2301 * but there's no need to check anyway
2307 case AST_Expression::EV_ushort:
2308 if (ev->u.usval == 0)
2310 good_expression = 0;
2314 case AST_Expression::EV_ulong:
2315 if (ev->u.ulval == 0)
2317 good_expression = 0;
2321 case AST_Expression::EV_ulonglong:
2322 if (ev->u.ullval == 0)
2324 good_expression = 0;
2328 case AST_Expression::EV_octet:
2329 if (ev->u.oval == 0)
2331 good_expression = 0;
2335 case AST_Expression::EV_bool:
2336 if (ev->u.bval == 0)
2338 good_expression = 0;
2343 good_expression = 0;
2348 if (good_expression)
2354 idl_global->err ()->syntax_error (idl_global->parse_state ());
2360 : IDL_ANNOTATION_DECL defining_id '{'
2362 if (idl_global->idl_version_ < IDL_VERSION_4)
2364 idl_global->err ()->idl_version_error (
2365 "Annotations are an IDL4 feature");
2368 Identifier *id = $2;
2369 UTL_ScopedName name (id, 0);
2370 AST_Annotation_Decl::escape_name (&name);
2371 AST_Annotation_Decl *annotation_decl = idl_global->gen ()->
2372 create_annotation_decl (&name);
2373 idl_global->scopes ().top_non_null ()->
2374 fe_add_annotation_decl (annotation_decl);
2375 idl_global->scopes ().push (annotation_decl);
2379 Identifier *id = $2;
2380 idl_global->scopes ().pop ();
2389 : annotation_body annotation_statement
2393 annotation_statement
2399 idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
2400 idl_global->in_typedef (true);
2405 annotation_member_type
2411 : annotation_member_type defining_id annotation_member_default ';'
2413 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
2414 UTL_Scope *root = idl_global->scopes ().bottom ();
2416 AST_Expression::ExprType type = $1;
2417 Identifier *name = $2;
2418 // Annotation member names can't clash with C++ keywords
2419 FE_Utils::original_local_name (name);
2420 UTL_ScopedName *scoped_name = new UTL_ScopedName (name, 0);
2421 AST_Expression *default_value = $3;
2423 AST_Decl * type_obj;
2426 case AST_Expression::EV_string:
2427 case AST_Expression::EV_wstring:
2428 type_obj = tao_string_decl;
2430 case AST_Expression::EV_enum:
2431 type_obj = tao_enum_constant_decl;
2434 type_obj = root->lookup_primitive_type (type);
2437 FE_Declarator *declarator = new FE_Declarator (
2438 scoped_name, FE_Declarator::FD_simple, 0);
2439 AST_Annotation_Member *member = idl_global->gen ()->
2440 create_annotation_member (
2441 type, declarator->compose (type_obj), declarator->name ());
2442 scope->fe_add_annotation_member (member);
2444 declarator->destroy ();
2449 // Check if types are compatible, else report error
2450 AST_Expression::AST_ExprValue *result =
2451 default_value->check_and_coerce (type, tao_enum_constant_decl);
2452 tao_enum_constant_decl = 0;
2455 member->value (default_value);
2459 idl_global->err ()->coercion_error (default_value, type);
2466 annotation_member_default
2467 : IDL_DEFAULT const_expr
2477 at_least_one_annotation
2478 : annotations_maybe annotation_appl
2480 AST_Annotation_Appls *annotations = $1;
2481 AST_Annotation_Appl *annotation = $2;
2484 annotations->add (annotation);
2491 : annotations_maybe annotation_appl
2493 AST_Annotation_Appls *annotations = $1;
2494 AST_Annotation_Appl *annotation = $2;
2497 annotations->add (annotation);
2503 $$ = new AST_Annotation_Appls ();
2508 : IDL_ANNOTATION_SYMBOL scoped_name
2510 if (idl_global->idl_version_ < IDL_VERSION_4)
2512 idl_global->err ()->idl_version_error (
2513 "Annotations are an IDL4 feature");
2516 AST_Annotation_Decl *decl = 0;
2517 UTL_ScopedName *name = $2;
2518 AST_Annotation_Decl::escape_name (name);
2520 // Check for Matching Annotation Declaration
2521 AST_Decl *d = idl_global->scopes ().top_non_null ()->
2522 lookup_by_name (name);
2525 decl = dynamic_cast<AST_Annotation_Decl*> (d);
2528 idl_global->scopes ().push (decl);
2533 Identifier &id = *name->last_component ();
2534 switch (idl_global->unknown_annotations_)
2537 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_WARN_ONCE:
2538 if (idl_global->unknown_annotations_seen_.insert (id) == 1)
2542 idl_global->err ()->lookup_warning (name);
2544 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_WARN_ALL:
2545 idl_global->err ()->lookup_warning (name);
2547 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_ERROR:
2548 idl_global->err ()->lookup_error (name);
2550 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_IGNORE:
2555 * Ignore lookup errors for parameter values that might depend on
2556 * constants or enums from the missing annotation declaration.
2558 idl_global->ignore_lookup_errors_ = true;
2561 stack_based_lookup_for_primary_expr = true;
2563 $<annotation_decl_val>$ = decl;
2565 annotation_appl_params_maybe
2567 idl_global->ignore_lookup_errors_ = false;
2568 stack_based_lookup_for_primary_expr = false;
2569 AST_Annotation_Appl *appl = 0;
2570 UTL_ScopedName *name = $2;
2571 AST_Annotation_Decl *decl = $<annotation_decl_val>3;
2572 AST_Annotation_Appl::Params *params = $4;
2576 appl = idl_global->gen ()->create_annotation_appl (name, params);
2577 appl->apply_from (decl);
2578 idl_global->scopes ().pop ();
2582 AST_Annotation_Appl::delete_params (params);
2595 annotation_appl_params_maybe
2596 : '(' annotation_appl_params ')'
2606 annotation_appl_params
2609 AST_Annotation_Appl::Params *params = new AST_Annotation_Appl::Params;
2610 AST_Annotation_Appl::Param *param = new AST_Annotation_Appl::Param;
2613 params->push (param);
2616 | named_annotation_appl_params
2622 named_annotation_appl_params
2623 : named_annotation_appl_param more_named_annotation_appl_params
2625 AST_Annotation_Appl::Params *params = $2;
2630 more_named_annotation_appl_params
2631 : ',' named_annotation_appl_param more_named_annotation_appl_params
2633 AST_Annotation_Appl::Params *params = $3;
2639 $$ = new AST_Annotation_Appl::Params;
2643 named_annotation_appl_param
2646 AST_Annotation_Appl::Param *param = new AST_Annotation_Appl::Param;
2648 // Annotation Member Names Can't Clash with C++ keywords
2649 FE_Utils::original_local_name (param->id);
2658 idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
2659 idl_global->in_typedef (true);
2677 | IDL_NATIVE simple_declarator
2679 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2680 AST_Native *node = 0;
2681 idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen);
2684 * Create a node representing a Native and add it to its
2690 idl_global->gen ()->create_native (
2694 * Add it to its defining scope
2696 (void) s->fe_add_native (node);
2705 | constructed_forward_type_spec
2714 idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen);
2716 at_least_one_declarator
2718 AST_Decl *type_spec = $1;
2719 UTL_DeclList *decls = $3;
2721 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2722 FE_Declarator *d = 0;
2724 unsigned long index = 0UL;
2725 idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen);
2728 * Create a list of type renamings. Add them to the
2731 if (s && type_spec && decls)
2733 for (UTL_DecllistActiveIterator l (decls); !l.is_done (); l.next ())
2741 AST_Type *tp = d->compose (type_spec);
2747 if (AST_Decl::NT_except == tp->node_type ())
2749 idl_global->err ()->not_a_type (tp);
2753 t = idl_global->gen ()->create_typedef (tp,
2758 // If the base type is a sequence or array, the typedef
2759 // constructor sets owns_base_type_ to true. But if
2760 // there is a comma-separated list of such typedefs,
2761 // the base type can be destroyed only once. In all
2762 // other cases, the line below has no effect.
2765 t->owns_base_type (false);
2768 (void) s->fe_add_typedef (t);
2769 idl_global->in_typedef (false);
2772 // This FE_Declarator class isn't destroyed with the AST.
2784 | constructed_type_spec
2791 idl_global->scopes ().bottom ()->lookup_primitive_type (
2795 | template_type_spec
2798 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2804 s->lookup_by_name ($1);
2809 idl_global->err ()->lookup_error ($1);
2813 d->last_referenced_as ($1);
2833 : sequence_type_spec
2839 constructed_type_spec
2845 constructed_forward_type_spec
2846 : struct_forward_type
2847 | union_forward_type
2850 at_least_one_declarator :
2851 declarator declarators
2864 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
2868 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
2870 UTL_DeclList *dl = 0;
2894 | complex_declarator
2897 at_least_one_simple_declarator :
2898 simple_declarator simple_declarators
2900 ACE_NEW_RETURN ($<dlval>$,
2908 : simple_declarators
2911 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
2915 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
2917 UTL_DeclList *dl = 0;
2942 UTL_ScopedName *sn = 0;
2947 ACE_NEW_RETURN ($<deval>$,
2949 FE_Declarator::FD_simple,
2955 complex_declarator :
2958 UTL_ScopedName *sn = 0;
2961 $1->local_name ()->copy (),
2965 ACE_NEW_RETURN ($<deval>$,
2967 FE_Declarator::FD_complex,
2981 $$ = AST_Expression::EV_long;
2985 $$ = AST_Expression::EV_longlong;
2989 $$ = AST_Expression::EV_short;
2993 $$ = AST_Expression::EV_int8;
2997 $$ = AST_Expression::EV_short;
3001 $$ = AST_Expression::EV_long;
3005 $$ = AST_Expression::EV_longlong;
3010 : IDL_UNSIGNED IDL_LONG
3012 $$ = AST_Expression::EV_ulong;
3014 | IDL_UNSIGNED IDL_LONG IDL_LONG
3016 $$ = AST_Expression::EV_ulonglong;
3018 | IDL_UNSIGNED IDL_SHORT
3020 $$ = AST_Expression::EV_ushort;
3024 $$ = AST_Expression::EV_uint8;
3028 $$ = AST_Expression::EV_ushort;
3032 $$ = AST_Expression::EV_ulong;
3036 $$ = AST_Expression::EV_ulonglong;
3043 $$ = AST_Expression::EV_double;
3047 $$ = AST_Expression::EV_float;
3049 | IDL_LONG IDL_DOUBLE
3051 $$ = AST_Expression::EV_longdouble;
3058 $$ = AST_Expression::EV_fixed;
3065 $$ = AST_Expression::EV_char;
3069 $$ = AST_Expression::EV_wchar;
3076 $$ = AST_Expression::EV_octet;
3083 $$ = AST_Expression::EV_bool;
3090 $$ = AST_Expression::EV_any;
3097 $$ = AST_Expression::EV_object;
3104 idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen);
3108 idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
3117 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3118 UTL_ScopedName n ($1, 0);
3119 AST_Structure *d = 0;
3122 * Create a node representing a struct declaration. Add it
3123 * to the enclosing scope
3128 idl_global->gen ()->create_structure (
3133 AST_Structure::fwd_redefinition_helper (d, s);
3134 (void) s->fe_add_structure (d);
3138 * Push the scope of the struct on the scopes stack.
3140 idl_global->scopes ().push (d);
3148 idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen);
3152 idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen);
3156 idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
3159 * Done with this struct. Pop its scope off the scopes stack.
3161 $$ = dynamic_cast<AST_Structure*> (
3162 idl_global->scopes ().top_non_null ()
3164 idl_global->scopes ().pop ();
3168 at_least_one_member : member members ;
3176 : annotations_maybe member_i
3178 AST_Annotation_Appls *annotations = $1;
3179 AST_Decls *members = $2;
3180 if (annotations && members)
3182 for (size_t i = 0; i < members->size (); i++)
3184 (*members)[i]->annotation_appls (*annotations);
3195 idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen);
3197 at_least_one_declarator
3199 idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen);
3203 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3204 FE_Declarator *d = 0;
3206 idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted);
3207 AST_Decls *members = 0;
3210 * Check for illegal recursive use of type.
3213 && AST_illegal_recursive_type ($1))
3215 idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
3219 * Create a node representing a struct or exception member
3220 * Add it to the enclosing scope.
3222 else if (s && $1 && $3)
3224 members = new AST_Decls;
3225 for (UTL_DecllistActiveIterator l ($3);
3236 AST_Type *tp = d->compose ($1);
3243 f = idl_global->gen ()->create_field (tp, d->name ());
3244 members->push_back (f);
3245 (void) s->fe_add_field (f);
3257 idl_global->err ()->syntax_error (idl_global->parse_state ());
3261 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
3269 idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen);
3273 idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen);
3279 : union_decl IDL_SWITCH
3281 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen);
3285 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3286 UTL_ScopedName n ($1, 0);
3288 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen);
3291 * Create a node representing an empty union. Add it to its enclosing
3296 u = idl_global->gen ()->create_union (0,
3301 AST_Structure *st = dynamic_cast<AST_Structure*> (u);
3302 AST_Structure::fwd_redefinition_helper (st, s);
3303 u = dynamic_cast<AST_Union*> (st);
3304 (void) s->fe_add_union (u);
3308 * Push the scope of the union on the scopes stack
3310 idl_global->scopes ().push (u);
3313 * Don't delete $1 yet; we'll need it a bit later.
3316 annotations_maybe switch_type_spec
3318 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen);
3323 * The top of the scopes must be an empty union we added after we
3324 * encountered 'union <id> switch ('. Now we are ready to add a
3325 * correct one. Temporarily remove the top so that we setup the
3326 * correct union in a right scope.
3328 UTL_Scope *top = idl_global->scopes ().top_non_null ();
3329 idl_global->scopes ().pop ();
3330 AST_Annotation_Appls *disc_annotations = $6;
3332 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3333 UTL_ScopedName n ($1, 0);
3334 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen);
3337 * Create a node representing a union.
3339 if ($7 != 0 && s != 0)
3341 AST_ConcreteType *tp =
3342 dynamic_cast<AST_ConcreteType*> ($7);
3346 idl_global->err ()->not_a_type ($7);
3350 /* Create a union with a correct discriminator. */
3352 u = idl_global->gen ()->create_union (tp,
3357 /* Narrow the enclosing scope. */
3358 AST_Union *e = dynamic_cast<AST_Union*> (top);
3361 e->disc_annotations (*disc_annotations); // Set Discriminator Annotations
3371 idl_global->scopes ().push (top);
3377 delete disc_annotations;
3381 idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen);
3383 at_least_one_case_branch
3385 idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen);
3389 idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen);
3392 * Done with this union. Pop its scope from the scopes stack.
3394 $$ = dynamic_cast<AST_Union*> (
3395 idl_global->scopes ().top_non_null ()
3400 idl_global->scopes ().pop ();
3409 idl_global->scopes ().bottom ()->lookup_primitive_type (
3415 /* wchars are not allowed. */
3416 if ($1 == AST_Expression::EV_wchar)
3418 idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
3422 idl_global->scopes ().bottom ()->lookup_primitive_type (
3428 /* octets are not allowed. */
3429 idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
3431 idl_global->scopes ().bottom ()->lookup_primitive_type (
3438 idl_global->scopes ().bottom ()->lookup_primitive_type (
3445 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3447 AST_PredefinedType *p = 0;
3452 * The discriminator is a scoped name. Try to resolve to
3453 * one of the scalar types or to an enum. Thread through
3454 * typedef's to arrive at the base type at the end of the
3458 s->lookup_by_name ($1);
3460 if (s != 0 && d != 0)
3464 switch (d->node_type ())
3466 case AST_Decl::NT_enum:
3470 case AST_Decl::NT_pre_defined:
3471 p = dynamic_cast<AST_PredefinedType*> (d);
3477 case AST_PredefinedType::PT_long:
3478 case AST_PredefinedType::PT_ulong:
3479 case AST_PredefinedType::PT_longlong:
3480 case AST_PredefinedType::PT_ulonglong:
3481 case AST_PredefinedType::PT_short:
3482 case AST_PredefinedType::PT_ushort:
3483 case AST_PredefinedType::PT_char:
3484 case AST_PredefinedType::PT_boolean:
3488 case AST_PredefinedType::PT_wchar:
3489 case AST_PredefinedType::PT_octet:
3490 /* octets and wchars are not allowed */
3491 idl_global->err ()->error0 (
3492 UTL_Error::EIDL_DISC_TYPE
3510 case AST_Decl::NT_typedef:
3511 t = dynamic_cast<AST_Typedef*> (d);
3515 d = t->base_type ();
3533 idl_global->err ()->lookup_error ($1);
3539 /* If we don't return here, we'll crash later.*/
3540 if (!idl_global->ignore_lookup_errors_)
3552 at_least_one_case_branch : case_branch case_branches ;
3555 : case_branches case_branch
3560 at_least_one_case_label
3562 idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen);
3564 annotations_maybe element_spec
3566 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen);
3570 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3571 AST_UnionBranch *b = 0;
3572 AST_Annotation_Appls *annotations = $3;
3574 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted);
3577 * Create several nodes representing branches of a union.
3578 * Add them to the enclosing scope (the union scope)
3580 if (s != 0 && $1 != 0 && $4 != 0)
3583 idl_global->gen ()->create_union_branch (
3588 b->annotation_appls (*annotations);
3589 (void) s->fe_add_union_branch (b);
3591 // f has passed its field type to the union branch,
3592 // but the rest still needs to be cleaned up.
3593 f->AST_Decl::destroy ();
3602 idl_global->err ()->syntax_error (idl_global->parse_state ());
3606 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
3611 at_least_one_case_label :
3612 case_label case_labels
3614 ACE_NEW_RETURN ($<llval>$,
3622 : case_labels case_label
3624 UTL_LabelList *ll = 0;
3649 idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen);
3653 idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
3655 $$ = idl_global->gen ()->create_union_label (
3656 AST_UnionLabel::UL_default,
3662 idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen);
3666 idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen);
3670 idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
3672 $$ = idl_global->gen ()->create_union_label (
3673 AST_UnionLabel::UL_label,
3682 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen);
3686 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen);
3689 * Check for illegal recursive use of type
3692 && AST_illegal_recursive_type ($1))
3694 idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, $1);
3699 * Create a field in a union branch
3708 AST_Type *tp = $3->compose ($1);
3716 $$ = idl_global->gen ()->create_field (
3732 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3733 UTL_ScopedName n ($1,
3735 AST_StructureFwd *d = 0;
3738 * Create a node representing a forward declaration of a struct.
3742 d = idl_global->gen ()->create_structure_fwd (&n);
3743 (void) s->fe_add_structure_fwd (d);
3757 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3758 UTL_ScopedName n ($1,
3760 AST_UnionFwd *u = 0;
3763 * Create a node representing a forward declaration of a union.
3767 u = idl_global->gen ()->create_union_fwd (&n);
3768 (void) s->fe_add_union_fwd (u);
3780 idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
3784 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3785 UTL_ScopedName n ($3, 0);
3787 idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
3790 * Create a node representing an enum and add it to its
3795 e = idl_global->gen ()->create_enum (&n,
3799 * Add it to its defining scope
3801 (void) s->fe_add_enum (e);
3805 * Push the enum scope on the scopes stack.
3807 idl_global->scopes ().push (e);
3815 idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen);
3817 at_least_one_enumerator
3819 idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen);
3823 idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen);
3826 * Done with this enum. Pop its scope from the scopes stack.
3828 if (idl_global->scopes ().top () == 0)
3834 $$ = dynamic_cast<AST_Enum*> (
3835 idl_global->scopes ().top_non_null ()
3837 idl_global->scopes ().pop ();
3842 at_least_one_enumerator : enumerator enumerators ;
3848 idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
3855 annotations_maybe IDENTIFIER
3857 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3858 AST_Annotation_Appls *annotations = $1;
3860 ACE::strdelete ($2);
3862 UTL_ScopedName n (&id, 0);
3867 * Create a node representing one enumerator in an enum
3868 * Add it to the enclosing scope (the enum scope)
3871 && s->scope_node_type () == AST_Decl::NT_enum)
3873 c = dynamic_cast<AST_Enum*> (s);
3877 e = idl_global->gen ()->create_enum_val (
3878 c->next_enum_val (),
3882 e->annotation_appls (*annotations);
3885 (void) s->fe_add_enum_val (e);
3896 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen);
3900 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen);
3904 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
3906 AST_Sequence *seq = 0;
3907 Decl_Annotations_Pair *seq_head = $1;
3909 AST_Annotation_Appls *type_annotations = 0;
3912 type = seq_head->decl;
3913 type_annotations = seq_head->annotations;
3918 * Remove sequence marker from scopes stack.
3920 if (idl_global->scopes ().top () == 0)
3922 idl_global->scopes ().pop ();
3925 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3928 * Create a node representing a sequence
3930 AST_Expression::AST_ExprValue *ev = 0;
3931 AST_Param_Holder *param_holder = 0;
3936 $4->param_holder ();
3938 ev = $4->coerce (AST_Expression::EV_ulong);
3941 // If the expression corresponds to a template parameter,
3942 // it's ok for the coercion to fail at this point. We check
3943 // for a type mismatch below.
3945 || (0 == ev && 0 == param_holder))
3947 idl_global->err ()->coercion_error ($4,
3948 AST_Expression::EV_ulong);
3952 AST_Type *tp = dynamic_cast<AST_Type*> (type);
3956 ; // Error will be caught in FE_Declarator.
3960 Identifier id ("sequence");
3961 UTL_ScopedName sn (&id,
3965 idl_global->gen ()->create_sequence (
3972 seq->base_type_annotations (*type_annotations);
3974 idl_global->err ()->anonymous_type_diagnostic ();
3978 delete type_annotations;
3986 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
3988 AST_Sequence *seq = 0;
3989 Decl_Annotations_Pair *seq_head = $1;
3991 AST_Annotation_Appls *type_annotations = 0;
3994 type = seq_head->decl;
3995 type_annotations = seq_head->annotations;
4000 * Remove sequence marker from scopes stack.
4002 if (idl_global->scopes ().top () == 0)
4004 idl_global->scopes ().pop ();
4007 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4010 * Create a node representing a sequence.
4014 AST_Type *tp = dynamic_cast<AST_Type*> (type);
4018 ; // Error will be caught in FE_Declarator.
4022 Identifier id ("sequence");
4023 UTL_ScopedName sn (&id, 0);
4024 ACE_CDR::ULong bound = 0UL;
4027 idl_global->gen ()->create_sequence (
4028 idl_global->gen ()->create_expr (
4030 AST_Expression::EV_ulong
4037 seq->base_type_annotations (*type_annotations);
4039 idl_global->err ()->anonymous_type_diagnostic ();
4043 delete type_annotations;
4051 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
4054 * Push a sequence marker on scopes stack.
4056 idl_global->scopes ().push (0);
4060 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen);
4062 annotations_maybe simple_type_spec
4064 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen);
4065 Decl_Annotations_Pair *seq_head = new Decl_Annotations_Pair;
4066 seq_head->decl = $6;
4067 seq_head->annotations = $5;
4073 : IDL_FIXED '<' positive_int_expr ',' const_expr '>'
4075 $5->evaluate (AST_Expression::EK_positive_int);
4076 $$ = idl_global->gen ()->create_fixed ($3, $5);
4084 idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
4088 idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
4092 idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
4095 * Create a node representing a string.
4097 AST_Expression::AST_ExprValue *ev = 0;
4101 ev = $4->coerce (AST_Expression::EV_ulong);
4104 if (0 == $4 || 0 == ev)
4106 idl_global->err ()->coercion_error ($4,
4107 AST_Expression::EV_ulong);
4112 tao_string_decl = idl_global->gen ()->create_string ($4);
4115 * Add this AST_String to the types defined in the global scope.
4117 idl_global->root ()->fe_add_string (
4118 dynamic_cast<AST_String*> (
4121 idl_global->err ()->anonymous_type_diagnostic ();
4123 $$ = tao_string_decl;
4131 idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
4134 * Create a node representing a string.
4136 ACE_CDR::ULong bound = 0UL;
4138 idl_global->gen ()->create_string (
4139 idl_global->gen ()->create_expr (bound,
4140 AST_Expression::EV_ulong)
4144 * Add this AST_String to the types defined in the global scope.
4146 idl_global->root ()->fe_add_string (
4147 dynamic_cast<AST_String*> (
4150 $$ = tao_string_decl;
4157 idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
4165 idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
4169 idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
4173 idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
4176 * Create a node representing a string.
4178 AST_Expression::AST_ExprValue *ev = 0;
4182 ev = $4->coerce (AST_Expression::EV_ulong);
4185 if (0 == $4 || 0 == ev)
4187 idl_global->err ()->coercion_error ($4,
4188 AST_Expression::EV_ulong);
4193 AST_String *string = idl_global->gen ()->create_wstring ($4);
4196 * Add this AST_String to the types defined in the global scope.
4198 idl_global->root ()->fe_add_string (
4199 dynamic_cast<AST_String*> (
4202 idl_global->err ()->anonymous_type_diagnostic ();
4212 idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
4215 * Create a node representing a wstring.
4217 ACE_CDR::ULong bound = 0UL;
4218 AST_String *string =
4219 idl_global->gen ()->create_wstring (
4220 idl_global->gen ()->create_expr (bound,
4221 AST_Expression::EV_ulong)
4225 * Add this AST_String to the types defined in the global scope.
4227 idl_global->root ()->fe_add_string (
4228 dynamic_cast<AST_String*> (
4238 idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
4245 idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen);
4247 annotations_maybe at_least_one_array_dim
4249 idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted);
4251 AST_Array *array = 0;
4252 AST_Annotation_Appls *base_type_annotations = $3;
4253 UTL_ExprList *array_dims = $4;
4256 * Create a node representing an array.
4260 UTL_ScopedName sn ($1,
4263 idl_global->gen ()->create_array (
4265 array_dims->length (),
4270 array->base_type_annotations (*base_type_annotations);
4273 idl_global->err ()->anonymous_type_diagnostic ();
4276 array_dims->destroy ();
4279 delete base_type_annotations;
4285 at_least_one_array_dim :
4286 array_dim array_dims
4296 : array_dims array_dim
4298 UTL_ExprList *el = 0;
4323 idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen);
4327 idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen);
4331 idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen);
4334 * Array dimensions are expressions which must be coerced to
4335 * positive integers.
4337 AST_Expression::AST_ExprValue *ev = 0;
4338 AST_Param_Holder *param_holder = 0;
4343 $3->param_holder ();
4346 $3->coerce (AST_Expression::EV_ulong);
4350 || (ev == 0 && param_holder == 0))
4352 idl_global->err ()->coercion_error ($3,
4353 AST_Expression::EV_ulong);
4358 if (param_holder != 0)
4360 AST_Expression::ExprType et =
4361 param_holder->info ()->const_type_;
4363 // If the bound expression represents a
4364 // template parameter, it must be a const
4365 // and of type unsigned long.
4366 if (et != AST_Expression::EV_ulong)
4368 idl_global->err ()->mismatched_template_param (
4369 param_holder->info ()->name_.c_str ());
4386 : attribute_readonly
4387 | attribute_readwrite
4390 attribute_readonly :
4393 idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
4397 idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
4401 idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
4403 at_least_one_simple_declarator
4405 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
4409 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4410 AST_Attribute *a = 0;
4411 FE_Declarator *d = 0;
4413 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4416 * Create nodes representing attributes and add them to the
4419 if (s != 0 && $5 != 0 && $7 != 0)
4421 for (UTL_DecllistActiveIterator l ($7); !l.is_done (); l.next ())
4430 AST_Type *tp = d->compose ($5);
4437 a = idl_global->gen ()->create_attribute (
4438 true, tp, d->name (), s->is_local (), s->is_abstract ());
4442 (void) a->fe_add_get_exceptions ($9);
4449 (void) s->fe_add_attribute (a);
4461 attribute_readwrite :
4464 idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
4468 idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
4470 at_least_one_simple_declarator
4472 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
4476 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseCompleted);
4480 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4481 AST_Attribute *a = 0;
4482 FE_Declarator *d = 0;
4484 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseCompleted);
4487 * Create nodes representing attributes and add them to the
4490 if (s != 0 && $3 != 0 && $5 != 0)
4492 for (UTL_DecllistActiveIterator l ($5); !l.is_done (); l.next ())
4501 AST_Type *tp = d->compose ($3);
4508 a = idl_global->gen ()->create_attribute (
4509 false, tp, d->name (), s->is_local (), s->is_abstract ());
4513 (void) a->fe_add_get_exceptions ($7);
4522 (void) a->fe_add_set_exceptions ($9);
4529 (void) s->fe_add_attribute (a);
4544 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
4548 Identifier *&id = $3;
4549 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
4550 UTL_ScopedName scoped_name (id, 0);
4551 AST_Exception *exception = 0;
4552 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen);
4555 * Create a node representing an exception and add it to
4556 * the enclosing scope.
4560 exception = idl_global->gen ()->create_exception (
4563 scope->is_abstract ());
4564 scope->fe_add_exception (exception);
4568 * Push the exception scope on the scope stack.
4570 idl_global->scopes ().push (exception);
4576 $<dcval>$ = exception;
4580 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen);
4584 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen);
4588 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen);
4590 * Done with this exception. Pop its scope from the scope stack.
4592 idl_global->scopes ().pop ();
4599 : opt_op_attribute op_type_spec
4601 idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
4605 AST_Operation *op = 0;
4606 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
4608 AST_Operation::Flags op_flags = $1;
4609 AST_Decl *type_node = $2;
4612 ACE::strdelete ($4);
4615 UTL_ScopedName name (&id, 0);
4616 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
4619 * Create a node representing an operation on an interface
4620 * and add it to its enclosing scope.
4622 if (scope != 0 && type_node != 0)
4624 AST_Type *type = dynamic_cast<AST_Type*> (type_node);
4628 idl_global->err ()->not_a_type (type_node);
4630 else if (type->node_type () == AST_Decl::NT_except)
4632 idl_global->err ()->not_a_type (type_node);
4636 AST_Decl *d = ScopeAsDecl (scope);
4637 AST_Decl::NodeType nt = d->node_type ();
4638 const bool local = scope->is_local ()
4639 || nt == AST_Decl::NT_valuetype
4640 || nt == AST_Decl::NT_eventtype;
4642 op = idl_global->gen ()->create_operation (
4643 type, op_flags, &name, local, scope->is_abstract ());
4645 if (!local && type->is_local ())
4647 idl_global->err ()->local_remote_mismatch (type, op);
4654 scope->fe_add_operation (op);
4660 * Push the operation scope onto the scopes stack.
4662 idl_global->scopes ().push (op);
4666 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
4670 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4674 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4675 AST_Operation *o = 0;
4676 idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted);
4679 * Add exceptions and context to the operation.
4681 if (s != 0 && s->scope_node_type () == AST_Decl::NT_op)
4683 o = dynamic_cast<AST_Operation*> (s);
4685 if ($8 != 0 && o != 0)
4687 (void) o->fe_add_exceptions ($8);
4692 (void) o->fe_add_context ($10);
4697 * Done with this operation. Pop its scope from the scopes stack.
4699 idl_global->scopes ().pop ();
4708 idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
4709 $$ = AST_Operation::OP_oneway;
4713 idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
4714 $$ = AST_Operation::OP_idempotent;
4718 $$ = AST_Operation::OP_noflags;
4727 idl_global->scopes ().bottom ()->lookup_primitive_type (
4728 AST_Expression::EV_void
4736 //@@ PS_FactorySeen?
4737 idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
4741 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4743 if (s->is_abstract ())
4746 ACE_ERROR ((LM_ERROR,
4747 ACE_TEXT ("error in %C line %d:\n")
4748 ACE_TEXT ("Abstract valuetype can't have a ")
4749 ACE_TEXT ("factory construct.\n"),
4750 idl_global->filename ()->get_string (),
4751 idl_global->lineno ()));
4753 idl_global->set_err_count (idl_global->err_count () + 1);
4757 ACE::strdelete ($3);
4760 UTL_ScopedName n (&id,
4762 AST_Factory *factory = 0;
4763 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
4766 * Create a node representing an factory construct
4767 * and add it to its enclosing scope
4771 factory = idl_global->gen ()->create_factory (&n);
4772 (void) s->fe_add_factory (factory);
4776 * Push the operation scope onto the scopes stack.
4778 idl_global->scopes ().push (factory);
4780 $<dcval>$ = factory;
4784 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
4788 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4792 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4793 AST_Factory *f = dynamic_cast<AST_Factory*> (s);
4794 (void) f->fe_add_exceptions ($7);
4797 idl_global->scopes ().pop ();
4806 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4810 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4814 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4816 at_least_one_in_parameter
4819 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4823 at_least_one_in_parameter : in_parameter in_parameters ;
4829 idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
4838 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
4842 idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
4846 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4847 AST_Argument *a = 0;
4848 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
4851 * Create a node representing an argument to an operation
4852 * Add it to the enclosing scope (the operation scope).
4858 AST_Type *tp = $5->compose ($3);
4862 a = idl_global->gen ()->create_argument (
4863 AST_Argument::dir_IN,
4868 (void) s->fe_add_argument (a);
4881 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4885 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4889 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4891 at_least_one_parameter
4894 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4898 at_least_one_parameter : parameter parameters ;
4904 idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
4913 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
4917 idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
4921 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4922 AST_Argument *a = 0;
4923 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
4926 * Create a node representing an argument to an operation
4927 * Add it to the enclosing scope (the operation scope).
4933 AST_Type *tp = $5->compose ($3);
4937 if (!s->is_local () && tp->is_local ())
4939 idl_global->err ()->local_remote_mismatch (tp, s);
4944 idl_global->gen ()->create_argument (
4949 (void) s->fe_add_argument (a);
4964 idl_global->scopes ().bottom ()->lookup_primitive_type (
4972 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4974 UTL_ScopedName *n = $1;
4978 d = s->lookup_by_name (n, false, false);
4983 idl_global->err ()->lookup_error (n);
4987 /* If we don't return here, we'll crash later.*/
4992 d->last_referenced_as ($1);
4993 AST_Decl::NodeType nt = d->node_type ();
4994 AST_Type *t = dynamic_cast<AST_Type*> (d);
4995 AST_Typedef *td = 0;
4996 bool can_be_undefined = false;
4998 if (nt == AST_Decl::NT_typedef)
5000 // This code block ensures that a sequence of
5001 // as-yet-undefined struct or union isn't used
5002 // as a return type or argument.
5003 td = dynamic_cast<AST_Typedef*> (d);
5004 AST_Type *pbt = td->primitive_base_type ();
5006 if (pbt->node_type () == AST_Decl::NT_sequence)
5009 AST_Sequence *seq_type =
5010 dynamic_cast<AST_Sequence*> (pbt);
5011 AST_Type *elem_type =
5012 seq_type->base_type ();
5013 AST_Decl::NodeType elem_nt =
5014 elem_type->node_type ();
5016 if (elem_nt == AST_Decl::NT_typedef)
5018 AST_Typedef *elem_td =
5019 dynamic_cast<AST_Typedef*> (elem_type);
5020 elem_type = elem_td->primitive_base_type ();
5021 elem_nt = elem_type->node_type ();
5024 if (elem_nt == AST_Decl::NT_interface
5025 || elem_nt == AST_Decl::NT_interface_fwd
5026 || elem_nt == AST_Decl::NT_valuetype
5027 || elem_nt == AST_Decl::NT_valuetype_fwd
5028 || elem_nt == AST_Decl::NT_component
5029 || elem_nt == AST_Decl::NT_component_fwd)
5031 can_be_undefined = true;
5035 if (! t->is_defined () && ! can_be_undefined)
5037 idl_global->err ()->error1 (
5038 UTL_Error::EIDL_ILLEGAL_ADD,
5039 (nt == AST_Decl::NT_typedef ? td : t));
5041 /* If we don't return here, we'll crash later.*/
5047 // For forward declared structs and unions, we
5048 // want the full definition, but we need to
5049 // check that it's been fully defined.
5050 AST_StructureFwd *fwd =
5051 dynamic_cast<AST_StructureFwd*> (d);
5055 t = fwd->full_definition ();
5057 if (! t->is_defined ())
5059 idl_global->err ()->error1 (
5060 UTL_Error::EIDL_ILLEGAL_ADD,
5063 /* If we don't return here, we'll crash later.*/
5079 $$ = AST_Argument::dir_IN;
5083 $$ = AST_Argument::dir_OUT;
5087 $$ = AST_Argument::dir_INOUT;
5094 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen);
5098 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen);
5100 at_least_one_scoped_name
5103 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen);
5115 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSeen);
5119 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSqSeen);
5121 at_least_one_scoped_name
5124 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseQsSeen);
5136 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSeen);
5140 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSqSeen);
5142 at_least_one_scoped_name
5145 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseQsSeen);
5157 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen);
5161 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen);
5163 at_least_one_string_literal
5166 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
5175 at_least_one_string_literal :
5176 IDL_STRING_LITERAL string_literals
5178 ACE_NEW_RETURN ($<slval>$,
5189 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
5193 UTL_StrList *sl = 0;
5216 : IDL_TYPEID scoped_name IDL_STRING_LITERAL
5218 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5220 s->lookup_by_name ($2);
5224 idl_global->err ()->lookup_error ($2);
5228 d->set_id_with_typeid (
5246 : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL
5248 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5249 AST_Decl *d = ScopeAsDecl (s);
5251 // If we are in a module, we want to avoid a lookup unless the
5252 // typeprefix is to be applied to some other scope, since we
5253 // might get a previous opening of the module, and the prefix
5254 // of this opening would never get checked or set.
5255 if (d->name ()->compare ($2) != 0)
5258 s->lookup_by_name ($2);
5263 idl_global->err ()->lookup_error ($2);
5267 d->set_prefix_with_typeprefix (
5286 | component_forward_decl
5289 component_forward_decl :
5293 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5294 UTL_ScopedName n ($2,
5296 AST_ComponentFwd *f = 0;
5297 idl_global->set_parse_state (
5298 IDL_GlobalData::PS_ComponentForwardSeen
5302 * Create a node representing a forward declaration of a
5303 * component. Store it in the enclosing scope.
5307 f = idl_global->gen ()->create_component_fwd (&n);
5308 (void) s->fe_add_component_fwd (f);
5322 FE_ComponentHeader *&component_header = $1;
5323 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
5324 AST_Component *component = 0;
5327 * Make a new component node and add it to the enclosing scope.
5329 if (scope && component_header)
5331 component = idl_global->gen ()->create_component (
5332 component_header->name (),
5333 component_header->base_component (),
5334 component_header->supports (),
5335 component_header->n_supports (),
5336 component_header->supports_flat (),
5337 component_header->n_supports_flat ());
5338 AST_Interface *component_as_interface =
5339 dynamic_cast<AST_Interface *> (component);
5340 AST_Interface::fwd_redefinition_helper (
5341 component_as_interface, scope);
5342 component = dynamic_cast<AST_Component *> (component_as_interface);
5345 * Add the component to its definition scope.
5347 scope->fe_add_component (component);
5349 // This FE_ComponentHeader class isn't destroyed with the AST.
5350 component_header->destroy ();
5351 delete component_header;
5352 component_header = 0;
5356 * Push it on the scope stack.
5358 idl_global->scopes ().push (component);
5360 $<dcval>$ = component;
5364 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentSqSeen);
5368 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentBodySeen);
5372 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentQsSeen);
5375 * Done with this component - pop it off the scopes stack.
5377 idl_global->scopes ().pop ();
5387 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentIDSeen);
5389 component_inheritance_spec
5391 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
5395 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
5398 * Create an AST representation of the information in the header
5399 * part of a component.
5401 UTL_ScopedName *n = 0;
5406 ACE_NEW_RETURN ($<chval>$,
5407 FE_ComponentHeader (n,
5429 component_inheritance_spec
5432 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
5445 : component_exports at_least_one_annotation component_export
5447 AST_Annotation_Appls *&annotations = $2;
5448 AST_Decl *&node = $3;
5451 node->annotation_appls (*annotations);
5455 idl_global->err ()-> unsupported_warning (
5456 "Annotating this is not supported");
5460 | component_exports component_export
5467 idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
5471 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5476 idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
5480 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5485 idl_global->set_parse_state (IDL_GlobalData::PS_EmitsDeclSeen);
5489 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5494 idl_global->set_parse_state (IDL_GlobalData::PS_PublishesDeclSeen);
5498 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5503 idl_global->set_parse_state (IDL_GlobalData::PS_ConsumesDeclSeen);
5507 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5512 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
5516 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5519 | extended_port_decl
5521 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
5525 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5530 provides_decl : IDL_PROVIDES interface_type id
5532 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5533 bool so_far_so_good = true;
5534 AST_Decl::NodeType nt = AST_Decl::NT_type;
5535 AST_Param_Holder *ph = 0;
5538 s->lookup_by_name ($2, true, false);
5542 idl_global->err ()->lookup_error ($2);
5543 so_far_so_good = false;
5548 nt = d->node_type ();
5552 case AST_Decl::NT_interface:
5554 case AST_Decl::NT_param_holder:
5555 ph = dynamic_cast<AST_Param_Holder*> (d);
5556 nt = ph->info ()->type_;
5558 if (nt != AST_Decl::NT_type
5559 && nt != AST_Decl::NT_interface)
5561 idl_global->err ()->mismatched_template_param (
5562 ph->info ()->name_.c_str ());
5564 so_far_so_good = false;
5568 case AST_Decl::NT_pre_defined:
5569 // Nothing else but CORBA::Object can have
5572 ACE_OS::strcmp (d->local_name ()->get_string (),
5575 // Simple provides port must use IDL interface
5576 // or CORBA::Object.
5579 idl_global->err ()->interface_expected (d);
5580 so_far_so_good = false;
5585 idl_global->err ()->interface_expected (d);
5586 so_far_so_good = false;
5591 AST_Provides *provides = 0;
5595 AST_Type *port_interface_type =
5596 dynamic_cast<AST_Type*> (d);
5598 // Strip off _cxx_, if any, for port name.
5599 FE_Utils::original_local_name ($3);
5601 UTL_ScopedName sn ($3,
5604 provides = idl_global->gen ()->create_provides (
5605 &sn, port_interface_type);
5607 (void) s->fe_add_provides (provides);
5618 $$ = dynamic_cast<AST_Decl *> (provides);
5625 // Lookups and checking are done where the 'interface_type'
5626 // token is used, in 'provides_decl' and 'uses_decl'.
5631 Identifier *corba_id = 0;
5633 ACE_NEW_RETURN (corba_id,
5634 Identifier ("Object"),
5637 UTL_IdList *conc_name = 0;
5638 ACE_NEW_RETURN (conc_name,
5639 UTL_IdList (corba_id,
5643 ACE_NEW_RETURN (corba_id,
5644 Identifier ("CORBA"),
5647 ACE_NEW_RETURN ($<idlist>$,
5648 UTL_IdList (corba_id,
5654 uses_decl : uses_opt_multiple interface_type id
5656 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5657 bool so_far_so_good = true;
5658 AST_Decl::NodeType nt = AST_Decl::NT_type;
5659 AST_Param_Holder *ph = 0;
5662 s->lookup_by_name ($2, true, false);
5666 idl_global->err ()->lookup_error ($2);
5667 so_far_so_good = false;
5672 nt = d->node_type ();
5676 case AST_Decl::NT_interface:
5678 case AST_Decl::NT_param_holder:
5679 ph = dynamic_cast<AST_Param_Holder*> (d);
5680 nt = ph->info ()->type_;
5682 if (nt != AST_Decl::NT_type
5683 && nt != AST_Decl::NT_interface)
5685 idl_global->err ()->mismatched_template_param (
5686 ph->info ()->name_.c_str ());
5688 so_far_so_good = false;
5692 case AST_Decl::NT_pre_defined:
5693 // Nothing else but CORBA::Object can have
5696 ACE_OS::strcmp (d->local_name ()->get_string (),
5699 // Simple provides port must use IDL interface
5700 // or CORBA::Object.
5703 idl_global->err ()->interface_expected (d);
5704 so_far_so_good = false;
5709 idl_global->err ()->interface_expected (d);
5710 so_far_so_good = false;
5719 AST_Type *port_interface_type =
5720 dynamic_cast<AST_Type*> (d);
5722 // Strip off _cxx_, if any, for port name.
5723 FE_Utils::original_local_name ($3);
5725 UTL_ScopedName sn ($3,
5728 uses = idl_global->gen ()->create_uses (
5729 &sn, port_interface_type, $1);
5730 s->fe_add_uses (uses);
5733 dynamic_cast<AST_Component*> (s);
5736 && uses->is_multiple ()
5737 && !idl_global->using_ifr_backend ()
5738 && !idl_global->ignore_idl3 ()
5739 && nt != AST_Decl::NT_param_holder)
5741 // These datatypes must be created in the
5742 // front end so they can be looked up
5743 // when compiling the generated executor IDL.
5744 FE_Utils::create_uses_multiple_stuff (c, uses);
5761 : IDL_USES opt_multiple
5763 // We use this extra rule here to use in both uses_decl and
5764 // extended_uses_decl, so the LALR(1) parser can avoid conflicts.
5781 : IDL_EMITS scoped_name id
5783 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5784 bool so_far_so_good = true;
5785 AST_Decl::NodeType nt = AST_Decl::NT_type;
5786 AST_Param_Holder *ph = 0;
5789 s->lookup_by_name ($2, true, false);
5793 idl_global->err ()->lookup_error ($2);
5794 so_far_so_good = false;
5798 nt = d->node_type ();
5802 case AST_Decl::NT_eventtype:
5804 case AST_Decl::NT_param_holder:
5805 ph = dynamic_cast<AST_Param_Holder*> (d);
5806 nt = ph->info ()->type_;
5808 if (nt != AST_Decl::NT_type
5809 && nt != AST_Decl::NT_eventtype)
5811 idl_global->err ()->mismatched_template_param (
5812 ph->info ()->name_.c_str ());
5814 so_far_so_good = false;
5819 idl_global->err ()->eventtype_expected (d);
5820 so_far_so_good = false;
5829 AST_Type *event_type =
5830 dynamic_cast<AST_Type*> (d);
5832 // Strip off _cxx_, if any, for port name.
5833 FE_Utils::original_local_name ($3);
5835 UTL_ScopedName sn ($3,
5838 e = idl_global->gen ()->create_emits (&sn, event_type);
5840 (void) s->fe_add_emits (e);
5856 : IDL_PUBLISHES scoped_name id
5858 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5859 bool so_far_so_good = true;
5860 AST_Decl::NodeType nt = AST_Decl::NT_type;
5861 AST_Param_Holder *ph = 0;
5864 s->lookup_by_name ($2, true, false);
5868 idl_global->err ()->lookup_error ($2);
5869 so_far_so_good = false;
5873 nt = d->node_type ();
5877 case AST_Decl::NT_eventtype:
5879 case AST_Decl::NT_param_holder:
5880 ph = dynamic_cast<AST_Param_Holder*> (d);
5881 nt = ph->info ()->type_;
5883 if (nt != AST_Decl::NT_type
5884 && nt != AST_Decl::NT_eventtype)
5886 idl_global->err ()->mismatched_template_param (
5887 ph->info ()->name_.c_str ());
5889 so_far_so_good = false;
5894 idl_global->err ()->eventtype_expected (d);
5895 so_far_so_good = false;
5900 AST_Publishes *p = 0;
5904 AST_Type *event_type =
5905 dynamic_cast<AST_Type*> (d);
5907 // Strip off _cxx_, if any, for port name.
5908 FE_Utils::original_local_name ($3);
5910 UTL_ScopedName sn ($3, 0);
5911 p = idl_global->gen ()->create_publishes (&sn, event_type);
5912 s->fe_add_publishes (p);
5928 : IDL_CONSUMES scoped_name id
5930 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5931 bool so_far_so_good = true;
5932 AST_Decl::NodeType nt = AST_Decl::NT_type;
5933 AST_Param_Holder *ph = 0;
5936 s->lookup_by_name ($2, true, false);
5940 idl_global->err ()->lookup_error ($2);
5941 so_far_so_good = false;
5945 nt = d->node_type ();
5949 case AST_Decl::NT_eventtype:
5951 case AST_Decl::NT_param_holder:
5952 ph = dynamic_cast<AST_Param_Holder*> (d);
5953 nt = ph->info ()->type_;
5955 if (nt != AST_Decl::NT_type
5956 && nt != AST_Decl::NT_eventtype)
5958 idl_global->err ()->mismatched_template_param (
5959 ph->info ()->name_.c_str ());
5961 so_far_so_good = false;
5966 idl_global->err ()->eventtype_expected (d);
5967 so_far_so_good = false;
5972 AST_Consumes *c = 0;
5976 AST_Type *event_type =
5977 dynamic_cast<AST_Type*> (d);
5979 // Strip off _cxx_, if any, for port name.
5980 FE_Utils::original_local_name ($3);
5982 UTL_ScopedName sn ($3,
5985 c = idl_global->gen ()->create_consumes (&sn, event_type);
5987 (void) s->fe_add_consumes (c);
6005 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6009 * Make a new home node and add it to the enclosing scope.
6011 if (s != 0 && $1 != 0)
6014 idl_global->gen ()->create_home (
6017 $1->managed_component (),
6021 $1->supports_flat (),
6022 $1->n_supports_flat ()
6025 * Add the home to its definition scope.
6027 (void) s->fe_add_home (h);
6029 // This FE_HomeHeader class isn't destroyed with the AST.
6036 * Push it on the scope stack.
6038 idl_global->scopes ().push (h);
6043 * Done with this component - pop it off the scopes stack.
6045 idl_global->scopes ().pop ();
6054 idl_global->set_parse_state (IDL_GlobalData::PS_HomeSeen);
6058 idl_global->set_parse_state (IDL_GlobalData::PS_HomeIDSeen);
6060 home_inheritance_spec
6062 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
6066 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
6070 idl_global->set_parse_state (IDL_GlobalData::PS_ManagesSeen);
6074 idl_global->set_parse_state (IDL_GlobalData::PS_ManagesIDSeen);
6078 idl_global->set_parse_state (IDL_GlobalData::PS_PrimaryKeySpecSeen);
6081 * Create an AST representation of the information in the header
6082 * part of a component home.
6084 UTL_ScopedName *n = 0;
6086 UTL_ScopedName ($3, 0),
6089 ACE_NEW_RETURN ($<hhval>$,
6124 home_inheritance_spec
6127 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
6154 idl_global->set_parse_state (IDL_GlobalData::PS_HomeSqSeen);
6158 idl_global->set_parse_state (IDL_GlobalData::PS_HomeBodySeen);
6162 idl_global->set_parse_state (IDL_GlobalData::PS_HomeQsSeen);
6167 : home_exports home_export
6175 idl_global->set_parse_state (IDL_GlobalData::PS_FactoryDeclSeen);
6179 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
6183 idl_global->set_parse_state (IDL_GlobalData::PS_FinderDeclSeen);
6187 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
6195 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6196 UTL_ScopedName n ($2,
6198 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
6201 * Create a node representing a factory operation
6202 * and add it to the enclosing scope.
6204 AST_Factory *f = idl_global->gen ()->create_factory (&n);
6205 (void) s->fe_add_factory (f);
6212 * Push the factory scope onto the scopes stack.
6214 idl_global->scopes ().push (f);
6218 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
6222 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6223 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
6226 * Add exceptions and context to the factory.
6230 (void) s->fe_add_exceptions ($6);
6234 * Done with this factory. Pop its scope from the scopes stack.
6236 idl_global->scopes ().pop ();
6244 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6245 UTL_ScopedName n ($2,
6248 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
6251 * Create a node representing a home finder
6252 * and add it to the enclosing scope.
6255 idl_global->gen ()->create_finder (&n);
6257 (void) s->fe_add_finder (f);
6265 * Push the operation scope onto the scopes stack.
6267 idl_global->scopes ().push (f);
6271 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
6275 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6276 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
6279 * Add exceptions and context to the finder.
6283 (void) s->fe_add_exceptions ($6);
6287 * Done with this operation. Pop its scope from the scopes stack.
6289 idl_global->scopes ().pop ();
6296 | event_forward_decl
6300 : event_abs_forward_decl
6301 | event_concrete_forward_decl
6304 event_concrete_forward_decl :
6308 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6309 UTL_ScopedName n ($2,
6311 AST_EventTypeFwd *f = 0;
6312 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
6315 * Create a node representing a forward declaration of an
6316 * eventtype. Store it in the enclosing scope
6320 f = idl_global->gen ()->create_eventtype_fwd (&n,
6322 (void) s->fe_add_valuetype_fwd (f);
6333 event_abs_forward_decl :
6338 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6339 UTL_ScopedName n ($3,
6341 AST_EventTypeFwd *f = 0;
6342 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
6345 * Create a node representing a forward declaration of an
6346 * eventtype. Store it in the enclosing scope
6350 f = idl_global->gen ()->create_eventtype_fwd (&n,
6352 (void) s->fe_add_valuetype_fwd (f);
6365 event_rest_of_header
6367 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6368 AST_EventType *e = 0;
6369 AST_Interface *i = 0;
6371 if (s != 0 && $1 != 0)
6373 UTL_ScopedName sn ($1,
6376 idl_global->gen ()->create_eventtype (
6380 $2->inherits_concrete (),
6381 $2->inherits_flat (),
6382 $2->n_inherits_flat (),
6385 $2->supports_concrete (),
6390 i = dynamic_cast<AST_Interface*> (e);
6391 AST_Interface::fwd_redefinition_helper (i,
6394 * Add the eventetype to its definition scope
6396 e = dynamic_cast<AST_EventType*> (i);
6397 (void) s->fe_add_eventtype (e);
6401 * Push it on the scope stack.
6403 idl_global->scopes ().push (e);
6411 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
6415 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
6419 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
6422 * Done with this eventtype - pop it off the scopes stack.
6424 idl_global->scopes ().pop ();
6439 event_custom_header :
6444 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
6446 ACE_DEBUG ((LM_DEBUG,
6447 ACE_TEXT ("error in %C line %d\n"),
6448 idl_global->filename ()->get_string (),
6449 idl_global->lineno ()));
6450 ACE_DEBUG ((LM_DEBUG,
6451 ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
6452 ACE_TEXT (" custom yet\n")));
6457 event_plain_header :
6461 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
6467 event_rest_of_header :
6470 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
6474 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
6476 ACE_NEW_RETURN ($<vhval>$,
6482 ? $1->truncatable ()
6505 event_rest_of_header
6507 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
6508 Identifier *&event_id = $1;
6509 FE_OBVHeader *&event_header = $2;
6510 AST_EventType *eventtype = 0;
6512 if (scope && event_header)
6514 // We create the scoped name here instead of with the
6515 // FE_OBVHeader because there is a token for it only here.
6516 UTL_ScopedName sn (event_id, 0);
6517 eventtype = idl_global->gen ()->create_eventtype (
6519 event_header->inherits (),
6520 event_header->n_inherits (),
6521 event_header->inherits_concrete (),
6522 event_header->inherits_flat (),
6523 event_header->n_inherits_flat (),
6524 event_header->supports (),
6525 event_header->n_supports (),
6526 event_header->supports_concrete (),
6528 event_header->truncatable (),
6530 AST_Interface *eventtype_as_interface =
6531 dynamic_cast<AST_Interface *> (eventtype);
6532 AST_Interface::fwd_redefinition_helper (
6533 eventtype_as_interface, scope);
6534 eventtype = dynamic_cast<AST_EventType *> (eventtype_as_interface);
6537 * Add the eventetype to its definition scope
6539 scope->fe_add_eventtype (eventtype);
6541 // FE_OBVHeader is not automatically destroyed in the AST
6542 event_header->destroy ();
6543 delete event_header;
6550 * Push it on the scope stack.
6552 idl_global->scopes ().push (eventtype);
6554 $<dcval>$ = eventtype;
6558 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
6562 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
6566 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
6569 * Done with this eventtype - pop it off the scopes stack.
6571 idl_global->scopes ().pop ();
6578 : event_custom_header
6582 | event_plain_header
6588 formal_parameter_type
6591 $<ntval>$ = AST_Decl::NT_type;
6595 $<ntval>$ = AST_Decl::NT_struct;
6599 $<ntval>$ = AST_Decl::NT_union;
6603 $<ntval>$ = AST_Decl::NT_eventtype;
6607 $<ntval>$ = AST_Decl::NT_sequence;
6611 $<ntval>$ = AST_Decl::NT_interface;
6615 $<ntval>$ = AST_Decl::NT_valuetype;
6619 $<ntval>$ = AST_Decl::NT_enum;
6623 $<ntval>$ = AST_Decl::NT_except;
6625 | IDL_CONST const_type
6627 $<ntval>$ = AST_Decl::NT_const;
6628 t_param_const_type = $2;
6632 at_least_one_formal_parameter
6633 : formal_parameter formal_parameters
6637 ACE_NEW_RETURN ($2, FE_Utils::T_PARAMLIST_INFO, 1);
6640 $2->enqueue_head (*$1);
6644 // The param added above is always the last one parsed,
6645 // so we check for matches between sequence<T> & T here.
6646 ACE_CString bad_id =
6647 FE_Utils::check_for_seq_of_param (
6650 if (!bad_id.empty ())
6655 idl_global->err ()->mismatch_seq_of_param (bad_id.c_str ());
6664 : formal_parameters ',' formal_parameter
6668 ACE_NEW_RETURN ($1, FE_Utils::T_PARAMLIST_INFO, 1);
6671 $1->enqueue_tail (*$3);
6684 : formal_parameter_type IDENTIFIER
6688 FE_Utils::T_Param_Info,
6691 AST_Decl::NodeType nt = $1;
6695 ACE::strdelete ($2);
6698 if (nt == AST_Decl::NT_const)
6700 $$->const_type_ = t_param_const_type;
6701 $$->enum_const_type_decl_ =
6702 tao_enum_constant_decl;
6704 // Reset these values.
6705 t_param_const_type = AST_Expression::EV_none;
6706 tao_enum_constant_decl = 0;
6709 | IDL_SEQUENCE '<' IDENTIFIER '>' IDENTIFIER
6712 FE_Utils::T_Param_Info,
6715 $$->type_ = AST_Decl::NT_sequence;
6716 $$->seq_param_ref_ = $3;
6719 ACE::strdelete ($3);
6721 ACE::strdelete ($5);
6726 at_least_one_formal_parameter_name
6727 : formal_parameter_name formal_parameter_names
6729 ACE_NEW_RETURN ($$, UTL_StrList ($1, $2), 1);
6733 formal_parameter_names
6734 : formal_parameter_names ',' formal_parameter_name
6736 UTL_StrList *sl = 0;
6737 ACE_NEW_RETURN (sl, UTL_StrList ($3, 0), 1);
6755 formal_parameter_name
6759 UTL_String ($1, true),
6767 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeSeen);
6771 char *&id_value = $3;
6772 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeIDSeen);
6773 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
6775 Identifier id (id_value);
6776 ACE::strdelete (id_value);
6779 UTL_ScopedName scoped_name (&id, 0);
6780 AST_PortType *porttype = idl_global->gen ()->create_porttype (
6782 scope->fe_add_porttype (porttype);
6783 $<dcval>$ = porttype;
6785 // Push it on the scopes stack.
6786 idl_global->scopes ().push (porttype);
6790 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeSqSeen);
6793 * NOTE: IDL4.2 spec has a different definition of what can go inside a
6796 at_least_one_port_export
6798 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeBodySeen);
6802 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeQsSeen);
6804 // Done with this port type - pop it off the scopes stack.
6805 idl_global->scopes ().pop ();
6811 at_least_one_port_export
6812 : port_exports at_least_one_annotation port_export
6814 AST_Annotation_Appls *&annotations = $2;
6815 AST_Decl *&node = $3;
6818 node->annotation_appls (*annotations);
6822 idl_global->err ()-> unsupported_warning (
6823 "Annotating this is not supported");
6827 | port_exports port_export
6831 : at_least_one_port_export
6840 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
6849 : IDL_PORT scoped_name IDENTIFIER
6851 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
6852 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6854 s->lookup_by_name ($2);
6855 AST_PortType *pt = 0;
6856 bool so_far_so_good = true;
6860 idl_global->err ()->lookup_error ($2);
6861 so_far_so_good = false;
6865 pt = dynamic_cast<AST_PortType*> (d);
6869 idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
6871 so_far_so_good = false;
6875 AST_Extended_Port *ep = 0;
6880 ACE::strdelete ($3);
6883 UTL_ScopedName sn (&id, 0);
6884 ep = idl_global->gen ()->create_extended_port (&sn, pt);
6885 s->fe_add_extended_port (ep);
6887 // Create (in the AST) the struct(s) and sequence(s)
6888 // needed for multiplex uses ports, if any.
6889 for (UTL_ScopeActiveIterator i (pt, UTL_Scope::IK_decls);
6895 AST_Uses *u = dynamic_cast<AST_Uses*> (d);
6897 if (u != 0 && u->is_multiple ())
6900 dynamic_cast<AST_Component*> (s);
6902 FE_Utils::create_uses_multiple_stuff (
6916 | IDL_MIRRORPORT scoped_name IDENTIFIER
6918 idl_global->set_parse_state (IDL_GlobalData::PS_MirrorPortDeclSeen);
6919 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6921 s->lookup_by_name ($2);
6922 AST_PortType *pt = 0;
6923 bool so_far_so_good = true;
6927 idl_global->err ()->lookup_error ($2);
6928 so_far_so_good = false;
6932 pt = dynamic_cast<AST_PortType*> (d);
6936 idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
6938 so_far_so_good = false;
6942 AST_Mirror_Port *mp = 0;
6947 ACE::strdelete ($3);
6950 UTL_ScopedName sn (&id, 0);
6951 mp = idl_global->gen ()->create_mirror_port (&sn, pt);
6952 s->fe_add_mirror_port (mp);
6963 at_least_one_actual_parameter
6964 : annotations_maybe actual_parameter actual_parameters
6969 FE_Utils::T_ARGLIST,
6974 $3->enqueue_head ($2);
6980 : actual_parameters ',' annotations_maybe actual_parameter
6985 FE_Utils::T_ARGLIST,
6990 $1->enqueue_tail ($4);
7002 // To avoid grammar conflicts with this LALR(1) parser,
7003 // we take advantage of the fact that an expression can
7004 // be a scoped name. At that lower level, we create an
7005 // expression containing the scoped name, and at a
7006 // higher lever, deduce that it's not supposed to be
7007 // a constant and look up the type to add to the template
7009 AST_Expression *ex = $1;
7010 UTL_ScopedName *sn = ex->n ();
7012 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7016 d = s->lookup_by_name (sn);
7020 idl_global->err ()->lookup_error (sn);
7025 AST_Decl::NodeType nt = d->node_type ();
7027 if (nt == AST_Decl::NT_enum_val)
7030 AST_Expression::EK_const);
7033 idl_global->gen ()->create_constant (
7047 AST_Expression::EK_const);
7050 idl_global->gen ()->create_constant (
7059 : connector_header connector_body
7068 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorSeen);
7070 annotations_maybe IDENTIFIER
7072 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorIDSeen);
7074 component_inheritance_spec
7076 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7077 AST_Connector *parent = 0;
7078 bool so_far_so_good = true;
7081 ACE::strdelete ($4);
7084 UTL_ScopedName sn (&id, 0);
7089 s->lookup_by_name ($6);
7093 idl_global->err ()->lookup_error ($6);
7094 so_far_so_good = false;
7098 dynamic_cast<AST_Connector*> (d);
7102 idl_global->err ()->error1 (
7103 UTL_Error::EIDL_CONNECTOR_EXPECTED,
7106 so_far_so_good = false;
7117 idl_global->gen ()->create_connector (&sn,
7120 (void) s->fe_add_connector (c);
7122 // Push it on the scopes stack.
7123 idl_global->scopes ().push (c);
7133 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorSqSeen);
7137 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorBodySeen);
7141 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorQsSeen);
7143 // Done with this connector - pop it off the scope stack.
7144 idl_global->scopes ().pop ();
7149 : connector_exports connector_export
7156 idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
7160 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7164 idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
7168 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7172 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
7176 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7178 | extended_port_decl
7180 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
7184 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7201 * Report an error situation discovered in a production
7204 tao_yyerror (const char *msg)
7206 ACE_ERROR ((LM_ERROR, "%C\n", msg));