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 %token <strval> IDL_SCOPE_DELIMITOR
297 %token IDL_LEFT_SHIFT
298 %token IDL_RIGHT_SHIFT
299 %token <wcval> IDL_WCHAR_LITERAL
300 %token <wsval> IDL_WSTRING_LITERAL
302 %token IDL_ANNOTATION_DECL
303 %token IDL_ANNOTATION_SYMBOL
306 * These are production names:
309 %type <dcval> type_spec simple_type_spec constructed_type_spec
310 %type <dcval> template_type_spec sequence_type_spec string_type_spec
311 %type <dcval> struct_type enum_type switch_type_spec union_type
312 %type <dcval> array_declarator op_type_spec wstring_type_spec
313 %type <dcval> param_type_spec type_dcl type_declarator actual_parameter
314 %type <dcval> fixed_type_spec
315 %type <dcval> definition fixed_definition module const_dcl struct_forward_type
316 %type <dcval> interface_def interface interface_forward
317 %type <dcval> export operation attribute attribute_readonly attribute_readwrite
318 %type <dcval> template_module template_module_inst annotation_dcl typeid_dcl
319 %type <dcval> typeprefix_dcl exception component home_decl
320 %type <dcval> event_decl event_abs_decl event_forward_decl
321 %type <dcval> event_abs_forward_decl event_concrete_forward_decl
322 %type <dcval> porttype_decl connector_decl value_def
323 %type <dcval> valuetype value_abs_decl value_forward_decl value_box_decl
324 %type <dcval> value_concrete_decl component_forward_decl component_decl
325 %type <dcval> init_decl provides_decl uses_decl port_export
326 %type <dcval> component_export emits_decl publishes_decl consumes_decl
327 %type <dcval> extended_port_decl
329 %type <idlist> scoped_name interface_type component_inheritance_spec
330 %type <idlist> home_inheritance_spec primary_key_spec module_header
331 %type <idlist> template_module_header
333 %type <slval> opt_context at_least_one_string_literal
334 %type <slval> string_literals formal_parameter_names
335 %type <slval> at_least_one_formal_parameter_name
337 %type <nlval> at_least_one_scoped_name scoped_names inheritance_spec
338 %type <nlval> opt_raises opt_getraises opt_setraises supports_spec
340 %type <elval> at_least_one_array_dim array_dims
342 %type <llval> at_least_one_case_label case_labels
344 %type <dlval> at_least_one_declarator declarators
345 %type <dlval> at_least_one_simple_declarator simple_declarators
347 %type <ihval> interface_header
349 %type <vhval> value_header event_rest_of_header
351 %type <chval> component_header
353 %type <hhval> home_header
355 %type <exval> expression const_expr or_expr xor_expr and_expr shift_expr
356 %type <exval> add_expr mult_expr unary_expr primary_expr literal
357 %type <exval> positive_int_expr array_dim annotation_member_default
359 %type <ulval> case_label
361 %type <ffval> element_spec
363 %type <etval> const_type integer_type char_type boolean_type
364 %type <etval> floating_pt_type fixed_type any_type signed_int
365 %type <etval> unsigned_int base_type_spec octet_type object_type
366 %type <etval> annotation_member_type
368 %type <dival> direction
370 %type <ofval> opt_op_attribute
372 %type <deval> declarator simple_declarator complex_declarator
374 %type <bval> opt_truncatable opt_multiple uses_opt_multiple
376 %type <idval> interface_decl value_decl union_decl struct_decl id
377 %type <idval> defining_id
378 %type <idval> event_header event_plain_header event_custom_header
379 %type <idval> event_abs_header
381 %type <ntval> formal_parameter_type
383 %type <pival> formal_parameter
384 %type <plval> formal_parameters at_least_one_formal_parameter
386 %type <sval> formal_parameter_name
388 %type <alval> actual_parameters at_least_one_actual_parameter
390 %type <annotations_val> at_least_one_annotation annotations_maybe
391 %type <annotation_val> annotation_appl
392 %type <annotation_params_val> annotation_appl_params_maybe annotation_appl_params
393 %type <annotation_params_val> named_annotation_appl_params more_named_annotation_appl_params
394 %type <annotation_param_val> named_annotation_appl_param
395 %type <decl_annotations_pair_val> seq_head
397 %type <decls_val> member_i state_member value_element
398 %type <vival> visibility
402 * Production starts here.
404 start : definitions ;
407 : at_least_one_definition
411 at_least_one_definition
413 * This is broken up into 2 rules to avoid a grammer ambiguity which
414 * manifests as bison complaining about shift/reduce conflicts.
416 : definitions at_least_one_annotation definition
418 AST_Annotation_Appls *&annotations = $2;
419 AST_Decl *&node = $3;
422 node->annotation_appls (*annotations);
426 idl_global->err ()-> unsupported_warning (
427 "Annotating this is not supported");
431 | definitions definition
436 | template_module ';'
437 | template_module_inst ';'
443 idl_global->set_parse_state (IDL_GlobalData::PS_AnnotationDeclSeen);
447 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
451 idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
455 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
459 idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
463 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
467 idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
471 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
475 idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
479 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
483 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
487 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
491 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
495 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
499 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
503 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
507 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
511 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
515 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
519 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
523 idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
527 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
531 idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
535 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
539 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeDeclSeen);
543 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
547 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorDeclSeen);
551 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
555 idl_global->err ()->syntax_error (idl_global->parse_state ());
559 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
568 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
579 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen);
581 // The module_header rule is common to template module, fixed
582 // module and instantiated template module. In the last
583 // case, a fully scoped name is allowed, but here we
584 // allow only an identifier (a scoped name of length
585 // 1). If not satisfied, we output a parse error with
586 // the appropriate message.
587 if ($1->length () != 1)
589 idl_global->err ()->syntax_error (
590 IDL_GlobalData::PS_ModuleIDSeen);
594 UTL_Scope *s = idl_global->scopes ().top_non_null ();
597 * Make a new module and add it to the enclosing scope
601 m = idl_global->gen ()->create_module (s, $1);
602 (void) s->fe_add_module (m);
610 * Push it on the stack
612 idl_global->scopes ().push (m);
618 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen);
620 at_least_one_definition
622 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen);
626 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen);
628 * Finished with this module - pop it from the scope stack.
631 idl_global->scopes ().pop ();
636 template_module_header
639 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleIDSeen);
644 : template_module_header
646 // The module_header rule is common to template module, fixed
647 // module and instantiated template module. In the last
648 // case, a fully scoped name is allowed, but here we
649 // allow only an identifier (a scoped name of length
650 // 1). If not satisfied, we output a syntax error with
651 // the appropriate message.
652 if ($1->length () != 1)
654 idl_global->err ()->syntax_error (
655 IDL_GlobalData::PS_ModuleIDSeen);
658 at_least_one_formal_parameter
660 if (FE_Utils::duplicate_param_id ($3))
662 idl_global->err ()->duplicate_param_id (
670 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleParamsSeen);
672 AST_Template_Module *tm =
673 idl_global->gen ()->create_template_module ($1,
676 UTL_Scope *s = idl_global->scopes ().top_non_null ();
677 AST_Module *m = s->fe_add_module (tm);
679 // We've probably tried to reopen a template module,
680 // going further will cause a crash.
687 * Push it on the stack
689 idl_global->scopes ().push (tm);
691 // Contained items not part of an alias will get flag set.
692 idl_global->in_tmpl_mod_no_alias (true);
694 // Store these for reference as we parse the scope
695 // of the template module.
696 idl_global->current_params ($3);
700 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleSqSeen);
702 at_least_one_tpl_definition
704 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleBodySeen);
708 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleQsSeen);
711 * Finished with this module - pop it from the scope stack.
713 idl_global->scopes ().pop ();
715 // Unset the flag, the no_alias version because any scope
716 // traversal triggered by an alias would have ended by now.
717 idl_global->in_tmpl_mod_no_alias (false);
719 // Clear the pointer so scoped name lookup will know
720 // that we are no longer in a template module scope.
721 idl_global->current_params (0);
727 at_least_one_tpl_definition
728 : tpl_definition tpl_definitions
732 : tpl_definitions tpl_definition
738 | template_module_ref ';'
742 : IDL_ALIAS scoped_name
744 idl_global->set_parse_state (
745 IDL_GlobalData::PS_ModuleRefSeen);
747 '<' at_least_one_formal_parameter_name '>'
749 idl_global->set_parse_state (
750 IDL_GlobalData::PS_ModuleRefParamsSeen);
754 idl_global->set_parse_state (
755 IDL_GlobalData::PS_ModuleRefIDSeen);
757 UTL_Scope *s = idl_global->scopes ().top_non_null ();
759 s->lookup_by_name ($2);
763 idl_global->err ()->lookup_error ($2);
767 AST_Template_Module *ref =
768 dynamic_cast<AST_Template_Module*> (d);
772 idl_global->err ()->template_module_expected (d);
777 ref->match_param_refs ($5,
782 // Error message is already output.
786 UTL_ScopedName sn ($8, 0);
788 AST_Template_Module_Ref *tmr =
789 idl_global->gen ()->create_template_module_ref (
794 (void) s->fe_add_template_module_ref (tmr);
801 // Save the current flag value to be restored below.
802 bool itmna_flag = idl_global->in_tmpl_mod_no_alias ();
803 idl_global->in_tmpl_mod_no_alias (false);
804 idl_global->in_tmpl_mod_alias (true);
806 ast_visitor_context ctx;
807 ctx.template_params (ref->template_params ());
808 ast_visitor_tmpl_module_ref v (&ctx);
810 // The implied IDL resulting from this reference is
811 // created here, in the template module scope. Upon
812 // instantiation of the enclosing template module, the
813 // visitor copies this implied IDL to the instantiated
814 // module scope. The extra copy is less than ideal, but
815 // otherwise we have ugly lookup issues when the
816 // referenced template module's contents are referenced
817 // using the aliased scoped name.
818 if (v.visit_template_module_ref (tmr) != 0)
820 ACE_ERROR ((LM_ERROR,
821 ACE_TEXT ("visit_template_module_ref")
822 ACE_TEXT (" failed\n")));
824 idl_global->set_err_count (idl_global->err_count () + 1);
827 idl_global->in_tmpl_mod_no_alias (itmna_flag);
828 idl_global->in_tmpl_mod_alias (false);
833 : template_module_header
835 idl_global->set_parse_state (
836 IDL_GlobalData::PS_InstModuleSeen);
838 at_least_one_actual_parameter '>'
840 idl_global->set_parse_state (
841 IDL_GlobalData::PS_InstModuleArgsSeen);
845 idl_global->set_parse_state (
846 IDL_GlobalData::PS_InstModuleIDSeen);
848 UTL_Scope *s = idl_global->scopes ().top_non_null ();
849 UTL_ScopedName *sn = $1;
850 AST_Template_Module *ref = 0;
851 AST_Decl *d = s->lookup_by_name (sn);
855 idl_global->err ()->lookup_error (sn);
860 ref = dynamic_cast<AST_Template_Module*> (d);
864 idl_global->err ()->template_module_expected (d);
874 if (! ref->match_arg_names ($3))
884 AST_Template_Module_Inst *tmi =
885 idl_global->gen ()->create_template_module_inst (
890 (void) s->fe_add_template_module_inst (tmi);
892 ast_visitor_context ctx;
893 ctx.template_args ($3);
894 ast_visitor_tmpl_module_inst v (&ctx);
896 if (v.visit_template_module_inst (tmi) != 0)
898 ACE_ERROR ((LM_ERROR,
899 ACE_TEXT ("visit_template_module_inst")
900 ACE_TEXT (" failed\n")));
902 idl_global->set_err_count (idl_global->err_count () + 1);
917 UTL_Scope *s = idl_global->scopes ().top_non_null ();
918 AST_Interface *i = 0;
920 FE_InterfaceHeader *header = $1;
924 * Make a new interface node and add it to its enclosing scope.
928 i = idl_global->gen ()->create_interface (
931 header->n_inherits (),
932 header->inherits_flat (),
933 header->n_inherits_flat (),
935 header->is_abstract ()
937 AST_Interface::fwd_redefinition_helper (i, s);
939 * Add the interface to its definition scope.
941 s->fe_add_interface (i);
943 // This FE_InterfaceHeader class isn't destroyed with the AST.
949 * Push it on the scope stack.
951 idl_global->scopes ().push (i);
955 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
959 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
963 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
965 $$ = dynamic_cast<AST_Decl *> (idl_global->scopes ().top_non_null ());
967 * Done with this interface - pop it off the scopes stack
969 idl_global->scopes ().pop ();
976 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen);
980 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen);
986 interface_decl inheritance_spec
988 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
990 if ($2 != 0 && $2->truncatable ())
992 idl_global->err ()->syntax_error (
993 IDL_GlobalData::PS_InheritColonSeen
998 * Create an AST representation of the information in the header
999 * part of an interface - this representation contains a computed
1000 * list of all interfaces which this interface inherits from,
1003 UTL_ScopedName *n = 0;
1005 UTL_ScopedName ($1, 0),
1008 FE_InterfaceHeader (n,
1023 IDL_LOCAL interface_decl inheritance_spec
1025 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1028 * Create an AST representation of the information in the header
1029 * part of an interface - this representation contains a computed
1030 * list of all interfaces which this interface inherits from,
1033 UTL_ScopedName *n = 0;
1035 UTL_ScopedName ($2, 0),
1038 FE_InterfaceHeader (n,
1053 IDL_ABSTRACT interface_decl inheritance_spec
1055 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1058 * Create an AST representation of the information in the header
1059 * part of an interface - this representation contains a computed
1060 * list of all interfaces which this interface inherits from,
1063 UTL_ScopedName *n = 0;
1065 UTL_ScopedName ($2, 0),
1068 FE_InterfaceHeader (n,
1085 : ':' opt_truncatable
1087 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
1089 at_least_one_scoped_name
1091 $4->truncatable ($2);
1103 | value_forward_decl
1108 : IDL_CUSTOM value_concrete_decl
1110 idl_global->err ()->unsupported_error ("custom is not supported");
1113 | value_concrete_decl
1116 value_concrete_decl :
1119 FE_OBVHeader *&valuetype_header = $1;
1120 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
1121 AST_ValueType *valuetype = 0;
1123 if (scope && valuetype_header)
1125 valuetype = idl_global->gen ()->create_valuetype (
1126 valuetype_header->name (),
1127 valuetype_header->inherits (),
1128 valuetype_header->n_inherits (),
1129 valuetype_header->inherits_concrete (),
1130 valuetype_header->inherits_flat (),
1131 valuetype_header->n_inherits_flat (),
1132 valuetype_header->supports (),
1133 valuetype_header->n_supports (),
1134 valuetype_header->supports_concrete (),
1136 valuetype_header->truncatable (),
1139 AST_Interface *valuetype_as_interface =
1140 dynamic_cast<AST_Interface *> (valuetype);
1141 AST_Interface::fwd_redefinition_helper (
1142 valuetype_as_interface, scope);
1143 valuetype = dynamic_cast<AST_ValueType *> (
1144 valuetype_as_interface);
1147 * Add the valuetype to its definition scope
1149 scope->fe_add_valuetype (valuetype);
1151 // FE_OBVHeader is not automatically destroyed in the AST
1152 valuetype_header->destroy ();
1153 delete valuetype_header;
1154 valuetype_header = 0;
1158 * Push it on the scope stack
1160 idl_global->scopes ().push (valuetype);
1162 $<dcval>$ = valuetype;
1166 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
1170 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
1174 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
1177 dynamic_cast<AST_ValueType*> (
1178 idl_global->scopes ().top_non_null ()
1181 if (vt != 0 && vt->will_have_factory ())
1183 idl_global->valuefactory_seen_ = true;
1187 * Done with this value type - pop it off the scopes stack
1189 idl_global->scopes ().pop ();
1199 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1200 AST_ValueType *v = 0;
1201 AST_Interface *i = 0;
1203 if (s != 0 && $2 != 0)
1206 idl_global->gen ()->create_valuetype (
1210 $2->inherits_concrete (),
1211 $2->inherits_flat (),
1212 $2->n_inherits_flat (),
1215 $2->supports_concrete (),
1220 i = dynamic_cast<AST_Interface*> (v);
1221 AST_Interface::fwd_redefinition_helper (i,
1224 * Add the valuetype to its definition scope
1226 v = dynamic_cast<AST_ValueType*> (i);
1227 (void) s->fe_add_valuetype (v);
1229 // FE_OBVHeader is not automatically destroyed in the AST
1236 * Push it on the scope stack.
1238 idl_global->scopes ().push (v);
1242 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
1246 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
1250 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
1253 * Done with this valuetype - pop it off the scopes stack.
1255 idl_global->scopes ().pop ();
1265 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1269 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
1271 UTL_ScopedName *sn = 0;
1273 UTL_ScopedName ($1, 0),
1280 ? $2->truncatable ()
1303 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
1307 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
1325 at_least_one_scoped_name
1335 value_forward_decl :
1339 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1340 UTL_ScopedName n ($2,
1342 AST_ValueTypeFwd *f = 0;
1343 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
1346 * Create a node representing a forward declaration of an
1347 * valuetype. Store it in the enclosing scope
1351 f = idl_global->gen ()->create_valuetype_fwd (&n,
1353 (void) s->fe_add_valuetype_fwd (f);
1363 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1364 UTL_ScopedName n ($1,
1366 AST_ValueTypeFwd *f = 0;
1367 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
1370 * Create a node representing a forward declaration of an
1371 * valuetype. Store it in the enclosing scope
1375 f = idl_global->gen ()->create_valuetype_fwd (&n,
1377 (void) s->fe_add_valuetype_fwd (f);
1389 : value_decl type_spec /* in this order %!?*/
1391 idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
1393 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1394 UTL_ScopedName n ($1,
1397 if (s != 0 && $2 != 0)
1400 * Get the type_spec associated with the valuebox
1404 = dynamic_cast<AST_Typedef*> ($2);
1408 tp = dynamic_cast<AST_Type*> ($2);
1412 tp = td->primitive_base_type ();
1417 // The <type_spec> given is a valid type
1418 idl_global->err ()->not_a_type ($2);
1422 AST_Decl::NodeType nt = tp->node_type ();
1424 if (nt == AST_Decl::NT_valuetype
1425 || nt == AST_Decl::NT_eventtype)
1427 // valuetype is not allowed as <type_spec>
1429 idl_global->err ()->error0 (
1430 UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
1436 * Add the valuebox to its definition scope
1439 idl_global->gen ()->create_valuebox (&n,
1441 (void) s->fe_add_valuebox (vb);
1455 : value_elements at_least_one_annotation value_element
1457 AST_Annotation_Appls *&annotations = $2;
1458 AST_Decls *&decls = $3;
1461 for (size_t i = 0; i < decls->size (); i++)
1463 (*decls)[i]->annotation_appls (*annotations);
1468 idl_global->err ()-> unsupported_warning (
1469 "Annotating this is not supported");
1474 | value_elements value_element
1485 AST_Decl *&node = $1;
1486 AST_Decls *value = 0;
1489 value = new AST_Decls;
1490 value->push_back (node);
1496 AST_Decl *&node = $1;
1497 AST_Decls *value = 0;
1500 value = new AST_Decls;
1501 value->push_back (node);
1503 $<decls_val>$ = value;
1514 $$ = AST_Field::vis_PUBLIC;
1518 $$ = AST_Field::vis_PRIVATE;
1523 : visibility member_i
1525 AST_Field::Visibility &visibility = $1;
1526 AST_Decls *&decls_ptr = $2;
1529 AST_Decls &decls = *decls_ptr;
1530 for (size_t i = 0; i < decls.size (); i++)
1532 AST_Field *field = dynamic_cast<AST_Field *> (decls[i]);
1535 field->visibility (visibility);
1544 : at_least_one_export
1549 : exports at_least_one_annotation export
1551 AST_Annotation_Appls *annotations = $2;
1555 d->annotation_appls (*annotations);
1559 idl_global->err ()-> unsupported_warning (
1560 "Annotating this is not supported");
1570 idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
1574 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1578 idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
1582 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1586 idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
1590 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1594 idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
1598 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1602 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
1606 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1610 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
1614 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1618 idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen);
1622 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1626 idl_global->err ()->syntax_error (idl_global->parse_state ());
1630 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1636 at_least_one_scoped_name :
1637 scoped_name scoped_names
1639 ACE_NEW_RETURN ($<nlval>$,
1650 idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
1654 idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
1656 UTL_NameList *nl = 0;
1681 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1688 | IDL_SCOPE_DELIMITOR
1690 idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
1694 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1700 ACE::strdelete ($1);
1707 ACE_NEW_RETURN ($<idlist>$,
1715 idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
1717 // This cleans up all the non-global "::"s in scoped names.
1718 // If there is a global one, it gets put into the UTL_IdList,
1719 // so we clean it up in the case above.
1720 ACE::strdelete ($2);
1725 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1742 ACE::strdelete ($1);
1747 defining_id : IDENTIFIER
1749 /* defining_id is a defining identifier
1750 whereas id is usually a reference to a defining identifier */
1751 ACE_NEW_RETURN ($$, Identifier ($1), 1);
1752 ACE::strdelete ($1);
1760 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1761 UTL_ScopedName n ($1, 0);
1763 if (ACE_OS::strcmp ($1->get_string (),
1765 && !idl_global->in_main_file ())
1767 AST_PredefinedType *pdt =
1768 idl_global->gen ()->create_predefined_type (
1769 AST_PredefinedType::PT_pseudo,
1773 s->add_to_scope (pdt);
1782 AST_InterfaceFwd *f = 0;
1783 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
1786 * Create a node representing a forward declaration of an
1787 * interface. Store it in the enclosing scope
1791 f = idl_global->gen ()->create_interface_fwd (&n,
1794 (void) s->fe_add_interface_fwd (f);
1802 IDL_LOCAL interface_decl
1804 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1805 UTL_ScopedName n ($2,
1807 AST_InterfaceFwd *f = 0;
1808 idl_global->set_parse_state (
1809 IDL_GlobalData::PS_InterfaceForwardSeen
1813 * Create a node representing a forward declaration of an
1814 * interface. Store it in the enclosing scope
1818 f = idl_global->gen ()->create_interface_fwd (&n,
1821 (void) s->fe_add_interface_fwd (f);
1829 IDL_ABSTRACT interface_decl
1831 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1832 UTL_ScopedName n ($2,
1834 AST_InterfaceFwd *f = 0;
1835 idl_global->set_parse_state (
1836 IDL_GlobalData::PS_InterfaceForwardSeen
1840 * Create a node representing a forward declaration of an
1841 * interface. Store it in the enclosing scope
1845 f = idl_global->gen ()->create_interface_fwd (&n,
1848 (void) s->fe_add_interface_fwd (f);
1855 $$ = dynamic_cast<AST_Decl *> (f);
1862 idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen);
1866 idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen);
1870 idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen);
1874 idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen);
1879 UTL_ScopedName n ($5, 0);
1881 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1882 AST_Constant *c = 0;
1883 idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen);
1886 * Create a node representing a constant declaration. Store
1887 * it in the enclosing scope.
1889 if ($9 != 0 && s != 0)
1891 AST_Param_Holder *param_holder = $9->param_holder ();
1893 AST_Expression::AST_ExprValue *result =
1894 $9->check_and_coerce ($3, tao_enum_constant_decl);
1895 tao_enum_constant_decl = 0;
1897 // If the expression is a template parameter place
1898 // holder, 'result' will be 0, but it's ok.
1899 if (result == 0 && param_holder == 0)
1901 idl_global->err ()->coercion_error ($9, $3);
1908 AST_Expression::ExprType et = $3;
1910 if (param_holder != 0
1911 && et != param_holder->info ()->const_type_)
1913 idl_global->err ()->mismatched_template_param (
1914 param_holder->info ()->name_.c_str ());
1918 c = idl_global->gen ()->create_constant ($3, $9, &n);
1919 (void) s->fe_add_constant (c);
1943 $$ = AST_Expression::EV_string;
1947 $$ = AST_Expression::EV_wstring;
1951 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1952 AST_PredefinedType *c = 0;
1954 UTL_ScopedName *sn = $1;
1957 * If the constant's type is a scoped name, it must resolve
1958 * to a scalar constant type
1961 s->lookup_by_name (sn);
1963 if (s != 0 && d != 0)
1966 * Look through typedefs.
1968 while (d->node_type () == AST_Decl::NT_typedef)
1970 t = dynamic_cast<AST_Typedef*> (d);
1977 d = t->base_type ();
1980 if (d->node_type () == AST_Decl::NT_pre_defined)
1982 c = dynamic_cast<AST_PredefinedType*> (d);
1984 $$ = FE_Utils::PredefinedTypeToExprType (c->pt ());
1986 else if (d->node_type () == AST_Decl::NT_string)
1988 $$ = AST_Expression::EV_string;
1990 else if (d->node_type () == AST_Decl::NT_wstring)
1992 $$ = AST_Expression::EV_wstring;
1994 else if (d->node_type () == AST_Decl::NT_enum)
1996 $$ = AST_Expression::EV_enum;
1997 tao_enum_constant_decl =
1998 dynamic_cast<AST_Enum*> (d);
2002 idl_global->err ()->constant_expected (sn, d);
2007 idl_global->err ()->lookup_error (sn);
2017 expression : const_expr ;
2019 const_expr : or_expr ;
2022 | or_expr '|' xor_expr
2025 idl_global->gen ()->create_expr (
2026 AST_Expression::EC_or,
2035 | xor_expr '^' and_expr
2038 idl_global->gen ()->create_expr (
2039 AST_Expression::EC_xor,
2048 | and_expr '&' shift_expr
2051 idl_global->gen ()->create_expr (
2052 AST_Expression::EC_and,
2061 | shift_expr IDL_LEFT_SHIFT add_expr
2064 idl_global->gen ()->create_expr (
2065 AST_Expression::EC_left,
2070 | shift_expr IDL_RIGHT_SHIFT add_expr
2073 idl_global->gen ()->create_expr (
2074 AST_Expression::EC_right,
2083 | add_expr '+' mult_expr
2086 idl_global->gen ()->create_expr (
2087 AST_Expression::EC_add,
2092 | add_expr '-' mult_expr
2095 idl_global->gen ()->create_expr (
2096 AST_Expression::EC_minus,
2105 | mult_expr '*' unary_expr
2108 idl_global->gen ()->create_expr (
2109 AST_Expression::EC_mul,
2114 | mult_expr '/' unary_expr
2117 idl_global->gen ()->create_expr (
2118 AST_Expression::EC_div,
2123 | mult_expr '%' unary_expr
2126 idl_global->gen ()->create_expr (
2127 AST_Expression::EC_mod,
2139 idl_global->gen ()->create_expr (
2140 AST_Expression::EC_u_plus,
2148 idl_global->gen ()->create_expr (
2149 AST_Expression::EC_u_minus,
2157 idl_global->gen ()->create_expr (
2158 AST_Expression::EC_bit_neg,
2168 UTL_ScopedName *name = $1;
2171 * An expression which is a scoped name is not resolved now,
2172 * but only when it is evaluated (such as when it is assigned
2173 * as a constant value).
2175 AST_Expression *expr = 0;
2177 AST_Decl *node = stack_based_lookup_for_primary_expr ?
2178 idl_global->scopes ().lookup_by_name (name) :
2179 idl_global->scopes ().top_non_null ()->lookup_by_name (name);
2182 if (!idl_global->ignore_lookup_errors_)
2184 idl_global->err ()->lookup_error (name);
2188 else if (node->node_type () == AST_Decl::NT_const)
2191 * If the scoped name is an IDL constant, it
2192 * may be used in an array dim, a string
2193 * bound, or a sequence bound. If so, it
2194 * must be unsigned and > 0. We assign the
2195 * constant's value and type to the
2196 * expression created here so we can check
2199 AST_Constant *c = dynamic_cast<AST_Constant *> (node);
2200 expr = idl_global->gen ()->create_expr (
2201 c->constant_value (),
2206 // An AST_Expression owns the scoped name
2207 // passed in this constructor, so we copy it
2208 // and destroy it below no matter which case
2210 expr = idl_global->gen ()->create_expr (name->copy ());
2211 if (node->node_type () == AST_Decl::NT_enum_val)
2214 dynamic_cast<AST_EnumVal *> (node)->enum_parent ());
2224 | '(' const_expr ')'
2231 : IDL_INTEGER_LITERAL
2233 $$ = idl_global->gen ()->create_expr ($1);
2235 | IDL_UINTEGER_LITERAL
2238 idl_global->gen ()->create_expr ($1);
2240 | IDL_STRING_LITERAL
2242 $$ = idl_global->gen ()->create_expr ($1);
2247 | IDL_WSTRING_LITERAL
2249 char *wide_string = $1;
2250 $$ = idl_global->gen ()->create_expr (wide_string);
2251 ACE_OS::free (wide_string);
2254 | IDL_CHARACTER_LITERAL
2256 $$ = idl_global->gen ()->create_expr ($1);
2260 ACE_OutputCDR::from_wchar wc ($1);
2261 $$ = idl_global->gen ()->create_expr (wc);
2263 | IDL_FIXED_PT_LITERAL
2265 $$ = idl_global->gen ()->create_expr ($1);
2267 | IDL_FLOATING_PT_LITERAL
2269 $$ = idl_global->gen ()->create_expr ($1);
2273 $$ = idl_global->gen ()->create_expr (true);
2277 $$ = idl_global->gen ()->create_expr (false);
2284 int good_expression = 1;
2285 $1->evaluate (AST_Expression::EK_positive_int);
2286 AST_Expression::AST_ExprValue *ev = $1->ev ();
2289 * If const_expr is an enum value (AST_EnumVal inherits from
2290 * AST_Constant), the AST_ExprValue will probably not be set,
2291 * but there's no need to check anyway
2297 case AST_Expression::EV_ushort:
2298 if (ev->u.usval == 0)
2300 good_expression = 0;
2304 case AST_Expression::EV_ulong:
2305 if (ev->u.ulval == 0)
2307 good_expression = 0;
2311 case AST_Expression::EV_ulonglong:
2312 if (ev->u.ullval == 0)
2314 good_expression = 0;
2318 case AST_Expression::EV_octet:
2319 if (ev->u.oval == 0)
2321 good_expression = 0;
2325 case AST_Expression::EV_bool:
2326 if (ev->u.bval == 0)
2328 good_expression = 0;
2333 good_expression = 0;
2338 if (good_expression)
2344 idl_global->err ()->syntax_error (idl_global->parse_state ());
2350 : IDL_ANNOTATION_DECL defining_id '{'
2352 if (idl_global->idl_version_ < IDL_VERSION_4)
2354 idl_global->err ()->idl_version_error (
2355 "Annotations are an IDL4 feature");
2358 Identifier *id = $2;
2359 UTL_ScopedName name (id, 0);
2360 AST_Annotation_Decl::escape_name (&name);
2361 AST_Annotation_Decl *annotation_decl = idl_global->gen ()->
2362 create_annotation_decl (&name);
2363 idl_global->scopes ().top_non_null ()->
2364 fe_add_annotation_decl (annotation_decl);
2365 idl_global->scopes ().push (annotation_decl);
2369 Identifier *id = $2;
2370 idl_global->scopes ().pop ();
2379 : annotation_body annotation_statement
2383 annotation_statement
2389 idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
2390 idl_global->in_typedef (true);
2395 annotation_member_type
2401 : annotation_member_type defining_id annotation_member_default ';'
2403 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
2404 UTL_Scope *root = idl_global->scopes ().bottom ();
2406 AST_Expression::ExprType type = $1;
2407 Identifier *name = $2;
2408 // Annotation member names can't clash with C++ keywords
2409 FE_Utils::original_local_name (name);
2410 UTL_ScopedName *scoped_name = new UTL_ScopedName (name, 0);
2411 AST_Expression *default_value = $3;
2413 AST_Decl * type_obj;
2416 case AST_Expression::EV_string:
2417 case AST_Expression::EV_wstring:
2418 type_obj = tao_string_decl;
2420 case AST_Expression::EV_enum:
2421 type_obj = tao_enum_constant_decl;
2424 type_obj = root->lookup_primitive_type (type);
2427 FE_Declarator *declarator = new FE_Declarator (
2428 scoped_name, FE_Declarator::FD_simple, 0);
2429 AST_Annotation_Member *member = idl_global->gen ()->
2430 create_annotation_member (
2431 type, declarator->compose (type_obj), declarator->name ());
2432 scope->fe_add_annotation_member (member);
2434 declarator->destroy ();
2439 // Check if types are compatible, else report error
2440 AST_Expression::AST_ExprValue *result =
2441 default_value->check_and_coerce (type, tao_enum_constant_decl);
2442 tao_enum_constant_decl = 0;
2445 member->value (default_value);
2449 idl_global->err ()->coercion_error (default_value, type);
2456 annotation_member_default
2457 : IDL_DEFAULT const_expr
2467 at_least_one_annotation
2468 : annotations_maybe annotation_appl
2470 AST_Annotation_Appls *annotations = $1;
2471 AST_Annotation_Appl *annotation = $2;
2474 annotations->add (annotation);
2481 : annotations_maybe annotation_appl
2483 AST_Annotation_Appls *annotations = $1;
2484 AST_Annotation_Appl *annotation = $2;
2487 annotations->add (annotation);
2493 $$ = new AST_Annotation_Appls ();
2498 : IDL_ANNOTATION_SYMBOL scoped_name
2500 if (idl_global->idl_version_ < IDL_VERSION_4)
2502 idl_global->err ()->idl_version_error (
2503 "Annotations are an IDL4 feature");
2506 AST_Annotation_Decl *decl = 0;
2507 UTL_ScopedName *name = $2;
2508 AST_Annotation_Decl::escape_name (name);
2510 // Check for Matching Annotation Declaration
2511 AST_Decl *d = idl_global->scopes ().top_non_null ()->
2512 lookup_by_name (name);
2515 decl = dynamic_cast<AST_Annotation_Decl*> (d);
2518 idl_global->scopes ().push (decl);
2523 Identifier &id = *name->last_component ();
2524 switch (idl_global->unknown_annotations_)
2527 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_WARN_ONCE:
2528 if (idl_global->unknown_annotations_seen_.insert (id) == 1)
2532 idl_global->err ()->lookup_warning (name);
2534 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_WARN_ALL:
2535 idl_global->err ()->lookup_warning (name);
2537 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_ERROR:
2538 idl_global->err ()->lookup_error (name);
2540 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_IGNORE:
2545 * Ignore lookup errors for parameter values that might depend on
2546 * constants or enums from the missing annotation declaration.
2548 idl_global->ignore_lookup_errors_ = true;
2551 stack_based_lookup_for_primary_expr = true;
2553 $<annotation_decl_val>$ = decl;
2555 annotation_appl_params_maybe
2557 idl_global->ignore_lookup_errors_ = false;
2558 stack_based_lookup_for_primary_expr = false;
2559 AST_Annotation_Appl *appl = 0;
2560 UTL_ScopedName *name = $2;
2561 AST_Annotation_Decl *decl = $<annotation_decl_val>3;
2562 AST_Annotation_Appl::Params *params = $4;
2566 appl = idl_global->gen ()->create_annotation_appl (name, params);
2567 appl->apply_from (decl);
2568 idl_global->scopes ().pop ();
2572 AST_Annotation_Appl::delete_params (params);
2585 annotation_appl_params_maybe
2586 : '(' annotation_appl_params ')'
2596 annotation_appl_params
2599 AST_Annotation_Appl::Params *params = new AST_Annotation_Appl::Params;
2600 AST_Annotation_Appl::Param *param = new AST_Annotation_Appl::Param;
2603 params->push (param);
2606 | named_annotation_appl_params
2612 named_annotation_appl_params
2613 : named_annotation_appl_param more_named_annotation_appl_params
2615 AST_Annotation_Appl::Params *params = $2;
2620 more_named_annotation_appl_params
2621 : ',' named_annotation_appl_param more_named_annotation_appl_params
2623 AST_Annotation_Appl::Params *params = $3;
2629 $$ = new AST_Annotation_Appl::Params;
2633 named_annotation_appl_param
2636 AST_Annotation_Appl::Param *param = new AST_Annotation_Appl::Param;
2638 // Annotation Member Names Can't Clash with C++ keywords
2639 FE_Utils::original_local_name (param->id);
2648 idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
2649 idl_global->in_typedef (true);
2667 | IDL_NATIVE simple_declarator
2669 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2670 AST_Native *node = 0;
2671 idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen);
2674 * Create a node representing a Native and add it to its
2680 idl_global->gen ()->create_native (
2684 * Add it to its defining scope
2686 (void) s->fe_add_native (node);
2695 | constructed_forward_type_spec
2704 idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen);
2706 at_least_one_declarator
2708 AST_Decl *type_spec = $1;
2709 UTL_DeclList *decls = $3;
2711 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2712 FE_Declarator *d = 0;
2714 unsigned long index = 0UL;
2715 idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen);
2718 * Create a list of type renamings. Add them to the
2721 if (s && type_spec && decls)
2723 for (UTL_DecllistActiveIterator l (decls); !l.is_done (); l.next ())
2731 AST_Type *tp = d->compose (type_spec);
2737 if (AST_Decl::NT_except == tp->node_type ())
2739 idl_global->err ()->not_a_type (tp);
2743 t = idl_global->gen ()->create_typedef (tp,
2748 // If the base type is a sequence or array, the typedef
2749 // constructor sets owns_base_type_ to true. But if
2750 // there is a comma-separated list of such typedefs,
2751 // the base type can be destroyed only once. In all
2752 // other cases, the line below has no effect.
2755 t->owns_base_type (false);
2758 (void) s->fe_add_typedef (t);
2759 idl_global->in_typedef (false);
2762 // This FE_Declarator class isn't destroyed with the AST.
2774 | constructed_type_spec
2781 idl_global->scopes ().bottom ()->lookup_primitive_type (
2785 | template_type_spec
2788 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2794 s->lookup_by_name ($1);
2799 idl_global->err ()->lookup_error ($1);
2803 d->last_referenced_as ($1);
2823 : sequence_type_spec
2829 constructed_type_spec
2835 constructed_forward_type_spec
2836 : struct_forward_type
2837 | union_forward_type
2840 at_least_one_declarator :
2841 declarator declarators
2854 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
2858 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
2860 UTL_DeclList *dl = 0;
2884 | complex_declarator
2887 at_least_one_simple_declarator :
2888 simple_declarator simple_declarators
2890 ACE_NEW_RETURN ($<dlval>$,
2898 : simple_declarators
2901 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
2905 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
2907 UTL_DeclList *dl = 0;
2932 UTL_ScopedName *sn = 0;
2937 ACE_NEW_RETURN ($<deval>$,
2939 FE_Declarator::FD_simple,
2945 complex_declarator :
2948 UTL_ScopedName *sn = 0;
2951 $1->local_name ()->copy (),
2955 ACE_NEW_RETURN ($<deval>$,
2957 FE_Declarator::FD_complex,
2971 $$ = AST_Expression::EV_long;
2975 $$ = AST_Expression::EV_longlong;
2979 $$ = AST_Expression::EV_short;
2984 : IDL_UNSIGNED IDL_LONG
2986 $$ = AST_Expression::EV_ulong;
2988 | IDL_UNSIGNED IDL_LONG IDL_LONG
2990 $$ = AST_Expression::EV_ulonglong;
2992 | IDL_UNSIGNED IDL_SHORT
2994 $$ = AST_Expression::EV_ushort;
3001 $$ = AST_Expression::EV_double;
3005 $$ = AST_Expression::EV_float;
3007 | IDL_LONG IDL_DOUBLE
3009 $$ = AST_Expression::EV_longdouble;
3016 $$ = AST_Expression::EV_fixed;
3023 $$ = AST_Expression::EV_char;
3027 $$ = AST_Expression::EV_wchar;
3034 $$ = AST_Expression::EV_octet;
3041 $$ = AST_Expression::EV_bool;
3048 $$ = AST_Expression::EV_any;
3055 $$ = AST_Expression::EV_object;
3062 idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen);
3066 idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
3075 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3076 UTL_ScopedName n ($1, 0);
3077 AST_Structure *d = 0;
3080 * Create a node representing a struct declaration. Add it
3081 * to the enclosing scope
3086 idl_global->gen ()->create_structure (
3091 AST_Structure::fwd_redefinition_helper (d, s);
3092 (void) s->fe_add_structure (d);
3096 * Push the scope of the struct on the scopes stack.
3098 idl_global->scopes ().push (d);
3106 idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen);
3110 idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen);
3114 idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
3117 * Done with this struct. Pop its scope off the scopes stack.
3119 $$ = dynamic_cast<AST_Structure*> (
3120 idl_global->scopes ().top_non_null ()
3122 idl_global->scopes ().pop ();
3126 at_least_one_member : member members ;
3134 : annotations_maybe member_i
3136 AST_Annotation_Appls *annotations = $1;
3137 AST_Decls *members = $2;
3138 if (annotations && members)
3140 for (size_t i = 0; i < members->size (); i++)
3142 (*members)[i]->annotation_appls (*annotations);
3153 idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen);
3155 at_least_one_declarator
3157 idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen);
3161 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3162 FE_Declarator *d = 0;
3164 idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted);
3165 AST_Decls *members = 0;
3168 * Check for illegal recursive use of type.
3171 && AST_illegal_recursive_type ($1))
3173 idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
3177 * Create a node representing a struct or exception member
3178 * Add it to the enclosing scope.
3180 else if (s && $1 && $3)
3182 members = new AST_Decls;
3183 for (UTL_DecllistActiveIterator l ($3);
3194 AST_Type *tp = d->compose ($1);
3201 f = idl_global->gen ()->create_field (tp, d->name ());
3202 members->push_back (f);
3203 (void) s->fe_add_field (f);
3215 idl_global->err ()->syntax_error (idl_global->parse_state ());
3219 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
3227 idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen);
3231 idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen);
3237 : union_decl IDL_SWITCH
3239 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen);
3243 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3244 UTL_ScopedName n ($1, 0);
3246 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen);
3249 * Create a node representing an empty union. Add it to its enclosing
3254 u = idl_global->gen ()->create_union (0,
3259 AST_Structure *st = dynamic_cast<AST_Structure*> (u);
3260 AST_Structure::fwd_redefinition_helper (st, s);
3261 u = dynamic_cast<AST_Union*> (st);
3262 (void) s->fe_add_union (u);
3266 * Push the scope of the union on the scopes stack
3268 idl_global->scopes ().push (u);
3271 * Don't delete $1 yet; we'll need it a bit later.
3274 annotations_maybe switch_type_spec
3276 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen);
3281 * The top of the scopes must be an empty union we added after we
3282 * encountered 'union <id> switch ('. Now we are ready to add a
3283 * correct one. Temporarily remove the top so that we setup the
3284 * correct union in a right scope.
3286 UTL_Scope *top = idl_global->scopes ().top_non_null ();
3287 idl_global->scopes ().pop ();
3288 AST_Annotation_Appls *disc_annotations = $6;
3290 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3291 UTL_ScopedName n ($1, 0);
3292 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen);
3295 * Create a node representing a union.
3297 if ($7 != 0 && s != 0)
3299 AST_ConcreteType *tp =
3300 dynamic_cast<AST_ConcreteType*> ($7);
3304 idl_global->err ()->not_a_type ($7);
3308 /* Create a union with a correct discriminator. */
3310 u = idl_global->gen ()->create_union (tp,
3315 /* Narrow the enclosing scope. */
3316 AST_Union *e = dynamic_cast<AST_Union*> (top);
3319 e->disc_annotations (*disc_annotations); // Set Discriminator Annotations
3329 idl_global->scopes ().push (top);
3335 delete disc_annotations;
3339 idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen);
3341 at_least_one_case_branch
3343 idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen);
3347 idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen);
3350 * Done with this union. Pop its scope from the scopes stack.
3352 $$ = dynamic_cast<AST_Union*> (
3353 idl_global->scopes ().top_non_null ()
3358 idl_global->scopes ().pop ();
3367 idl_global->scopes ().bottom ()->lookup_primitive_type (
3373 /* wchars are not allowed. */
3374 if ($1 == AST_Expression::EV_wchar)
3376 idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
3380 idl_global->scopes ().bottom ()->lookup_primitive_type (
3386 /* octets are not allowed. */
3387 idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
3389 idl_global->scopes ().bottom ()->lookup_primitive_type (
3396 idl_global->scopes ().bottom ()->lookup_primitive_type (
3403 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3405 AST_PredefinedType *p = 0;
3410 * The discriminator is a scoped name. Try to resolve to
3411 * one of the scalar types or to an enum. Thread through
3412 * typedef's to arrive at the base type at the end of the
3416 s->lookup_by_name ($1);
3418 if (s != 0 && d != 0)
3422 switch (d->node_type ())
3424 case AST_Decl::NT_enum:
3428 case AST_Decl::NT_pre_defined:
3429 p = dynamic_cast<AST_PredefinedType*> (d);
3435 case AST_PredefinedType::PT_long:
3436 case AST_PredefinedType::PT_ulong:
3437 case AST_PredefinedType::PT_longlong:
3438 case AST_PredefinedType::PT_ulonglong:
3439 case AST_PredefinedType::PT_short:
3440 case AST_PredefinedType::PT_ushort:
3441 case AST_PredefinedType::PT_char:
3442 case AST_PredefinedType::PT_boolean:
3446 case AST_PredefinedType::PT_wchar:
3447 case AST_PredefinedType::PT_octet:
3448 /* octets and wchars are not allowed */
3449 idl_global->err ()->error0 (
3450 UTL_Error::EIDL_DISC_TYPE
3468 case AST_Decl::NT_typedef:
3469 t = dynamic_cast<AST_Typedef*> (d);
3473 d = t->base_type ();
3491 idl_global->err ()->lookup_error ($1);
3497 /* If we don't return here, we'll crash later.*/
3498 if (!idl_global->ignore_lookup_errors_)
3510 at_least_one_case_branch : case_branch case_branches ;
3513 : case_branches case_branch
3518 at_least_one_case_label
3520 idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen);
3522 annotations_maybe element_spec
3524 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen);
3528 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3529 AST_UnionBranch *b = 0;
3530 AST_Annotation_Appls *annotations = $3;
3532 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted);
3535 * Create several nodes representing branches of a union.
3536 * Add them to the enclosing scope (the union scope)
3538 if (s != 0 && $1 != 0 && $4 != 0)
3541 idl_global->gen ()->create_union_branch (
3546 b->annotation_appls (*annotations);
3547 (void) s->fe_add_union_branch (b);
3549 // f has passed its field type to the union branch,
3550 // but the rest still needs to be cleaned up.
3551 f->AST_Decl::destroy ();
3560 idl_global->err ()->syntax_error (idl_global->parse_state ());
3564 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
3569 at_least_one_case_label :
3570 case_label case_labels
3572 ACE_NEW_RETURN ($<llval>$,
3580 : case_labels case_label
3582 UTL_LabelList *ll = 0;
3607 idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen);
3611 idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
3613 $$ = idl_global->gen ()->create_union_label (
3614 AST_UnionLabel::UL_default,
3620 idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen);
3624 idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen);
3628 idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
3630 $$ = idl_global->gen ()->create_union_label (
3631 AST_UnionLabel::UL_label,
3640 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen);
3644 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen);
3647 * Check for illegal recursive use of type
3650 && AST_illegal_recursive_type ($1))
3652 idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, $1);
3657 * Create a field in a union branch
3666 AST_Type *tp = $3->compose ($1);
3674 $$ = idl_global->gen ()->create_field (
3690 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3691 UTL_ScopedName n ($1,
3693 AST_StructureFwd *d = 0;
3696 * Create a node representing a forward declaration of a struct.
3700 d = idl_global->gen ()->create_structure_fwd (&n);
3701 (void) s->fe_add_structure_fwd (d);
3715 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3716 UTL_ScopedName n ($1,
3718 AST_UnionFwd *u = 0;
3721 * Create a node representing a forward declaration of a union.
3725 u = idl_global->gen ()->create_union_fwd (&n);
3726 (void) s->fe_add_union_fwd (u);
3738 idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
3742 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3743 UTL_ScopedName n ($3, 0);
3745 idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
3748 * Create a node representing an enum and add it to its
3753 e = idl_global->gen ()->create_enum (&n,
3757 * Add it to its defining scope
3759 (void) s->fe_add_enum (e);
3763 * Push the enum scope on the scopes stack.
3765 idl_global->scopes ().push (e);
3773 idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen);
3775 at_least_one_enumerator
3777 idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen);
3781 idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen);
3784 * Done with this enum. Pop its scope from the scopes stack.
3786 if (idl_global->scopes ().top () == 0)
3792 $$ = dynamic_cast<AST_Enum*> (
3793 idl_global->scopes ().top_non_null ()
3795 idl_global->scopes ().pop ();
3800 at_least_one_enumerator : enumerator enumerators ;
3806 idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
3813 annotations_maybe IDENTIFIER
3815 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3816 AST_Annotation_Appls *annotations = $1;
3818 ACE::strdelete ($2);
3820 UTL_ScopedName n (&id, 0);
3825 * Create a node representing one enumerator in an enum
3826 * Add it to the enclosing scope (the enum scope)
3829 && s->scope_node_type () == AST_Decl::NT_enum)
3831 c = dynamic_cast<AST_Enum*> (s);
3835 e = idl_global->gen ()->create_enum_val (
3836 c->next_enum_val (),
3840 e->annotation_appls (*annotations);
3843 (void) s->fe_add_enum_val (e);
3854 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen);
3858 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen);
3862 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
3864 AST_Sequence *seq = 0;
3865 Decl_Annotations_Pair *seq_head = $1;
3867 AST_Annotation_Appls *type_annotations = 0;
3870 type = seq_head->decl;
3871 type_annotations = seq_head->annotations;
3876 * Remove sequence marker from scopes stack.
3878 if (idl_global->scopes ().top () == 0)
3880 idl_global->scopes ().pop ();
3883 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3886 * Create a node representing a sequence
3888 AST_Expression::AST_ExprValue *ev = 0;
3889 AST_Param_Holder *param_holder = 0;
3894 $4->param_holder ();
3896 ev = $4->coerce (AST_Expression::EV_ulong);
3899 // If the expression corresponds to a template parameter,
3900 // it's ok for the coercion to fail at this point. We check
3901 // for a type mismatch below.
3903 || (0 == ev && 0 == param_holder))
3905 idl_global->err ()->coercion_error ($4,
3906 AST_Expression::EV_ulong);
3910 AST_Type *tp = dynamic_cast<AST_Type*> (type);
3914 ; // Error will be caught in FE_Declarator.
3918 Identifier id ("sequence");
3919 UTL_ScopedName sn (&id,
3923 idl_global->gen ()->create_sequence (
3930 seq->base_type_annotations (*type_annotations);
3932 idl_global->err ()->anonymous_type_diagnostic ();
3936 delete type_annotations;
3944 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
3946 AST_Sequence *seq = 0;
3947 Decl_Annotations_Pair *seq_head = $1;
3949 AST_Annotation_Appls *type_annotations = 0;
3952 type = seq_head->decl;
3953 type_annotations = seq_head->annotations;
3958 * Remove sequence marker from scopes stack.
3960 if (idl_global->scopes ().top () == 0)
3962 idl_global->scopes ().pop ();
3965 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3968 * Create a node representing a sequence.
3972 AST_Type *tp = dynamic_cast<AST_Type*> (type);
3976 ; // Error will be caught in FE_Declarator.
3980 Identifier id ("sequence");
3981 UTL_ScopedName sn (&id, 0);
3982 ACE_CDR::ULong bound = 0UL;
3985 idl_global->gen ()->create_sequence (
3986 idl_global->gen ()->create_expr (
3988 AST_Expression::EV_ulong
3995 seq->base_type_annotations (*type_annotations);
3997 idl_global->err ()->anonymous_type_diagnostic ();
4001 delete type_annotations;
4009 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
4012 * Push a sequence marker on scopes stack.
4014 idl_global->scopes ().push (0);
4018 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen);
4020 annotations_maybe simple_type_spec
4022 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen);
4023 Decl_Annotations_Pair *seq_head = new Decl_Annotations_Pair;
4024 seq_head->decl = $6;
4025 seq_head->annotations = $5;
4031 : IDL_FIXED '<' positive_int_expr ',' const_expr '>'
4033 $5->evaluate (AST_Expression::EK_positive_int);
4034 $$ = idl_global->gen ()->create_fixed ($3, $5);
4042 idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
4046 idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
4050 idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
4053 * Create a node representing a string.
4055 AST_Expression::AST_ExprValue *ev = 0;
4059 ev = $4->coerce (AST_Expression::EV_ulong);
4062 if (0 == $4 || 0 == ev)
4064 idl_global->err ()->coercion_error ($4,
4065 AST_Expression::EV_ulong);
4070 tao_string_decl = idl_global->gen ()->create_string ($4);
4073 * Add this AST_String to the types defined in the global scope.
4075 idl_global->root ()->fe_add_string (
4076 dynamic_cast<AST_String*> (
4079 idl_global->err ()->anonymous_type_diagnostic ();
4081 $$ = tao_string_decl;
4089 idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
4092 * Create a node representing a string.
4094 ACE_CDR::ULong bound = 0UL;
4096 idl_global->gen ()->create_string (
4097 idl_global->gen ()->create_expr (bound,
4098 AST_Expression::EV_ulong)
4102 * Add this AST_String to the types defined in the global scope.
4104 idl_global->root ()->fe_add_string (
4105 dynamic_cast<AST_String*> (
4108 $$ = tao_string_decl;
4115 idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
4123 idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
4127 idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
4131 idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
4134 * Create a node representing a string.
4136 AST_Expression::AST_ExprValue *ev = 0;
4140 ev = $4->coerce (AST_Expression::EV_ulong);
4143 if (0 == $4 || 0 == ev)
4145 idl_global->err ()->coercion_error ($4,
4146 AST_Expression::EV_ulong);
4151 AST_String *string = idl_global->gen ()->create_wstring ($4);
4154 * Add this AST_String to the types defined in the global scope.
4156 idl_global->root ()->fe_add_string (
4157 dynamic_cast<AST_String*> (
4160 idl_global->err ()->anonymous_type_diagnostic ();
4170 idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
4173 * Create a node representing a wstring.
4175 ACE_CDR::ULong bound = 0UL;
4176 AST_String *string =
4177 idl_global->gen ()->create_wstring (
4178 idl_global->gen ()->create_expr (bound,
4179 AST_Expression::EV_ulong)
4183 * Add this AST_String to the types defined in the global scope.
4185 idl_global->root ()->fe_add_string (
4186 dynamic_cast<AST_String*> (
4196 idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
4203 idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen);
4205 annotations_maybe at_least_one_array_dim
4207 idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted);
4209 AST_Array *array = 0;
4210 AST_Annotation_Appls *base_type_annotations = $3;
4211 UTL_ExprList *array_dims = $4;
4214 * Create a node representing an array.
4218 UTL_ScopedName sn ($1,
4221 idl_global->gen ()->create_array (
4223 array_dims->length (),
4228 array->base_type_annotations (*base_type_annotations);
4231 idl_global->err ()->anonymous_type_diagnostic ();
4234 array_dims->destroy ();
4237 delete base_type_annotations;
4243 at_least_one_array_dim :
4244 array_dim array_dims
4254 : array_dims array_dim
4256 UTL_ExprList *el = 0;
4281 idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen);
4285 idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen);
4289 idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen);
4292 * Array dimensions are expressions which must be coerced to
4293 * positive integers.
4295 AST_Expression::AST_ExprValue *ev = 0;
4296 AST_Param_Holder *param_holder = 0;
4301 $3->param_holder ();
4304 $3->coerce (AST_Expression::EV_ulong);
4308 || (ev == 0 && param_holder == 0))
4310 idl_global->err ()->coercion_error ($3,
4311 AST_Expression::EV_ulong);
4316 if (param_holder != 0)
4318 AST_Expression::ExprType et =
4319 param_holder->info ()->const_type_;
4321 // If the bound expression represents a
4322 // template parameter, it must be a const
4323 // and of type unsigned long.
4324 if (et != AST_Expression::EV_ulong)
4326 idl_global->err ()->mismatched_template_param (
4327 param_holder->info ()->name_.c_str ());
4344 : attribute_readonly
4345 | attribute_readwrite
4348 attribute_readonly :
4351 idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
4355 idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
4359 idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
4361 at_least_one_simple_declarator
4363 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
4367 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4368 AST_Attribute *a = 0;
4369 FE_Declarator *d = 0;
4371 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4374 * Create nodes representing attributes and add them to the
4377 if (s != 0 && $5 != 0 && $7 != 0)
4379 for (UTL_DecllistActiveIterator l ($7); !l.is_done (); l.next ())
4388 AST_Type *tp = d->compose ($5);
4395 a = idl_global->gen ()->create_attribute (
4396 true, tp, d->name (), s->is_local (), s->is_abstract ());
4400 (void) a->fe_add_get_exceptions ($9);
4407 (void) s->fe_add_attribute (a);
4419 attribute_readwrite :
4422 idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
4426 idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
4428 at_least_one_simple_declarator
4430 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
4434 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseCompleted);
4438 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4439 AST_Attribute *a = 0;
4440 FE_Declarator *d = 0;
4442 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseCompleted);
4445 * Create nodes representing attributes and add them to the
4448 if (s != 0 && $3 != 0 && $5 != 0)
4450 for (UTL_DecllistActiveIterator l ($5); !l.is_done (); l.next ())
4459 AST_Type *tp = d->compose ($3);
4466 a = idl_global->gen ()->create_attribute (
4467 false, tp, d->name (), s->is_local (), s->is_abstract ());
4471 (void) a->fe_add_get_exceptions ($7);
4480 (void) a->fe_add_set_exceptions ($9);
4487 (void) s->fe_add_attribute (a);
4502 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
4506 Identifier *&id = $3;
4507 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
4508 UTL_ScopedName scoped_name (id, 0);
4509 AST_Exception *exception = 0;
4510 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen);
4513 * Create a node representing an exception and add it to
4514 * the enclosing scope.
4518 exception = idl_global->gen ()->create_exception (
4521 scope->is_abstract ());
4522 scope->fe_add_exception (exception);
4526 * Push the exception scope on the scope stack.
4528 idl_global->scopes ().push (exception);
4534 $<dcval>$ = exception;
4538 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen);
4542 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen);
4546 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen);
4548 * Done with this exception. Pop its scope from the scope stack.
4550 idl_global->scopes ().pop ();
4557 : opt_op_attribute op_type_spec
4559 idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
4563 AST_Operation *op = 0;
4564 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
4566 AST_Operation::Flags op_flags = $1;
4567 AST_Decl *type_node = $2;
4570 ACE::strdelete ($4);
4573 UTL_ScopedName name (&id, 0);
4574 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
4577 * Create a node representing an operation on an interface
4578 * and add it to its enclosing scope.
4580 if (scope != 0 && type_node != 0)
4582 AST_Type *type = dynamic_cast<AST_Type*> (type_node);
4586 idl_global->err ()->not_a_type (type_node);
4588 else if (type->node_type () == AST_Decl::NT_except)
4590 idl_global->err ()->not_a_type (type_node);
4594 AST_Decl *d = ScopeAsDecl (scope);
4595 AST_Decl::NodeType nt = d->node_type ();
4596 const bool local = scope->is_local ()
4597 || nt == AST_Decl::NT_valuetype
4598 || nt == AST_Decl::NT_eventtype;
4600 op = idl_global->gen ()->create_operation (
4601 type, op_flags, &name, local, scope->is_abstract ());
4603 if (!local && type->is_local ())
4605 idl_global->err ()->local_remote_mismatch (type, op);
4612 scope->fe_add_operation (op);
4618 * Push the operation scope onto the scopes stack.
4620 idl_global->scopes ().push (op);
4624 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
4628 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4632 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4633 AST_Operation *o = 0;
4634 idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted);
4637 * Add exceptions and context to the operation.
4639 if (s != 0 && s->scope_node_type () == AST_Decl::NT_op)
4641 o = dynamic_cast<AST_Operation*> (s);
4643 if ($8 != 0 && o != 0)
4645 (void) o->fe_add_exceptions ($8);
4650 (void) o->fe_add_context ($10);
4655 * Done with this operation. Pop its scope from the scopes stack.
4657 idl_global->scopes ().pop ();
4666 idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
4667 $$ = AST_Operation::OP_oneway;
4671 idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
4672 $$ = AST_Operation::OP_idempotent;
4676 $$ = AST_Operation::OP_noflags;
4685 idl_global->scopes ().bottom ()->lookup_primitive_type (
4686 AST_Expression::EV_void
4694 //@@ PS_FactorySeen?
4695 idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
4699 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4701 if (s->is_abstract ())
4704 ACE_ERROR ((LM_ERROR,
4705 ACE_TEXT ("error in %C line %d:\n")
4706 ACE_TEXT ("Abstract valuetype can't have a ")
4707 ACE_TEXT ("factory construct.\n"),
4708 idl_global->filename ()->get_string (),
4709 idl_global->lineno ()));
4711 idl_global->set_err_count (idl_global->err_count () + 1);
4715 ACE::strdelete ($3);
4718 UTL_ScopedName n (&id,
4720 AST_Factory *factory = 0;
4721 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
4724 * Create a node representing an factory construct
4725 * and add it to its enclosing scope
4729 factory = idl_global->gen ()->create_factory (&n);
4730 (void) s->fe_add_factory (factory);
4734 * Push the operation scope onto the scopes stack.
4736 idl_global->scopes ().push (factory);
4738 $<dcval>$ = factory;
4742 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
4746 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4750 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4751 AST_Factory *f = dynamic_cast<AST_Factory*> (s);
4752 (void) f->fe_add_exceptions ($7);
4755 idl_global->scopes ().pop ();
4764 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4768 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4772 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4774 at_least_one_in_parameter
4777 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4781 at_least_one_in_parameter : in_parameter in_parameters ;
4787 idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
4796 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
4800 idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
4804 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4805 AST_Argument *a = 0;
4806 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
4809 * Create a node representing an argument to an operation
4810 * Add it to the enclosing scope (the operation scope).
4816 AST_Type *tp = $5->compose ($3);
4820 a = idl_global->gen ()->create_argument (
4821 AST_Argument::dir_IN,
4826 (void) s->fe_add_argument (a);
4839 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4843 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4847 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4849 at_least_one_parameter
4852 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4856 at_least_one_parameter : parameter parameters ;
4862 idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
4871 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
4875 idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
4879 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4880 AST_Argument *a = 0;
4881 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
4884 * Create a node representing an argument to an operation
4885 * Add it to the enclosing scope (the operation scope).
4891 AST_Type *tp = $5->compose ($3);
4895 if (!s->is_local () && tp->is_local ())
4897 idl_global->err ()->local_remote_mismatch (tp, s);
4902 idl_global->gen ()->create_argument (
4907 (void) s->fe_add_argument (a);
4922 idl_global->scopes ().bottom ()->lookup_primitive_type (
4930 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4932 UTL_ScopedName *n = $1;
4936 d = s->lookup_by_name (n, false, false);
4941 idl_global->err ()->lookup_error (n);
4945 /* If we don't return here, we'll crash later.*/
4950 d->last_referenced_as ($1);
4951 AST_Decl::NodeType nt = d->node_type ();
4952 AST_Type *t = dynamic_cast<AST_Type*> (d);
4953 AST_Typedef *td = 0;
4954 bool can_be_undefined = false;
4956 if (nt == AST_Decl::NT_typedef)
4958 // This code block ensures that a sequence of
4959 // as-yet-undefined struct or union isn't used
4960 // as a return type or argument.
4961 td = dynamic_cast<AST_Typedef*> (d);
4962 AST_Type *pbt = td->primitive_base_type ();
4964 if (pbt->node_type () == AST_Decl::NT_sequence)
4967 AST_Sequence *seq_type =
4968 dynamic_cast<AST_Sequence*> (pbt);
4969 AST_Type *elem_type =
4970 seq_type->base_type ();
4971 AST_Decl::NodeType elem_nt =
4972 elem_type->node_type ();
4974 if (elem_nt == AST_Decl::NT_typedef)
4976 AST_Typedef *elem_td =
4977 dynamic_cast<AST_Typedef*> (elem_type);
4978 elem_type = elem_td->primitive_base_type ();
4979 elem_nt = elem_type->node_type ();
4982 if (elem_nt == AST_Decl::NT_interface
4983 || elem_nt == AST_Decl::NT_interface_fwd
4984 || elem_nt == AST_Decl::NT_valuetype
4985 || elem_nt == AST_Decl::NT_valuetype_fwd
4986 || elem_nt == AST_Decl::NT_component
4987 || elem_nt == AST_Decl::NT_component_fwd)
4989 can_be_undefined = true;
4993 if (! t->is_defined () && ! can_be_undefined)
4995 idl_global->err ()->error1 (
4996 UTL_Error::EIDL_ILLEGAL_ADD,
4997 (nt == AST_Decl::NT_typedef ? td : t));
4999 /* If we don't return here, we'll crash later.*/
5005 // For forward declared structs and unions, we
5006 // want the full definition, but we need to
5007 // check that it's been fully defined.
5008 AST_StructureFwd *fwd =
5009 dynamic_cast<AST_StructureFwd*> (d);
5013 t = fwd->full_definition ();
5015 if (! t->is_defined ())
5017 idl_global->err ()->error1 (
5018 UTL_Error::EIDL_ILLEGAL_ADD,
5021 /* If we don't return here, we'll crash later.*/
5037 $$ = AST_Argument::dir_IN;
5041 $$ = AST_Argument::dir_OUT;
5045 $$ = AST_Argument::dir_INOUT;
5052 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen);
5056 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen);
5058 at_least_one_scoped_name
5061 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen);
5073 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSeen);
5077 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSqSeen);
5079 at_least_one_scoped_name
5082 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseQsSeen);
5094 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSeen);
5098 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSqSeen);
5100 at_least_one_scoped_name
5103 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseQsSeen);
5115 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen);
5119 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen);
5121 at_least_one_string_literal
5124 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
5133 at_least_one_string_literal :
5134 IDL_STRING_LITERAL string_literals
5136 ACE_NEW_RETURN ($<slval>$,
5147 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
5151 UTL_StrList *sl = 0;
5174 : IDL_TYPEID scoped_name IDL_STRING_LITERAL
5176 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5178 s->lookup_by_name ($2);
5182 idl_global->err ()->lookup_error ($2);
5186 d->set_id_with_typeid (
5204 : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL
5206 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5207 AST_Decl *d = ScopeAsDecl (s);
5209 // If we are in a module, we want to avoid a lookup unless the
5210 // typeprefix is to be applied to some other scope, since we
5211 // might get a previous opening of the module, and the prefix
5212 // of this opening would never get checked or set.
5213 if (d->name ()->compare ($2) != 0)
5216 s->lookup_by_name ($2);
5221 idl_global->err ()->lookup_error ($2);
5225 d->set_prefix_with_typeprefix (
5244 | component_forward_decl
5247 component_forward_decl :
5251 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5252 UTL_ScopedName n ($2,
5254 AST_ComponentFwd *f = 0;
5255 idl_global->set_parse_state (
5256 IDL_GlobalData::PS_ComponentForwardSeen
5260 * Create a node representing a forward declaration of a
5261 * component. Store it in the enclosing scope.
5265 f = idl_global->gen ()->create_component_fwd (&n);
5266 (void) s->fe_add_component_fwd (f);
5280 FE_ComponentHeader *&component_header = $1;
5281 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
5282 AST_Component *component = 0;
5285 * Make a new component node and add it to the enclosing scope.
5287 if (scope && component_header)
5289 component = idl_global->gen ()->create_component (
5290 component_header->name (),
5291 component_header->base_component (),
5292 component_header->supports (),
5293 component_header->n_supports (),
5294 component_header->supports_flat (),
5295 component_header->n_supports_flat ());
5296 AST_Interface *component_as_interface =
5297 dynamic_cast<AST_Interface *> (component);
5298 AST_Interface::fwd_redefinition_helper (
5299 component_as_interface, scope);
5300 component = dynamic_cast<AST_Component *> (component_as_interface);
5303 * Add the component to its definition scope.
5305 scope->fe_add_component (component);
5307 // This FE_ComponentHeader class isn't destroyed with the AST.
5308 component_header->destroy ();
5309 delete component_header;
5310 component_header = 0;
5314 * Push it on the scope stack.
5316 idl_global->scopes ().push (component);
5318 $<dcval>$ = component;
5322 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentSqSeen);
5326 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentBodySeen);
5330 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentQsSeen);
5333 * Done with this component - pop it off the scopes stack.
5335 idl_global->scopes ().pop ();
5345 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentIDSeen);
5347 component_inheritance_spec
5349 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
5353 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
5356 * Create an AST representation of the information in the header
5357 * part of a component.
5359 UTL_ScopedName *n = 0;
5364 ACE_NEW_RETURN ($<chval>$,
5365 FE_ComponentHeader (n,
5387 component_inheritance_spec
5390 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
5403 : component_exports at_least_one_annotation component_export
5405 AST_Annotation_Appls *&annotations = $2;
5406 AST_Decl *&node = $3;
5409 node->annotation_appls (*annotations);
5413 idl_global->err ()-> unsupported_warning (
5414 "Annotating this is not supported");
5418 | component_exports component_export
5425 idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
5429 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5434 idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
5438 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5443 idl_global->set_parse_state (IDL_GlobalData::PS_EmitsDeclSeen);
5447 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5452 idl_global->set_parse_state (IDL_GlobalData::PS_PublishesDeclSeen);
5456 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5461 idl_global->set_parse_state (IDL_GlobalData::PS_ConsumesDeclSeen);
5465 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5470 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
5474 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5477 | extended_port_decl
5479 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
5483 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5488 provides_decl : IDL_PROVIDES interface_type id
5490 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5491 bool so_far_so_good = true;
5492 AST_Decl::NodeType nt = AST_Decl::NT_type;
5493 AST_Param_Holder *ph = 0;
5496 s->lookup_by_name ($2, true, false);
5500 idl_global->err ()->lookup_error ($2);
5501 so_far_so_good = false;
5506 nt = d->node_type ();
5510 case AST_Decl::NT_interface:
5512 case AST_Decl::NT_param_holder:
5513 ph = dynamic_cast<AST_Param_Holder*> (d);
5514 nt = ph->info ()->type_;
5516 if (nt != AST_Decl::NT_type
5517 && nt != AST_Decl::NT_interface)
5519 idl_global->err ()->mismatched_template_param (
5520 ph->info ()->name_.c_str ());
5522 so_far_so_good = false;
5526 case AST_Decl::NT_pre_defined:
5527 // Nothing else but CORBA::Object can have
5530 ACE_OS::strcmp (d->local_name ()->get_string (),
5533 // Simple provides port must use IDL interface
5534 // or CORBA::Object.
5537 idl_global->err ()->interface_expected (d);
5538 so_far_so_good = false;
5543 idl_global->err ()->interface_expected (d);
5544 so_far_so_good = false;
5549 AST_Provides *provides = 0;
5553 AST_Type *port_interface_type =
5554 dynamic_cast<AST_Type*> (d);
5556 // Strip off _cxx_, if any, for port name.
5557 FE_Utils::original_local_name ($3);
5559 UTL_ScopedName sn ($3,
5562 provides = idl_global->gen ()->create_provides (
5563 &sn, port_interface_type);
5565 (void) s->fe_add_provides (provides);
5576 $$ = dynamic_cast<AST_Decl *> (provides);
5583 // Lookups and checking are done where the 'interface_type'
5584 // token is used, in 'provides_decl' and 'uses_decl'.
5589 Identifier *corba_id = 0;
5591 ACE_NEW_RETURN (corba_id,
5592 Identifier ("Object"),
5595 UTL_IdList *conc_name = 0;
5596 ACE_NEW_RETURN (conc_name,
5597 UTL_IdList (corba_id,
5601 ACE_NEW_RETURN (corba_id,
5602 Identifier ("CORBA"),
5605 ACE_NEW_RETURN ($<idlist>$,
5606 UTL_IdList (corba_id,
5612 uses_decl : uses_opt_multiple interface_type id
5614 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5615 bool so_far_so_good = true;
5616 AST_Decl::NodeType nt = AST_Decl::NT_type;
5617 AST_Param_Holder *ph = 0;
5620 s->lookup_by_name ($2, true, false);
5624 idl_global->err ()->lookup_error ($2);
5625 so_far_so_good = false;
5630 nt = d->node_type ();
5634 case AST_Decl::NT_interface:
5636 case AST_Decl::NT_param_holder:
5637 ph = dynamic_cast<AST_Param_Holder*> (d);
5638 nt = ph->info ()->type_;
5640 if (nt != AST_Decl::NT_type
5641 && nt != AST_Decl::NT_interface)
5643 idl_global->err ()->mismatched_template_param (
5644 ph->info ()->name_.c_str ());
5646 so_far_so_good = false;
5650 case AST_Decl::NT_pre_defined:
5651 // Nothing else but CORBA::Object can have
5654 ACE_OS::strcmp (d->local_name ()->get_string (),
5657 // Simple provides port must use IDL interface
5658 // or CORBA::Object.
5661 idl_global->err ()->interface_expected (d);
5662 so_far_so_good = false;
5667 idl_global->err ()->interface_expected (d);
5668 so_far_so_good = false;
5677 AST_Type *port_interface_type =
5678 dynamic_cast<AST_Type*> (d);
5680 // Strip off _cxx_, if any, for port name.
5681 FE_Utils::original_local_name ($3);
5683 UTL_ScopedName sn ($3,
5686 uses = idl_global->gen ()->create_uses (
5687 &sn, port_interface_type, $1);
5688 s->fe_add_uses (uses);
5691 dynamic_cast<AST_Component*> (s);
5694 && uses->is_multiple ()
5695 && !idl_global->using_ifr_backend ()
5696 && !idl_global->ignore_idl3 ()
5697 && nt != AST_Decl::NT_param_holder)
5699 // These datatypes must be created in the
5700 // front end so they can be looked up
5701 // when compiling the generated executor IDL.
5702 FE_Utils::create_uses_multiple_stuff (c, uses);
5719 : IDL_USES opt_multiple
5721 // We use this extra rule here to use in both uses_decl and
5722 // extended_uses_decl, so the LALR(1) parser can avoid conflicts.
5739 : IDL_EMITS scoped_name id
5741 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5742 bool so_far_so_good = true;
5743 AST_Decl::NodeType nt = AST_Decl::NT_type;
5744 AST_Param_Holder *ph = 0;
5747 s->lookup_by_name ($2, true, false);
5751 idl_global->err ()->lookup_error ($2);
5752 so_far_so_good = false;
5756 nt = d->node_type ();
5760 case AST_Decl::NT_eventtype:
5762 case AST_Decl::NT_param_holder:
5763 ph = dynamic_cast<AST_Param_Holder*> (d);
5764 nt = ph->info ()->type_;
5766 if (nt != AST_Decl::NT_type
5767 && nt != AST_Decl::NT_eventtype)
5769 idl_global->err ()->mismatched_template_param (
5770 ph->info ()->name_.c_str ());
5772 so_far_so_good = false;
5777 idl_global->err ()->eventtype_expected (d);
5778 so_far_so_good = false;
5787 AST_Type *event_type =
5788 dynamic_cast<AST_Type*> (d);
5790 // Strip off _cxx_, if any, for port name.
5791 FE_Utils::original_local_name ($3);
5793 UTL_ScopedName sn ($3,
5796 e = idl_global->gen ()->create_emits (&sn, event_type);
5798 (void) s->fe_add_emits (e);
5814 : IDL_PUBLISHES scoped_name id
5816 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5817 bool so_far_so_good = true;
5818 AST_Decl::NodeType nt = AST_Decl::NT_type;
5819 AST_Param_Holder *ph = 0;
5822 s->lookup_by_name ($2, true, false);
5826 idl_global->err ()->lookup_error ($2);
5827 so_far_so_good = false;
5831 nt = d->node_type ();
5835 case AST_Decl::NT_eventtype:
5837 case AST_Decl::NT_param_holder:
5838 ph = dynamic_cast<AST_Param_Holder*> (d);
5839 nt = ph->info ()->type_;
5841 if (nt != AST_Decl::NT_type
5842 && nt != AST_Decl::NT_eventtype)
5844 idl_global->err ()->mismatched_template_param (
5845 ph->info ()->name_.c_str ());
5847 so_far_so_good = false;
5852 idl_global->err ()->eventtype_expected (d);
5853 so_far_so_good = false;
5858 AST_Publishes *p = 0;
5862 AST_Type *event_type =
5863 dynamic_cast<AST_Type*> (d);
5865 // Strip off _cxx_, if any, for port name.
5866 FE_Utils::original_local_name ($3);
5868 UTL_ScopedName sn ($3, 0);
5869 p = idl_global->gen ()->create_publishes (&sn, event_type);
5870 s->fe_add_publishes (p);
5886 : IDL_CONSUMES scoped_name id
5888 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5889 bool so_far_so_good = true;
5890 AST_Decl::NodeType nt = AST_Decl::NT_type;
5891 AST_Param_Holder *ph = 0;
5894 s->lookup_by_name ($2, true, false);
5898 idl_global->err ()->lookup_error ($2);
5899 so_far_so_good = false;
5903 nt = d->node_type ();
5907 case AST_Decl::NT_eventtype:
5909 case AST_Decl::NT_param_holder:
5910 ph = dynamic_cast<AST_Param_Holder*> (d);
5911 nt = ph->info ()->type_;
5913 if (nt != AST_Decl::NT_type
5914 && nt != AST_Decl::NT_eventtype)
5916 idl_global->err ()->mismatched_template_param (
5917 ph->info ()->name_.c_str ());
5919 so_far_so_good = false;
5924 idl_global->err ()->eventtype_expected (d);
5925 so_far_so_good = false;
5930 AST_Consumes *c = 0;
5934 AST_Type *event_type =
5935 dynamic_cast<AST_Type*> (d);
5937 // Strip off _cxx_, if any, for port name.
5938 FE_Utils::original_local_name ($3);
5940 UTL_ScopedName sn ($3,
5943 c = idl_global->gen ()->create_consumes (&sn, event_type);
5945 (void) s->fe_add_consumes (c);
5963 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5967 * Make a new home node and add it to the enclosing scope.
5969 if (s != 0 && $1 != 0)
5972 idl_global->gen ()->create_home (
5975 $1->managed_component (),
5979 $1->supports_flat (),
5980 $1->n_supports_flat ()
5983 * Add the home to its definition scope.
5985 (void) s->fe_add_home (h);
5987 // This FE_HomeHeader class isn't destroyed with the AST.
5994 * Push it on the scope stack.
5996 idl_global->scopes ().push (h);
6001 * Done with this component - pop it off the scopes stack.
6003 idl_global->scopes ().pop ();
6012 idl_global->set_parse_state (IDL_GlobalData::PS_HomeSeen);
6016 idl_global->set_parse_state (IDL_GlobalData::PS_HomeIDSeen);
6018 home_inheritance_spec
6020 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
6024 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
6028 idl_global->set_parse_state (IDL_GlobalData::PS_ManagesSeen);
6032 idl_global->set_parse_state (IDL_GlobalData::PS_ManagesIDSeen);
6036 idl_global->set_parse_state (IDL_GlobalData::PS_PrimaryKeySpecSeen);
6039 * Create an AST representation of the information in the header
6040 * part of a component home.
6042 UTL_ScopedName *n = 0;
6044 UTL_ScopedName ($3, 0),
6047 ACE_NEW_RETURN ($<hhval>$,
6082 home_inheritance_spec
6085 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
6112 idl_global->set_parse_state (IDL_GlobalData::PS_HomeSqSeen);
6116 idl_global->set_parse_state (IDL_GlobalData::PS_HomeBodySeen);
6120 idl_global->set_parse_state (IDL_GlobalData::PS_HomeQsSeen);
6125 : home_exports home_export
6133 idl_global->set_parse_state (IDL_GlobalData::PS_FactoryDeclSeen);
6137 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
6141 idl_global->set_parse_state (IDL_GlobalData::PS_FinderDeclSeen);
6145 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
6153 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6154 UTL_ScopedName n ($2,
6156 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
6159 * Create a node representing a factory operation
6160 * and add it to the enclosing scope.
6162 AST_Factory *f = idl_global->gen ()->create_factory (&n);
6163 (void) s->fe_add_factory (f);
6170 * Push the factory scope onto the scopes stack.
6172 idl_global->scopes ().push (f);
6176 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
6180 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6181 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
6184 * Add exceptions and context to the factory.
6188 (void) s->fe_add_exceptions ($6);
6192 * Done with this factory. Pop its scope from the scopes stack.
6194 idl_global->scopes ().pop ();
6202 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6203 UTL_ScopedName n ($2,
6206 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
6209 * Create a node representing a home finder
6210 * and add it to the enclosing scope.
6213 idl_global->gen ()->create_finder (&n);
6215 (void) s->fe_add_finder (f);
6223 * Push the operation scope onto the scopes stack.
6225 idl_global->scopes ().push (f);
6229 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
6233 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6234 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
6237 * Add exceptions and context to the finder.
6241 (void) s->fe_add_exceptions ($6);
6245 * Done with this operation. Pop its scope from the scopes stack.
6247 idl_global->scopes ().pop ();
6254 | event_forward_decl
6258 : event_abs_forward_decl
6259 | event_concrete_forward_decl
6262 event_concrete_forward_decl :
6266 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6267 UTL_ScopedName n ($2,
6269 AST_EventTypeFwd *f = 0;
6270 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
6273 * Create a node representing a forward declaration of an
6274 * eventtype. Store it in the enclosing scope
6278 f = idl_global->gen ()->create_eventtype_fwd (&n,
6280 (void) s->fe_add_valuetype_fwd (f);
6291 event_abs_forward_decl :
6296 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6297 UTL_ScopedName n ($3,
6299 AST_EventTypeFwd *f = 0;
6300 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
6303 * Create a node representing a forward declaration of an
6304 * eventtype. Store it in the enclosing scope
6308 f = idl_global->gen ()->create_eventtype_fwd (&n,
6310 (void) s->fe_add_valuetype_fwd (f);
6323 event_rest_of_header
6325 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6326 AST_EventType *e = 0;
6327 AST_Interface *i = 0;
6329 if (s != 0 && $1 != 0)
6331 UTL_ScopedName sn ($1,
6334 idl_global->gen ()->create_eventtype (
6338 $2->inherits_concrete (),
6339 $2->inherits_flat (),
6340 $2->n_inherits_flat (),
6343 $2->supports_concrete (),
6348 i = dynamic_cast<AST_Interface*> (e);
6349 AST_Interface::fwd_redefinition_helper (i,
6352 * Add the eventetype to its definition scope
6354 e = dynamic_cast<AST_EventType*> (i);
6355 (void) s->fe_add_eventtype (e);
6359 * Push it on the scope stack.
6361 idl_global->scopes ().push (e);
6369 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
6373 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
6377 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
6380 * Done with this eventtype - pop it off the scopes stack.
6382 idl_global->scopes ().pop ();
6397 event_custom_header :
6402 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
6404 ACE_DEBUG ((LM_DEBUG,
6405 ACE_TEXT ("error in %C line %d\n"),
6406 idl_global->filename ()->get_string (),
6407 idl_global->lineno ()));
6408 ACE_DEBUG ((LM_DEBUG,
6409 ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
6410 ACE_TEXT (" custom yet\n")));
6415 event_plain_header :
6419 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
6425 event_rest_of_header :
6428 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
6432 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
6434 ACE_NEW_RETURN ($<vhval>$,
6440 ? $1->truncatable ()
6463 event_rest_of_header
6465 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
6466 Identifier *&event_id = $1;
6467 FE_OBVHeader *&event_header = $2;
6468 AST_EventType *eventtype = 0;
6470 if (scope && event_header)
6472 // We create the scoped name here instead of with the
6473 // FE_OBVHeader because there is a token for it only here.
6474 UTL_ScopedName sn (event_id, 0);
6475 eventtype = idl_global->gen ()->create_eventtype (
6477 event_header->inherits (),
6478 event_header->n_inherits (),
6479 event_header->inherits_concrete (),
6480 event_header->inherits_flat (),
6481 event_header->n_inherits_flat (),
6482 event_header->supports (),
6483 event_header->n_supports (),
6484 event_header->supports_concrete (),
6486 event_header->truncatable (),
6488 AST_Interface *eventtype_as_interface =
6489 dynamic_cast<AST_Interface *> (eventtype);
6490 AST_Interface::fwd_redefinition_helper (
6491 eventtype_as_interface, scope);
6492 eventtype = dynamic_cast<AST_EventType *> (eventtype_as_interface);
6495 * Add the eventetype to its definition scope
6497 scope->fe_add_eventtype (eventtype);
6499 // FE_OBVHeader is not automatically destroyed in the AST
6500 event_header->destroy ();
6501 delete event_header;
6508 * Push it on the scope stack.
6510 idl_global->scopes ().push (eventtype);
6512 $<dcval>$ = eventtype;
6516 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
6520 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
6524 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
6527 * Done with this eventtype - pop it off the scopes stack.
6529 idl_global->scopes ().pop ();
6536 : event_custom_header
6540 | event_plain_header
6546 formal_parameter_type
6549 $<ntval>$ = AST_Decl::NT_type;
6553 $<ntval>$ = AST_Decl::NT_struct;
6557 $<ntval>$ = AST_Decl::NT_union;
6561 $<ntval>$ = AST_Decl::NT_eventtype;
6565 $<ntval>$ = AST_Decl::NT_sequence;
6569 $<ntval>$ = AST_Decl::NT_interface;
6573 $<ntval>$ = AST_Decl::NT_valuetype;
6577 $<ntval>$ = AST_Decl::NT_enum;
6581 $<ntval>$ = AST_Decl::NT_except;
6583 | IDL_CONST const_type
6585 $<ntval>$ = AST_Decl::NT_const;
6586 t_param_const_type = $2;
6590 at_least_one_formal_parameter
6591 : formal_parameter formal_parameters
6595 ACE_NEW_RETURN ($2, FE_Utils::T_PARAMLIST_INFO, 1);
6598 $2->enqueue_head (*$1);
6602 // The param added above is always the last one parsed,
6603 // so we check for matches between sequence<T> & T here.
6604 ACE_CString bad_id =
6605 FE_Utils::check_for_seq_of_param (
6608 if (!bad_id.empty ())
6613 idl_global->err ()->mismatch_seq_of_param (bad_id.c_str ());
6622 : formal_parameters ',' formal_parameter
6626 ACE_NEW_RETURN ($1, FE_Utils::T_PARAMLIST_INFO, 1);
6629 $1->enqueue_tail (*$3);
6642 : formal_parameter_type IDENTIFIER
6646 FE_Utils::T_Param_Info,
6649 AST_Decl::NodeType nt = $1;
6653 ACE::strdelete ($2);
6656 if (nt == AST_Decl::NT_const)
6658 $$->const_type_ = t_param_const_type;
6659 $$->enum_const_type_decl_ =
6660 tao_enum_constant_decl;
6662 // Reset these values.
6663 t_param_const_type = AST_Expression::EV_none;
6664 tao_enum_constant_decl = 0;
6667 | IDL_SEQUENCE '<' IDENTIFIER '>' IDENTIFIER
6670 FE_Utils::T_Param_Info,
6673 $$->type_ = AST_Decl::NT_sequence;
6674 $$->seq_param_ref_ = $3;
6677 ACE::strdelete ($3);
6679 ACE::strdelete ($5);
6684 at_least_one_formal_parameter_name
6685 : formal_parameter_name formal_parameter_names
6687 ACE_NEW_RETURN ($$, UTL_StrList ($1, $2), 1);
6691 formal_parameter_names
6692 : formal_parameter_names ',' formal_parameter_name
6694 UTL_StrList *sl = 0;
6695 ACE_NEW_RETURN (sl, UTL_StrList ($3, 0), 1);
6713 formal_parameter_name
6717 UTL_String ($1, true),
6725 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeSeen);
6729 char *&id_value = $3;
6730 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeIDSeen);
6731 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
6733 Identifier id (id_value);
6734 ACE::strdelete (id_value);
6737 UTL_ScopedName scoped_name (&id, 0);
6738 AST_PortType *porttype = idl_global->gen ()->create_porttype (
6740 scope->fe_add_porttype (porttype);
6741 $<dcval>$ = porttype;
6743 // Push it on the scopes stack.
6744 idl_global->scopes ().push (porttype);
6748 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeSqSeen);
6751 * NOTE: IDL4.2 spec has a different definition of what can go inside a
6754 at_least_one_port_export
6756 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeBodySeen);
6760 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeQsSeen);
6762 // Done with this port type - pop it off the scopes stack.
6763 idl_global->scopes ().pop ();
6769 at_least_one_port_export
6770 : port_exports at_least_one_annotation port_export
6772 AST_Annotation_Appls *&annotations = $2;
6773 AST_Decl *&node = $3;
6776 node->annotation_appls (*annotations);
6780 idl_global->err ()-> unsupported_warning (
6781 "Annotating this is not supported");
6785 | port_exports port_export
6789 : at_least_one_port_export
6798 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
6807 : IDL_PORT scoped_name IDENTIFIER
6809 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
6810 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6812 s->lookup_by_name ($2);
6813 AST_PortType *pt = 0;
6814 bool so_far_so_good = true;
6818 idl_global->err ()->lookup_error ($2);
6819 so_far_so_good = false;
6823 pt = dynamic_cast<AST_PortType*> (d);
6827 idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
6829 so_far_so_good = false;
6833 AST_Extended_Port *ep = 0;
6838 ACE::strdelete ($3);
6841 UTL_ScopedName sn (&id, 0);
6842 ep = idl_global->gen ()->create_extended_port (&sn, pt);
6843 s->fe_add_extended_port (ep);
6845 // Create (in the AST) the struct(s) and sequence(s)
6846 // needed for multiplex uses ports, if any.
6847 for (UTL_ScopeActiveIterator i (pt, UTL_Scope::IK_decls);
6853 AST_Uses *u = dynamic_cast<AST_Uses*> (d);
6855 if (u != 0 && u->is_multiple ())
6858 dynamic_cast<AST_Component*> (s);
6860 FE_Utils::create_uses_multiple_stuff (
6874 | IDL_MIRRORPORT scoped_name IDENTIFIER
6876 idl_global->set_parse_state (IDL_GlobalData::PS_MirrorPortDeclSeen);
6877 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6879 s->lookup_by_name ($2);
6880 AST_PortType *pt = 0;
6881 bool so_far_so_good = true;
6885 idl_global->err ()->lookup_error ($2);
6886 so_far_so_good = false;
6890 pt = dynamic_cast<AST_PortType*> (d);
6894 idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
6896 so_far_so_good = false;
6900 AST_Mirror_Port *mp = 0;
6905 ACE::strdelete ($3);
6908 UTL_ScopedName sn (&id, 0);
6909 mp = idl_global->gen ()->create_mirror_port (&sn, pt);
6910 s->fe_add_mirror_port (mp);
6921 at_least_one_actual_parameter
6922 : annotations_maybe actual_parameter actual_parameters
6927 FE_Utils::T_ARGLIST,
6932 $3->enqueue_head ($2);
6938 : actual_parameters ',' annotations_maybe actual_parameter
6943 FE_Utils::T_ARGLIST,
6948 $1->enqueue_tail ($4);
6960 // To avoid grammar conflicts with this LALR(1) parser,
6961 // we take advantage of the fact that an expression can
6962 // be a scoped name. At that lower level, we create an
6963 // expression containing the scoped name, and at a
6964 // higher lever, deduce that it's not supposed to be
6965 // a constant and look up the type to add to the template
6967 AST_Expression *ex = $1;
6968 UTL_ScopedName *sn = ex->n ();
6970 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6974 d = s->lookup_by_name (sn);
6978 idl_global->err ()->lookup_error (sn);
6983 AST_Decl::NodeType nt = d->node_type ();
6985 if (nt == AST_Decl::NT_enum_val)
6988 AST_Expression::EK_const);
6991 idl_global->gen ()->create_constant (
7005 AST_Expression::EK_const);
7008 idl_global->gen ()->create_constant (
7017 : connector_header connector_body
7026 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorSeen);
7028 annotations_maybe IDENTIFIER
7030 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorIDSeen);
7032 component_inheritance_spec
7034 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7035 AST_Connector *parent = 0;
7036 bool so_far_so_good = true;
7039 ACE::strdelete ($4);
7042 UTL_ScopedName sn (&id, 0);
7047 s->lookup_by_name ($6);
7051 idl_global->err ()->lookup_error ($6);
7052 so_far_so_good = false;
7056 dynamic_cast<AST_Connector*> (d);
7060 idl_global->err ()->error1 (
7061 UTL_Error::EIDL_CONNECTOR_EXPECTED,
7064 so_far_so_good = false;
7075 idl_global->gen ()->create_connector (&sn,
7078 (void) s->fe_add_connector (c);
7080 // Push it on the scopes stack.
7081 idl_global->scopes ().push (c);
7091 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorSqSeen);
7095 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorBodySeen);
7099 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorQsSeen);
7101 // Done with this connector - pop it off the scope stack.
7102 idl_global->scopes ().pop ();
7107 : connector_exports connector_export
7114 idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
7118 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7122 idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
7126 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7130 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
7134 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7136 | extended_port_decl
7138 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
7142 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7159 * Report an error situation discovered in a production
7162 tao_yyerror (const char *msg)
7164 ACE_ERROR ((LM_ERROR, "%C\n", msg));