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>
136 #include <fe_declarator.h>
137 #include <fe_interface_header.h>
138 #include <fe_obv_header.h>
139 #include <fe_component_header.h>
140 #include <fe_home_header.h>
141 #include <fe_utils.h>
143 void tao_yyerror (const char *);
144 int tao_yylex (void);
145 extern "C" int tao_yywrap (void);
147 extern char tao_yytext[];
148 extern int tao_yyleng;
150 AST_Enum *tao_enum_constant_decl = 0;
151 AST_String *tao_string_decl = 0;
152 AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none;
153 bool stack_based_lookup_for_primary_expr = false;
155 #define TAO_YYDEBUG_LEXER_TEXT (tao_yytext[tao_yyleng] = '\0', tao_yytext)
156 // Compile Optional Tracing Output for Parser, can be enabled with --bison-trace
161 * Declare the type of values in the grammar
165 AST_Decl *dcval; /* Decl value */
166 UTL_StrList *slval; /* String list */
167 UTL_NameList *nlval; /* Name list */
168 UTL_ExprList *elval; /* Expression list */
169 UTL_LabelList *llval; /* Label list */
170 UTL_DeclList *dlval; /* Declaration list */
171 FE_InterfaceHeader *ihval; /* Interface header */
172 FE_OBVHeader *vhval; /* Valuetype header */
173 FE_ComponentHeader *chval; /* Component header */
174 FE_HomeHeader *hhval; /* Home header */
175 AST_Expression *exval; /* Expression value */
176 AST_UnionLabel *ulval; /* Union label */
177 AST_Field *ffval; /* Field value */
178 AST_Field::Visibility vival; /* N/A, pub or priv */
179 AST_Expression::ExprType etval; /* Expression type */
180 AST_Argument::Direction dival; /* Argument direction */
181 AST_Operation::Flags ofval; /* Operation flags */
182 FE_Declarator *deval; /* Declarator value */
183 ACE_CDR::Boolean bval; /* Boolean value */
184 ACE_CDR::LongLong ival; /* Long Long value */
185 ACE_CDR::ULongLong uival; /* Unsigned long long */
186 ACE_CDR::Double dval; /* Double value */
187 ACE_CDR::Float fval; /* Float value */
188 ACE_CDR::Char cval; /* Char value */
189 ACE_CDR::WChar wcval; /* WChar value */
190 ACE_CDR::Fixed fixval; /* Fixed point value */
191 UTL_String *sval; /* String value */
192 char *wsval; /* WString value */
193 char *strval; /* char * value */
194 Identifier *idval; /* Identifier */
195 UTL_IdList *idlist; /* Identifier list */
196 AST_Decl::NodeType ntval; /* Node type value */
197 FE_Utils::T_Param_Info *pival; /* Template interface param */
198 FE_Utils::T_PARAMLIST_INFO *plval; /* List of template params */
199 FE_Utils::T_ARGLIST *alval; /* List of template args */
200 AST_Annotation_Appl *annotation_val;
201 AST_Annotation_Appls *annotations_val;
202 AST_Annotation_Appl::Param *annotation_param_val;
203 AST_Annotation_Appl::Params *annotation_params_val;
204 AST_Annotation_Decl *annotation_decl_val;
205 AST_Decls *decls_val;
206 Decl_Annotations_Pair *decl_annotations_pair_val;
207 Decl_Annotations_Pair_Pair* decl_annotations_pair_val_pair;
211 * Token types: These are returned by the lexer
214 %token <strval> IDENTIFIER
245 %token IDL_IDEMPOTENT
261 %token IDL_TRUNCATABLE
263 /* Component tokens */
273 %token IDL_PRIMARYKEY
278 %token IDL_TYPEPREFIX
281 /* Extended ports tokens */
284 %token IDL_MIRRORPORT
289 %token <ival> IDL_INTEGER_LITERAL
290 %token <uival> IDL_UINTEGER_LITERAL
291 %token <sval> IDL_STRING_LITERAL
292 %token <cval> IDL_CHARACTER_LITERAL
293 %token <dval> IDL_FLOATING_PT_LITERAL
294 %token <fixval> IDL_FIXED_PT_LITERAL
298 /* stdint like types defined in IDL4.2 7.4.13 */
308 %token <strval> IDL_SCOPE_DELIMITOR
309 %token IDL_LEFT_SHIFT
310 %token IDL_RIGHT_SHIFT
311 %token <wcval> IDL_WCHAR_LITERAL
312 %token <wsval> IDL_WSTRING_LITERAL
314 %token IDL_ANNOTATION_DECL
315 %token IDL_ANNOTATION_SYMBOL
323 * These are production names:
326 %type <dcval> type_spec simple_type_spec constructed_type_spec
327 %type <dcval> template_type_spec sequence_type_spec string_type_spec map_type_spec
328 %type <dcval> struct_type enum_type switch_type_spec union_type
329 %type <dcval> array_declarator op_type_spec wstring_type_spec
330 %type <dcval> param_type_spec type_dcl type_declarator actual_parameter
331 %type <dcval> fixed_type_spec
332 %type <dcval> definition fixed_definition module const_dcl struct_forward_type
333 %type <dcval> interface_def interface interface_forward
334 %type <dcval> export operation attribute attribute_readonly attribute_readwrite
335 %type <dcval> template_module template_module_inst annotation_dcl typeid_dcl
336 %type <dcval> typeprefix_dcl exception component home_decl
337 %type <dcval> event_decl event_abs_decl event_forward_decl
338 %type <dcval> event_abs_forward_decl event_concrete_forward_decl
339 %type <dcval> porttype_decl connector_decl value_def
340 %type <dcval> valuetype value_abs_decl value_forward_decl value_box_decl
341 %type <dcval> value_concrete_decl component_forward_decl component_decl
342 %type <dcval> init_decl provides_decl uses_decl port_export
343 %type <dcval> component_export emits_decl publishes_decl consumes_decl
344 %type <dcval> extended_port_decl
346 %type <idlist> scoped_name interface_type component_inheritance_spec
347 %type <idlist> home_inheritance_spec primary_key_spec module_header
348 %type <idlist> template_module_header
350 %type <slval> opt_context at_least_one_string_literal
351 %type <slval> string_literals formal_parameter_names
352 %type <slval> at_least_one_formal_parameter_name
354 %type <nlval> at_least_one_scoped_name scoped_names inheritance_spec
355 %type <nlval> opt_raises opt_getraises opt_setraises supports_spec
357 %type <elval> at_least_one_array_dim array_dims
359 %type <llval> at_least_one_case_label case_labels
361 %type <dlval> at_least_one_declarator declarators
362 %type <dlval> at_least_one_simple_declarator simple_declarators
364 %type <ihval> interface_header
366 %type <vhval> value_header event_rest_of_header
368 %type <chval> component_header
370 %type <hhval> home_header
372 %type <exval> expression const_expr or_expr xor_expr and_expr shift_expr
373 %type <exval> add_expr mult_expr unary_expr primary_expr literal
374 %type <exval> positive_int_expr array_dim annotation_member_default
376 %type <ulval> case_label
378 %type <ffval> element_spec
380 %type <etval> const_type integer_type char_type boolean_type
381 %type <etval> floating_pt_type fixed_type any_type signed_int
382 %type <etval> unsigned_int base_type_spec octet_type object_type
383 %type <etval> annotation_member_type
385 %type <dival> direction
387 %type <ofval> opt_op_attribute
389 %type <deval> declarator simple_declarator complex_declarator
391 %type <bval> opt_truncatable opt_multiple uses_opt_multiple
393 %type <idval> interface_decl value_decl union_decl struct_decl id
394 %type <idval> defining_id
395 %type <idval> event_header event_plain_header event_custom_header
396 %type <idval> event_abs_header
398 %type <ntval> formal_parameter_type
400 %type <pival> formal_parameter
401 %type <plval> formal_parameters at_least_one_formal_parameter
403 %type <sval> formal_parameter_name
405 %type <alval> actual_parameters at_least_one_actual_parameter
407 %type <annotations_val> at_least_one_annotation annotations_maybe
408 %type <annotation_val> annotation_appl
409 %type <annotation_params_val> annotation_appl_params_maybe annotation_appl_params
410 %type <annotation_params_val> named_annotation_appl_params more_named_annotation_appl_params
411 %type <annotation_param_val> named_annotation_appl_param
412 %type <decl_annotations_pair_val> seq_head
414 %type <decl_annotations_pair_val_pair> map_head
416 %type <decls_val> member_i state_member value_element
417 %type <vival> visibility
421 * Production starts here.
423 start : definitions ;
426 : at_least_one_definition
430 at_least_one_definition
432 * This is broken up into 2 rules to avoid a grammer ambiguity which
433 * manifests as bison complaining about shift/reduce conflicts.
435 : definitions at_least_one_annotation definition
437 AST_Annotation_Appls *&annotations = $2;
438 AST_Decl *&node = $3;
441 node->annotation_appls (*annotations);
445 idl_global->err ()-> unsupported_warning (
446 "Annotating this is not supported");
450 | definitions definition
455 | template_module ';'
456 | template_module_inst ';'
462 idl_global->set_parse_state (IDL_GlobalData::PS_AnnotationDeclSeen);
466 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
470 idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
474 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
478 idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
482 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
486 idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
490 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
494 idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
498 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
502 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
506 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
510 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
514 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
518 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
522 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
526 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
530 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
534 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
538 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
542 idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
546 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
550 idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
554 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
558 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeDeclSeen);
562 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
566 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorDeclSeen);
570 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
574 idl_global->err ()->syntax_error (idl_global->parse_state ());
578 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
587 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
598 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen);
600 // The module_header rule is common to template module, fixed
601 // module and instantiated template module. In the last
602 // case, a fully scoped name is allowed, but here we
603 // allow only an identifier (a scoped name of length
604 // 1). If not satisfied, we output a parse error with
605 // the appropriate message.
606 if ($1->length () != 1)
608 idl_global->err ()->syntax_error (
609 IDL_GlobalData::PS_ModuleIDSeen);
613 UTL_Scope *s = idl_global->scopes ().top_non_null ();
616 * Make a new module and add it to the enclosing scope
620 m = idl_global->gen ()->create_module (s, $1);
621 (void) s->fe_add_module (m);
629 * Push it on the stack
631 idl_global->scopes ().push (m);
637 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen);
639 at_least_one_definition
641 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen);
645 idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen);
647 * Finished with this module - pop it from the scope stack.
650 idl_global->scopes ().pop ();
655 template_module_header
658 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleIDSeen);
663 : template_module_header
665 // The module_header rule is common to template module, fixed
666 // module and instantiated template module. In the last
667 // case, a fully scoped name is allowed, but here we
668 // allow only an identifier (a scoped name of length
669 // 1). If not satisfied, we output a syntax error with
670 // the appropriate message.
671 if ($1->length () != 1)
673 idl_global->err ()->syntax_error (
674 IDL_GlobalData::PS_ModuleIDSeen);
677 at_least_one_formal_parameter
679 if (FE_Utils::duplicate_param_id ($3))
681 idl_global->err ()->duplicate_param_id (
689 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleParamsSeen);
691 AST_Template_Module *tm =
692 idl_global->gen ()->create_template_module ($1,
695 UTL_Scope *s = idl_global->scopes ().top_non_null ();
696 AST_Module *m = s->fe_add_module (tm);
698 // We've probably tried to reopen a template module,
699 // going further will cause a crash.
706 * Push it on the stack
708 idl_global->scopes ().push (tm);
710 // Contained items not part of an alias will get flag set.
711 idl_global->in_tmpl_mod_no_alias (true);
713 // Store these for reference as we parse the scope
714 // of the template module.
715 idl_global->current_params ($3);
719 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleSqSeen);
721 at_least_one_tpl_definition
723 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleBodySeen);
727 idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleQsSeen);
730 * Finished with this module - pop it from the scope stack.
732 idl_global->scopes ().pop ();
734 // Unset the flag, the no_alias version because any scope
735 // traversal triggered by an alias would have ended by now.
736 idl_global->in_tmpl_mod_no_alias (false);
738 // Clear the pointer so scoped name lookup will know
739 // that we are no longer in a template module scope.
740 idl_global->current_params (0);
746 at_least_one_tpl_definition
747 : tpl_definition tpl_definitions
751 : tpl_definitions tpl_definition
757 | template_module_ref ';'
761 : IDL_ALIAS scoped_name
763 idl_global->set_parse_state (
764 IDL_GlobalData::PS_ModuleRefSeen);
766 '<' at_least_one_formal_parameter_name '>'
768 idl_global->set_parse_state (
769 IDL_GlobalData::PS_ModuleRefParamsSeen);
773 idl_global->set_parse_state (
774 IDL_GlobalData::PS_ModuleRefIDSeen);
776 UTL_Scope *s = idl_global->scopes ().top_non_null ();
778 s->lookup_by_name ($2);
782 idl_global->err ()->lookup_error ($2);
786 AST_Template_Module *ref =
787 dynamic_cast<AST_Template_Module*> (d);
791 idl_global->err ()->template_module_expected (d);
796 ref->match_param_refs ($5,
801 // Error message is already output.
805 UTL_ScopedName sn ($8, 0);
807 AST_Template_Module_Ref *tmr =
808 idl_global->gen ()->create_template_module_ref (
813 (void) s->fe_add_template_module_ref (tmr);
820 // Save the current flag value to be restored below.
821 bool itmna_flag = idl_global->in_tmpl_mod_no_alias ();
822 idl_global->in_tmpl_mod_no_alias (false);
823 idl_global->in_tmpl_mod_alias (true);
825 ast_visitor_context ctx;
826 ctx.template_params (ref->template_params ());
827 ast_visitor_tmpl_module_ref v (&ctx);
829 // The implied IDL resulting from this reference is
830 // created here, in the template module scope. Upon
831 // instantiation of the enclosing template module, the
832 // visitor copies this implied IDL to the instantiated
833 // module scope. The extra copy is less than ideal, but
834 // otherwise we have ugly lookup issues when the
835 // referenced template module's contents are referenced
836 // using the aliased scoped name.
837 if (v.visit_template_module_ref (tmr) != 0)
839 ACE_ERROR ((LM_ERROR,
840 ACE_TEXT ("visit_template_module_ref")
841 ACE_TEXT (" failed\n")));
843 idl_global->set_err_count (idl_global->err_count () + 1);
846 idl_global->in_tmpl_mod_no_alias (itmna_flag);
847 idl_global->in_tmpl_mod_alias (false);
852 : template_module_header
854 idl_global->set_parse_state (
855 IDL_GlobalData::PS_InstModuleSeen);
857 at_least_one_actual_parameter '>'
859 idl_global->set_parse_state (
860 IDL_GlobalData::PS_InstModuleArgsSeen);
864 idl_global->set_parse_state (
865 IDL_GlobalData::PS_InstModuleIDSeen);
867 UTL_Scope *s = idl_global->scopes ().top_non_null ();
868 UTL_ScopedName *sn = $1;
869 AST_Template_Module *ref = 0;
870 AST_Decl *d = s->lookup_by_name (sn);
874 idl_global->err ()->lookup_error (sn);
879 ref = dynamic_cast<AST_Template_Module*> (d);
883 idl_global->err ()->template_module_expected (d);
893 if (! ref->match_arg_names ($3))
903 AST_Template_Module_Inst *tmi =
904 idl_global->gen ()->create_template_module_inst (
909 (void) s->fe_add_template_module_inst (tmi);
911 ast_visitor_context ctx;
912 ctx.template_args ($3);
913 ast_visitor_tmpl_module_inst v (&ctx);
915 if (v.visit_template_module_inst (tmi) != 0)
917 ACE_ERROR ((LM_ERROR,
918 ACE_TEXT ("visit_template_module_inst")
919 ACE_TEXT (" failed\n")));
921 idl_global->set_err_count (idl_global->err_count () + 1);
936 UTL_Scope *s = idl_global->scopes ().top_non_null ();
937 AST_Interface *i = 0;
939 FE_InterfaceHeader *header = $1;
943 * Make a new interface node and add it to its enclosing scope.
947 i = idl_global->gen ()->create_interface (
950 header->n_inherits (),
951 header->inherits_flat (),
952 header->n_inherits_flat (),
954 header->is_abstract ()
956 AST_Interface::fwd_redefinition_helper (i, s);
958 * Add the interface to its definition scope.
960 s->fe_add_interface (i);
962 // This FE_InterfaceHeader class isn't destroyed with the AST.
968 * Push it on the scope stack.
970 idl_global->scopes ().push (i);
974 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
978 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
982 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
984 $$ = dynamic_cast<AST_Decl *> (idl_global->scopes ().top_non_null ());
986 * Done with this interface - pop it off the scopes stack
988 idl_global->scopes ().pop ();
995 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen);
999 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen);
1005 interface_decl inheritance_spec
1007 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1009 if ($2 != 0 && $2->truncatable ())
1011 idl_global->err ()->syntax_error (
1012 IDL_GlobalData::PS_InheritColonSeen
1017 * Create an AST representation of the information in the header
1018 * part of an interface - this representation contains a computed
1019 * list of all interfaces which this interface inherits from,
1022 UTL_ScopedName *n = 0;
1024 UTL_ScopedName ($1, 0),
1027 FE_InterfaceHeader (n,
1042 IDL_LOCAL interface_decl inheritance_spec
1044 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1047 * Create an AST representation of the information in the header
1048 * part of an interface - this representation contains a computed
1049 * list of all interfaces which this interface inherits from,
1052 UTL_ScopedName *n = 0;
1054 UTL_ScopedName ($2, 0),
1057 FE_InterfaceHeader (n,
1072 IDL_ABSTRACT interface_decl inheritance_spec
1074 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1077 * Create an AST representation of the information in the header
1078 * part of an interface - this representation contains a computed
1079 * list of all interfaces which this interface inherits from,
1082 UTL_ScopedName *n = 0;
1084 UTL_ScopedName ($2, 0),
1087 FE_InterfaceHeader (n,
1104 : ':' opt_truncatable
1106 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
1108 at_least_one_scoped_name
1110 $4->truncatable ($2);
1122 | value_forward_decl
1127 : IDL_CUSTOM value_concrete_decl
1129 idl_global->err ()->unsupported_error ("custom is not supported");
1132 | value_concrete_decl
1135 value_concrete_decl :
1138 FE_OBVHeader *&valuetype_header = $1;
1139 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
1140 AST_ValueType *valuetype = 0;
1142 if (scope && valuetype_header)
1144 valuetype = idl_global->gen ()->create_valuetype (
1145 valuetype_header->name (),
1146 valuetype_header->inherits (),
1147 valuetype_header->n_inherits (),
1148 valuetype_header->inherits_concrete (),
1149 valuetype_header->inherits_flat (),
1150 valuetype_header->n_inherits_flat (),
1151 valuetype_header->supports (),
1152 valuetype_header->n_supports (),
1153 valuetype_header->supports_concrete (),
1155 valuetype_header->truncatable (),
1158 AST_Interface *valuetype_as_interface =
1159 dynamic_cast<AST_Interface *> (valuetype);
1160 AST_Interface::fwd_redefinition_helper (
1161 valuetype_as_interface, scope);
1162 valuetype = dynamic_cast<AST_ValueType *> (
1163 valuetype_as_interface);
1166 * Add the valuetype to its definition scope
1168 scope->fe_add_valuetype (valuetype);
1170 // FE_OBVHeader is not automatically destroyed in the AST
1171 valuetype_header->destroy ();
1172 delete valuetype_header;
1173 valuetype_header = 0;
1177 * Push it on the scope stack
1179 idl_global->scopes ().push (valuetype);
1181 $<dcval>$ = valuetype;
1185 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
1189 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
1193 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
1196 dynamic_cast<AST_ValueType*> (
1197 idl_global->scopes ().top_non_null ()
1200 if (vt != 0 && vt->will_have_factory ())
1202 idl_global->valuefactory_seen_ = true;
1206 * Done with this value type - pop it off the scopes stack
1208 idl_global->scopes ().pop ();
1218 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1219 AST_ValueType *v = 0;
1220 AST_Interface *i = 0;
1222 if (s != 0 && $2 != 0)
1225 idl_global->gen ()->create_valuetype (
1229 $2->inherits_concrete (),
1230 $2->inherits_flat (),
1231 $2->n_inherits_flat (),
1234 $2->supports_concrete (),
1239 i = dynamic_cast<AST_Interface*> (v);
1240 AST_Interface::fwd_redefinition_helper (i,
1243 * Add the valuetype to its definition scope
1245 v = dynamic_cast<AST_ValueType*> (i);
1246 (void) s->fe_add_valuetype (v);
1248 // FE_OBVHeader is not automatically destroyed in the AST
1255 * Push it on the scope stack.
1257 idl_global->scopes ().push (v);
1261 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
1265 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
1269 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
1272 * Done with this valuetype - pop it off the scopes stack.
1274 idl_global->scopes ().pop ();
1284 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
1288 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
1290 UTL_ScopedName *sn = 0;
1292 UTL_ScopedName ($1, 0),
1299 ? $2->truncatable ()
1322 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
1326 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
1344 at_least_one_scoped_name
1354 value_forward_decl :
1358 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1359 UTL_ScopedName n ($2,
1361 AST_ValueTypeFwd *f = 0;
1362 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
1365 * Create a node representing a forward declaration of an
1366 * valuetype. Store it in the enclosing scope
1370 f = idl_global->gen ()->create_valuetype_fwd (&n,
1372 (void) s->fe_add_valuetype_fwd (f);
1382 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1383 UTL_ScopedName n ($1,
1385 AST_ValueTypeFwd *f = 0;
1386 idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
1389 * Create a node representing a forward declaration of an
1390 * valuetype. Store it in the enclosing scope
1394 f = idl_global->gen ()->create_valuetype_fwd (&n,
1396 (void) s->fe_add_valuetype_fwd (f);
1408 : value_decl type_spec /* in this order %!?*/
1410 idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
1412 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1413 UTL_ScopedName n ($1,
1416 if (s != 0 && $2 != 0)
1419 * Get the type_spec associated with the valuebox
1423 = dynamic_cast<AST_Typedef*> ($2);
1427 tp = dynamic_cast<AST_Type*> ($2);
1431 tp = td->primitive_base_type ();
1436 // The <type_spec> given is a valid type
1437 idl_global->err ()->not_a_type ($2);
1441 AST_Decl::NodeType nt = tp->node_type ();
1443 if (nt == AST_Decl::NT_valuetype
1444 || nt == AST_Decl::NT_eventtype)
1446 // valuetype is not allowed as <type_spec>
1448 idl_global->err ()->error0 (
1449 UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
1455 * Add the valuebox to its definition scope
1458 idl_global->gen ()->create_valuebox (&n,
1460 (void) s->fe_add_valuebox (vb);
1474 : value_elements at_least_one_annotation value_element
1476 AST_Annotation_Appls *&annotations = $2;
1477 AST_Decls *&decls = $3;
1480 for (size_t i = 0; i < decls->size (); i++)
1482 (*decls)[i]->annotation_appls (*annotations);
1487 idl_global->err ()-> unsupported_warning (
1488 "Annotating this is not supported");
1493 | value_elements value_element
1504 AST_Decl *&node = $1;
1505 AST_Decls *value = 0;
1508 value = new AST_Decls;
1509 value->push_back (node);
1515 AST_Decl *&node = $1;
1516 AST_Decls *value = 0;
1519 value = new AST_Decls;
1520 value->push_back (node);
1522 $<decls_val>$ = value;
1533 $$ = AST_Field::vis_PUBLIC;
1537 $$ = AST_Field::vis_PRIVATE;
1542 : visibility member_i
1544 AST_Field::Visibility &visibility = $1;
1545 AST_Decls *&decls_ptr = $2;
1548 AST_Decls &decls = *decls_ptr;
1549 for (size_t i = 0; i < decls.size (); i++)
1551 AST_Field *field = dynamic_cast<AST_Field *> (decls[i]);
1554 field->visibility (visibility);
1563 : at_least_one_export
1568 : exports at_least_one_annotation export
1570 AST_Annotation_Appls *annotations = $2;
1574 d->annotation_appls (*annotations);
1578 idl_global->err ()-> unsupported_warning (
1579 "Annotating this is not supported");
1589 idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
1593 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1597 idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
1601 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1605 idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
1609 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1613 idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
1617 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1621 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
1625 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1629 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
1633 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1637 idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen);
1641 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1645 idl_global->err ()->syntax_error (idl_global->parse_state ());
1649 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
1655 at_least_one_scoped_name :
1656 scoped_name scoped_names
1658 ACE_NEW_RETURN ($<nlval>$,
1669 idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
1673 idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
1675 UTL_NameList *nl = 0;
1700 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1707 | IDL_SCOPE_DELIMITOR
1709 idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
1713 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1719 ACE::strdelete ($1);
1726 ACE_NEW_RETURN ($<idlist>$,
1734 idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
1736 // This cleans up all the non-global "::"s in scoped names.
1737 // If there is a global one, it gets put into the UTL_IdList,
1738 // so we clean it up in the case above.
1739 ACE::strdelete ($2);
1744 idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
1761 ACE::strdelete ($1);
1766 defining_id : IDENTIFIER
1768 /* defining_id is a defining identifier
1769 whereas id is usually a reference to a defining identifier */
1770 ACE_NEW_RETURN ($$, Identifier ($1), 1);
1771 ACE::strdelete ($1);
1779 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1780 UTL_ScopedName n ($1, 0);
1782 if (ACE_OS::strcmp ($1->get_string (),
1784 && !idl_global->in_main_file ())
1786 AST_PredefinedType *pdt =
1787 idl_global->gen ()->create_predefined_type (
1788 AST_PredefinedType::PT_pseudo,
1792 s->add_to_scope (pdt);
1801 AST_InterfaceFwd *f = 0;
1802 idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
1805 * Create a node representing a forward declaration of an
1806 * interface. Store it in the enclosing scope
1810 f = idl_global->gen ()->create_interface_fwd (&n,
1813 (void) s->fe_add_interface_fwd (f);
1821 IDL_LOCAL interface_decl
1823 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1824 UTL_ScopedName n ($2,
1826 AST_InterfaceFwd *f = 0;
1827 idl_global->set_parse_state (
1828 IDL_GlobalData::PS_InterfaceForwardSeen
1832 * Create a node representing a forward declaration of an
1833 * interface. Store it in the enclosing scope
1837 f = idl_global->gen ()->create_interface_fwd (&n,
1840 (void) s->fe_add_interface_fwd (f);
1848 IDL_ABSTRACT interface_decl
1850 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1851 UTL_ScopedName n ($2,
1853 AST_InterfaceFwd *f = 0;
1854 idl_global->set_parse_state (
1855 IDL_GlobalData::PS_InterfaceForwardSeen
1859 * Create a node representing a forward declaration of an
1860 * interface. Store it in the enclosing scope
1864 f = idl_global->gen ()->create_interface_fwd (&n,
1867 (void) s->fe_add_interface_fwd (f);
1874 $$ = dynamic_cast<AST_Decl *> (f);
1881 idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen);
1885 idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen);
1889 idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen);
1893 idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen);
1898 UTL_ScopedName n ($5, 0);
1900 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1901 AST_Constant *c = 0;
1902 idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen);
1905 * Create a node representing a constant declaration. Store
1906 * it in the enclosing scope.
1908 if ($9 != 0 && s != 0)
1910 AST_Param_Holder *param_holder = $9->param_holder ();
1912 AST_Expression::AST_ExprValue *result =
1913 $9->check_and_coerce ($3, tao_enum_constant_decl);
1914 tao_enum_constant_decl = 0;
1916 // If the expression is a template parameter place
1917 // holder, 'result' will be 0, but it's ok.
1918 if (result == 0 && param_holder == 0)
1920 idl_global->err ()->coercion_error ($9, $3);
1927 AST_Expression::ExprType et = $3;
1929 if (param_holder != 0
1930 && et != param_holder->info ()->const_type_)
1932 idl_global->err ()->mismatched_template_param (
1933 param_holder->info ()->name_.c_str ());
1937 c = idl_global->gen ()->create_constant ($3, $9, &n);
1938 (void) s->fe_add_constant (c);
1962 $$ = AST_Expression::EV_string;
1966 $$ = AST_Expression::EV_wstring;
1970 UTL_Scope *s = idl_global->scopes ().top_non_null ();
1971 AST_PredefinedType *c = 0;
1973 UTL_ScopedName *sn = $1;
1976 * If the constant's type is a scoped name, it must resolve
1977 * to a scalar constant type
1980 s->lookup_by_name (sn);
1982 if (s != 0 && d != 0)
1985 * Look through typedefs.
1987 while (d->node_type () == AST_Decl::NT_typedef)
1989 t = dynamic_cast<AST_Typedef*> (d);
1996 d = t->base_type ();
1999 if (d->node_type () == AST_Decl::NT_pre_defined)
2001 c = dynamic_cast<AST_PredefinedType*> (d);
2003 $$ = FE_Utils::PredefinedTypeToExprType (c->pt ());
2005 else if (d->node_type () == AST_Decl::NT_string)
2007 $$ = AST_Expression::EV_string;
2009 else if (d->node_type () == AST_Decl::NT_wstring)
2011 $$ = AST_Expression::EV_wstring;
2013 else if (d->node_type () == AST_Decl::NT_enum)
2015 $$ = AST_Expression::EV_enum;
2016 tao_enum_constant_decl =
2017 dynamic_cast<AST_Enum*> (d);
2021 idl_global->err ()->constant_expected (sn, d);
2026 idl_global->err ()->lookup_error (sn);
2036 expression : const_expr ;
2038 const_expr : or_expr ;
2041 | or_expr '|' xor_expr
2044 idl_global->gen ()->create_expr (
2045 AST_Expression::EC_or,
2054 | xor_expr '^' and_expr
2057 idl_global->gen ()->create_expr (
2058 AST_Expression::EC_xor,
2067 | and_expr '&' shift_expr
2070 idl_global->gen ()->create_expr (
2071 AST_Expression::EC_and,
2080 | shift_expr IDL_LEFT_SHIFT add_expr
2083 idl_global->gen ()->create_expr (
2084 AST_Expression::EC_left,
2089 | shift_expr IDL_RIGHT_SHIFT add_expr
2092 idl_global->gen ()->create_expr (
2093 AST_Expression::EC_right,
2102 | add_expr '+' mult_expr
2105 idl_global->gen ()->create_expr (
2106 AST_Expression::EC_add,
2111 | add_expr '-' mult_expr
2114 idl_global->gen ()->create_expr (
2115 AST_Expression::EC_minus,
2124 | mult_expr '*' unary_expr
2127 idl_global->gen ()->create_expr (
2128 AST_Expression::EC_mul,
2133 | mult_expr '/' unary_expr
2136 idl_global->gen ()->create_expr (
2137 AST_Expression::EC_div,
2142 | mult_expr '%' unary_expr
2145 idl_global->gen ()->create_expr (
2146 AST_Expression::EC_mod,
2158 idl_global->gen ()->create_expr (
2159 AST_Expression::EC_u_plus,
2167 idl_global->gen ()->create_expr (
2168 AST_Expression::EC_u_minus,
2176 idl_global->gen ()->create_expr (
2177 AST_Expression::EC_bit_neg,
2187 UTL_ScopedName *name = $1;
2190 * An expression which is a scoped name is not resolved now,
2191 * but only when it is evaluated (such as when it is assigned
2192 * as a constant value).
2194 AST_Expression *expr = 0;
2196 AST_Decl *node = stack_based_lookup_for_primary_expr ?
2197 idl_global->scopes ().lookup_by_name (name) :
2198 idl_global->scopes ().top_non_null ()->lookup_by_name (name);
2201 if (!idl_global->ignore_lookup_errors_)
2203 idl_global->err ()->lookup_error (name);
2207 else if (node->node_type () == AST_Decl::NT_const)
2210 * If the scoped name is an IDL constant, it
2211 * may be used in an array dim, a string
2212 * bound, or a sequence bound. If so, it
2213 * must be unsigned and > 0. We assign the
2214 * constant's value and type to the
2215 * expression created here so we can check
2218 AST_Constant *c = dynamic_cast<AST_Constant *> (node);
2219 expr = idl_global->gen ()->create_expr (
2220 c->constant_value (),
2225 // An AST_Expression owns the scoped name
2226 // passed in this constructor, so we copy it
2227 // and destroy it below no matter which case
2229 expr = idl_global->gen ()->create_expr (name->copy ());
2230 if (node->node_type () == AST_Decl::NT_enum_val)
2233 dynamic_cast<AST_EnumVal *> (node)->enum_parent ());
2243 | '(' const_expr ')'
2250 : IDL_INTEGER_LITERAL
2252 $$ = idl_global->gen ()->create_expr ($1);
2254 | IDL_UINTEGER_LITERAL
2257 idl_global->gen ()->create_expr ($1);
2259 | IDL_STRING_LITERAL
2261 $$ = idl_global->gen ()->create_expr ($1);
2266 | IDL_WSTRING_LITERAL
2268 char *wide_string = $1;
2269 $$ = idl_global->gen ()->create_expr (wide_string);
2270 ACE_OS::free (wide_string);
2273 | IDL_CHARACTER_LITERAL
2275 $$ = idl_global->gen ()->create_expr ($1);
2279 ACE_OutputCDR::from_wchar wc ($1);
2280 $$ = idl_global->gen ()->create_expr (wc);
2282 | IDL_FIXED_PT_LITERAL
2284 $$ = idl_global->gen ()->create_expr ($1);
2286 | IDL_FLOATING_PT_LITERAL
2288 $$ = idl_global->gen ()->create_expr ($1);
2292 $$ = idl_global->gen ()->create_expr (true);
2296 $$ = idl_global->gen ()->create_expr (false);
2303 int good_expression = 1;
2304 $1->evaluate (AST_Expression::EK_positive_int);
2305 AST_Expression::AST_ExprValue *ev = $1->ev ();
2308 * If const_expr is an enum value (AST_EnumVal inherits from
2309 * AST_Constant), the AST_ExprValue will probably not be set,
2310 * but there's no need to check anyway
2316 case AST_Expression::EV_ushort:
2317 if (ev->u.usval == 0)
2319 good_expression = 0;
2323 case AST_Expression::EV_ulong:
2324 if (ev->u.ulval == 0)
2326 good_expression = 0;
2330 case AST_Expression::EV_ulonglong:
2331 if (ev->u.ullval == 0)
2333 good_expression = 0;
2337 case AST_Expression::EV_octet:
2338 if (ev->u.oval == 0)
2340 good_expression = 0;
2344 case AST_Expression::EV_bool:
2345 if (ev->u.bval == 0)
2347 good_expression = 0;
2352 good_expression = 0;
2357 if (good_expression)
2363 idl_global->err ()->syntax_error (idl_global->parse_state ());
2369 : IDL_ANNOTATION_DECL defining_id '{'
2371 if (idl_global->idl_version_ < IDL_VERSION_4)
2372 idl_global->err ()->idl_version_error (
2373 "Annotations are not allowed in IDL versions before 4");
2375 Identifier *id = $2;
2376 UTL_ScopedName name (id, 0);
2377 AST_Annotation_Decl::escape_name (&name);
2378 AST_Annotation_Decl *annotation_decl = idl_global->gen ()->
2379 create_annotation_decl (&name);
2380 idl_global->scopes ().top_non_null ()->
2381 fe_add_annotation_decl (annotation_decl);
2382 idl_global->scopes ().push (annotation_decl);
2386 Identifier *id = $2;
2387 idl_global->scopes ().pop ();
2396 : annotation_body annotation_statement
2400 annotation_statement
2406 idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
2407 idl_global->in_typedef (true);
2412 annotation_member_type
2418 : annotation_member_type defining_id annotation_member_default ';'
2420 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
2421 UTL_Scope *root = idl_global->scopes ().bottom ();
2423 AST_Expression::ExprType type = $1;
2424 Identifier *name = $2;
2425 // Annotation member names can't clash with C++ keywords
2426 FE_Utils::original_local_name (name);
2427 UTL_ScopedName *scoped_name = new UTL_ScopedName (name, 0);
2428 AST_Expression *default_value = $3;
2430 AST_Decl * type_obj;
2433 case AST_Expression::EV_string:
2434 case AST_Expression::EV_wstring:
2435 type_obj = tao_string_decl;
2437 case AST_Expression::EV_enum:
2438 type_obj = tao_enum_constant_decl;
2441 type_obj = root->lookup_primitive_type (type);
2444 FE_Declarator *declarator = new FE_Declarator (
2445 scoped_name, FE_Declarator::FD_simple, 0);
2446 AST_Annotation_Member *member = idl_global->gen ()->
2447 create_annotation_member (
2448 type, declarator->compose (type_obj), declarator->name ());
2449 scope->fe_add_annotation_member (member);
2451 declarator->destroy ();
2456 // Check if types are compatible, else report error
2457 AST_Expression::AST_ExprValue *result =
2458 default_value->check_and_coerce (type, tao_enum_constant_decl);
2459 tao_enum_constant_decl = 0;
2462 member->value (default_value);
2466 idl_global->err ()->coercion_error (default_value, type);
2473 annotation_member_default
2474 : IDL_DEFAULT const_expr
2484 at_least_one_annotation
2485 : annotations_maybe annotation_appl
2487 AST_Annotation_Appls *annotations = $1;
2488 AST_Annotation_Appl *annotation = $2;
2491 annotations->add (annotation);
2498 : annotations_maybe annotation_appl
2500 AST_Annotation_Appls *annotations = $1;
2501 AST_Annotation_Appl *annotation = $2;
2504 annotations->add (annotation);
2510 $$ = new AST_Annotation_Appls ();
2515 : IDL_ANNOTATION_SYMBOL scoped_name
2517 if (idl_global->idl_version_ < IDL_VERSION_4)
2518 idl_global->err ()->idl_version_error (
2519 "Annotations are not allowed in IDL versions before 4");
2521 AST_Annotation_Decl *decl = 0;
2522 UTL_ScopedName *name = $2;
2523 AST_Annotation_Decl::escape_name (name);
2525 // Check for Matching Annotation Declaration
2526 AST_Decl *d = idl_global->scopes ().top_non_null ()->
2527 lookup_by_name (name);
2530 decl = dynamic_cast<AST_Annotation_Decl*> (d);
2533 idl_global->scopes ().push (decl);
2538 Identifier &id = *name->last_component ();
2539 switch (idl_global->unknown_annotations_)
2542 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_WARN_ONCE:
2543 if (idl_global->unknown_annotations_seen_.insert (id) == 1)
2547 idl_global->err ()->lookup_warning (name);
2549 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_WARN_ALL:
2550 idl_global->err ()->lookup_warning (name);
2552 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_ERROR:
2553 idl_global->err ()->lookup_error (name);
2555 case IDL_GlobalData::UNKNOWN_ANNOTATIONS_IGNORE:
2560 * Ignore lookup errors for parameter values that might depend on
2561 * constants or enums from the missing annotation declaration.
2563 idl_global->ignore_lookup_errors_ = true;
2566 stack_based_lookup_for_primary_expr = true;
2568 $<annotation_decl_val>$ = decl;
2570 annotation_appl_params_maybe
2572 idl_global->ignore_lookup_errors_ = false;
2573 stack_based_lookup_for_primary_expr = false;
2574 AST_Annotation_Appl *appl = 0;
2575 UTL_ScopedName *name = $2;
2576 AST_Annotation_Decl *decl = $<annotation_decl_val>3;
2577 AST_Annotation_Appl::Params *params = $4;
2581 appl = idl_global->gen ()->create_annotation_appl (name, params);
2582 appl->apply_from (decl);
2583 idl_global->scopes ().pop ();
2587 AST_Annotation_Appl::delete_params (params);
2600 annotation_appl_params_maybe
2601 : '(' annotation_appl_params ')'
2611 annotation_appl_params
2614 AST_Annotation_Appl::Params *params = new AST_Annotation_Appl::Params;
2615 AST_Annotation_Appl::Param *param = new AST_Annotation_Appl::Param;
2618 params->push (param);
2621 | named_annotation_appl_params
2631 named_annotation_appl_params
2632 : named_annotation_appl_param more_named_annotation_appl_params
2634 AST_Annotation_Appl::Params *params = $2;
2639 more_named_annotation_appl_params
2640 : ',' named_annotation_appl_param more_named_annotation_appl_params
2642 AST_Annotation_Appl::Params *params = $3;
2648 $$ = new AST_Annotation_Appl::Params;
2652 named_annotation_appl_param
2655 AST_Annotation_Appl::Param *param = new AST_Annotation_Appl::Param;
2657 // Annotation Member Names Can't Clash with C++ keywords
2658 FE_Utils::original_local_name (param->id);
2667 idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
2668 idl_global->in_typedef (true);
2686 | IDL_NATIVE simple_declarator
2688 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2689 AST_Native *node = 0;
2690 idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen);
2693 * Create a node representing a Native and add it to its
2699 idl_global->gen ()->create_native (
2703 * Add it to its defining scope
2705 (void) s->fe_add_native (node);
2714 | constructed_forward_type_spec
2723 idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen);
2725 at_least_one_declarator
2727 AST_Decl *type_spec = $1;
2728 UTL_DeclList *decls = $3;
2730 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2731 FE_Declarator *d = 0;
2733 unsigned long index = 0UL;
2734 idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen);
2737 * Create a list of type renamings. Add them to the
2740 if (s && type_spec && decls)
2742 for (UTL_DecllistActiveIterator l (decls); !l.is_done (); l.next ())
2750 AST_Type *tp = d->compose (type_spec);
2756 if (AST_Decl::NT_except == tp->node_type ())
2758 idl_global->err ()->not_a_type (tp);
2762 t = idl_global->gen ()->create_typedef (tp,
2767 // If the base type is a sequence or array, the typedef
2768 // constructor sets owns_base_type_ to true. But if
2769 // there is a comma-separated list of such typedefs,
2770 // the base type can be destroyed only once. In all
2771 // other cases, the line below has no effect.
2774 t->owns_base_type (false);
2777 (void) s->fe_add_typedef (t);
2778 idl_global->in_typedef (false);
2781 // This FE_Declarator class isn't destroyed with the AST.
2793 | constructed_type_spec
2800 idl_global->scopes ().bottom ()->lookup_primitive_type (
2804 | template_type_spec
2807 UTL_Scope *s = idl_global->scopes ().top_non_null ();
2813 s->lookup_by_name ($1);
2818 idl_global->err ()->lookup_error ($1);
2822 d->last_referenced_as ($1);
2842 : sequence_type_spec
2849 constructed_type_spec
2855 constructed_forward_type_spec
2856 : struct_forward_type
2857 | union_forward_type
2860 at_least_one_declarator :
2861 declarator declarators
2874 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
2878 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
2880 UTL_DeclList *dl = 0;
2904 | complex_declarator
2907 at_least_one_simple_declarator :
2908 simple_declarator simple_declarators
2910 ACE_NEW_RETURN ($<dlval>$,
2918 : simple_declarators
2921 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
2925 idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
2927 UTL_DeclList *dl = 0;
2952 UTL_ScopedName *sn = 0;
2957 ACE_NEW_RETURN ($<deval>$,
2959 FE_Declarator::FD_simple,
2965 complex_declarator :
2968 UTL_ScopedName *sn = 0;
2971 $1->local_name ()->copy (),
2975 ACE_NEW_RETURN ($<deval>$,
2977 FE_Declarator::FD_complex,
2991 $$ = AST_Expression::EV_long;
2995 $$ = AST_Expression::EV_longlong;
2999 $$ = AST_Expression::EV_short;
3003 $$ = AST_Expression::EV_int8;
3007 $$ = AST_Expression::EV_short;
3011 $$ = AST_Expression::EV_long;
3015 $$ = AST_Expression::EV_longlong;
3020 : IDL_UNSIGNED IDL_LONG
3022 $$ = AST_Expression::EV_ulong;
3024 | IDL_UNSIGNED IDL_LONG IDL_LONG
3026 $$ = AST_Expression::EV_ulonglong;
3028 | IDL_UNSIGNED IDL_SHORT
3030 $$ = AST_Expression::EV_ushort;
3034 $$ = AST_Expression::EV_uint8;
3038 $$ = AST_Expression::EV_ushort;
3042 $$ = AST_Expression::EV_ulong;
3046 $$ = AST_Expression::EV_ulonglong;
3053 $$ = AST_Expression::EV_double;
3057 $$ = AST_Expression::EV_float;
3059 | IDL_LONG IDL_DOUBLE
3061 $$ = AST_Expression::EV_longdouble;
3068 $$ = AST_Expression::EV_fixed;
3075 $$ = AST_Expression::EV_char;
3079 $$ = AST_Expression::EV_wchar;
3086 $$ = AST_Expression::EV_octet;
3093 $$ = AST_Expression::EV_bool;
3100 $$ = AST_Expression::EV_any;
3107 $$ = AST_Expression::EV_object;
3114 idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen);
3118 idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
3127 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3128 UTL_ScopedName n ($1, 0);
3129 AST_Structure *d = 0;
3132 * Create a node representing a struct declaration. Add it
3133 * to the enclosing scope
3138 idl_global->gen ()->create_structure (
3143 AST_Structure::fwd_redefinition_helper (d, s);
3144 (void) s->fe_add_structure (d);
3148 * Push the scope of the struct on the scopes stack.
3150 idl_global->scopes ().push (d);
3158 idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen);
3163 * Done with this struct. Pop its scope off the scopes stack.
3165 $$ = dynamic_cast<AST_Structure*> (
3166 idl_global->scopes ().top_non_null ()
3168 idl_global->scopes ().pop ();
3175 if (idl_global->idl_version_ < IDL_VERSION_4)
3176 idl_global->err ()->idl_version_error (
3177 "Empty structs are not allowed in IDL versions before 4");
3179 idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
3181 | struct_body_with_members
3184 struct_body_with_members
3187 idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen);
3191 idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
3201 : annotations_maybe member_i
3203 AST_Annotation_Appls *annotations = $1;
3204 AST_Decls *members = $2;
3205 if (annotations && members)
3207 for (size_t i = 0; i < members->size (); i++)
3209 (*members)[i]->annotation_appls (*annotations);
3220 idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen);
3222 at_least_one_declarator
3224 idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen);
3228 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3229 FE_Declarator *d = 0;
3231 idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted);
3232 AST_Decls *members = 0;
3235 * Check for illegal recursive use of type.
3238 && AST_illegal_recursive_type ($1))
3240 idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
3244 * Create a node representing a struct or exception member
3245 * Add it to the enclosing scope.
3247 else if (s && $1 && $3)
3249 members = new AST_Decls;
3250 for (UTL_DecllistActiveIterator l ($3);
3261 AST_Type *tp = d->compose ($1);
3268 f = idl_global->gen ()->create_field (tp, d->name ());
3269 members->push_back (f);
3270 (void) s->fe_add_field (f);
3282 idl_global->err ()->syntax_error (idl_global->parse_state ());
3286 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
3294 idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen);
3298 idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen);
3304 : union_decl IDL_SWITCH
3306 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen);
3310 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3311 UTL_ScopedName n ($1, 0);
3313 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen);
3316 * Create a node representing an empty union. Add it to its enclosing
3321 u = idl_global->gen ()->create_union (0,
3326 AST_Structure *st = dynamic_cast<AST_Structure*> (u);
3327 AST_Structure::fwd_redefinition_helper (st, s);
3328 u = dynamic_cast<AST_Union*> (st);
3329 (void) s->fe_add_union (u);
3333 * Push the scope of the union on the scopes stack
3335 idl_global->scopes ().push (u);
3338 * Don't delete $1 yet; we'll need it a bit later.
3341 annotations_maybe switch_type_spec
3343 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen);
3348 * The top of the scopes must be an empty union we added after we
3349 * encountered 'union <id> switch ('. Now we are ready to add a
3350 * correct one. Temporarily remove the top so that we setup the
3351 * correct union in a right scope.
3353 UTL_Scope *top = idl_global->scopes ().top_non_null ();
3354 idl_global->scopes ().pop ();
3355 AST_Annotation_Appls *disc_annotations = $6;
3357 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3358 UTL_ScopedName n ($1, 0);
3359 idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen);
3362 * Create a node representing a union.
3364 if ($7 != 0 && s != 0)
3366 AST_ConcreteType *tp =
3367 dynamic_cast<AST_ConcreteType*> ($7);
3371 idl_global->err ()->not_a_type ($7);
3375 /* Create a union with a correct discriminator. */
3377 u = idl_global->gen ()->create_union (tp,
3382 /* Narrow the enclosing scope. */
3383 AST_Union *e = dynamic_cast<AST_Union*> (top);
3386 e->disc_annotations (*disc_annotations); // Set Discriminator Annotations
3396 idl_global->scopes ().push (top);
3402 delete disc_annotations;
3406 idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen);
3408 at_least_one_case_branch
3410 idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen);
3414 idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen);
3417 * Done with this union. Pop its scope from the scopes stack.
3419 $$ = dynamic_cast<AST_Union*> (
3420 idl_global->scopes ().top_non_null ()
3425 idl_global->scopes ().pop ();
3433 $$ = idl_global->scopes ().bottom ()->lookup_primitive_type ($1);
3437 if ($1 == AST_Expression::EV_wchar && idl_global->idl_version_ < IDL_VERSION_4)
3438 idl_global->err ()->idl_version_error (
3439 "Using wchar as a union discriminator isn't allowed in IDL versions before 4");
3441 $$ = idl_global->scopes ().bottom ()->lookup_primitive_type ($1);
3445 if (idl_global->idl_version_ < IDL_VERSION_4)
3446 idl_global->err ()->idl_version_error (
3447 "Using octet as a union discriminator isn't allowed in IDL versions before 4");
3449 $$ = idl_global->scopes ().bottom ()->lookup_primitive_type ($1);
3453 $$ = idl_global->scopes ().bottom ()->lookup_primitive_type ($1);
3458 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3460 AST_PredefinedType *p = 0;
3465 * The discriminator is a scoped name. Try to resolve to
3466 * one of the scalar types or to an enum. Thread through
3467 * typedef's to arrive at the base type at the end of the
3470 d = s->lookup_by_name ($1);
3472 if (s != 0 && d != 0)
3476 switch (d->node_type ())
3478 case AST_Decl::NT_enum:
3482 case AST_Decl::NT_pre_defined:
3483 p = dynamic_cast<AST_PredefinedType*> (d);
3489 case AST_PredefinedType::PT_long:
3490 case AST_PredefinedType::PT_ulong:
3491 case AST_PredefinedType::PT_longlong:
3492 case AST_PredefinedType::PT_ulonglong:
3493 case AST_PredefinedType::PT_short:
3494 case AST_PredefinedType::PT_ushort:
3495 case AST_PredefinedType::PT_int8:
3496 case AST_PredefinedType::PT_uint8:
3497 case AST_PredefinedType::PT_char:
3498 case AST_PredefinedType::PT_boolean:
3502 case AST_PredefinedType::PT_wchar:
3503 case AST_PredefinedType::PT_octet:
3504 if (idl_global->idl_version_ < IDL_VERSION_4)
3505 idl_global->err ()->idl_version_error (
3506 "Using octet or wchar as a union discriminator isn't allowed in IDL versions before 4");
3523 case AST_Decl::NT_typedef:
3524 t = dynamic_cast<AST_Typedef*> (d);
3528 d = t->base_type ();
3546 idl_global->err ()->lookup_error ($1);
3552 /* If we don't return here, we'll crash later.*/
3553 if (!idl_global->ignore_lookup_errors_)
3565 at_least_one_case_branch : case_branch case_branches ;
3568 : case_branches case_branch
3573 at_least_one_case_label
3575 idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen);
3577 annotations_maybe element_spec
3579 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen);
3583 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3584 AST_UnionBranch *b = 0;
3585 AST_Annotation_Appls *annotations = $3;
3587 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted);
3590 * Create several nodes representing branches of a union.
3591 * Add them to the enclosing scope (the union scope)
3593 if (s != 0 && $1 != 0 && $4 != 0)
3596 idl_global->gen ()->create_union_branch (
3601 b->annotation_appls (*annotations);
3602 (void) s->fe_add_union_branch (b);
3604 // f has passed its field type to the union branch,
3605 // but the rest still needs to be cleaned up.
3606 f->AST_Decl::destroy ();
3615 idl_global->err ()->syntax_error (idl_global->parse_state ());
3619 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
3624 at_least_one_case_label :
3625 case_label case_labels
3627 ACE_NEW_RETURN ($<llval>$,
3635 : case_labels case_label
3637 UTL_LabelList *ll = 0;
3662 idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen);
3666 idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
3668 $$ = idl_global->gen ()->create_union_label (
3669 AST_UnionLabel::UL_default,
3675 idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen);
3679 idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen);
3683 idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
3685 $$ = idl_global->gen ()->create_union_label (
3686 AST_UnionLabel::UL_label,
3695 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen);
3699 idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen);
3702 * Check for illegal recursive use of type
3705 && AST_illegal_recursive_type ($1))
3707 idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, $1);
3712 * Create a field in a union branch
3721 AST_Type *tp = $3->compose ($1);
3729 $$ = idl_global->gen ()->create_field (
3745 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3746 UTL_ScopedName n ($1,
3748 AST_StructureFwd *d = 0;
3751 * Create a node representing a forward declaration of a struct.
3755 d = idl_global->gen ()->create_structure_fwd (&n);
3756 (void) s->fe_add_structure_fwd (d);
3770 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3771 UTL_ScopedName n ($1,
3773 AST_UnionFwd *u = 0;
3776 * Create a node representing a forward declaration of a union.
3780 u = idl_global->gen ()->create_union_fwd (&n);
3781 (void) s->fe_add_union_fwd (u);
3793 idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
3797 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3798 UTL_ScopedName n ($3, 0);
3800 idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
3803 * Create a node representing an enum and add it to its
3808 e = idl_global->gen ()->create_enum (&n,
3812 * Add it to its defining scope
3814 (void) s->fe_add_enum (e);
3818 * Push the enum scope on the scopes stack.
3820 idl_global->scopes ().push (e);
3828 idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen);
3830 at_least_one_enumerator
3832 idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen);
3836 idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen);
3839 * Done with this enum. Pop its scope from the scopes stack.
3841 if (idl_global->scopes ().top () == 0)
3847 $$ = dynamic_cast<AST_Enum*> (
3848 idl_global->scopes ().top_non_null ()
3850 idl_global->scopes ().pop ();
3855 at_least_one_enumerator : enumerator enumerators ;
3861 idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
3868 annotations_maybe IDENTIFIER
3870 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3871 AST_Annotation_Appls *annotations = $1;
3873 ACE::strdelete ($2);
3875 UTL_ScopedName n (&id, 0);
3880 * Create a node representing one enumerator in an enum
3881 * Add it to the enclosing scope (the enum scope)
3884 && s->scope_node_type () == AST_Decl::NT_enum)
3886 c = dynamic_cast<AST_Enum*> (s);
3890 e = idl_global->gen ()->create_enum_val (
3891 c->next_enum_val (),
3895 e->annotation_appls (*annotations);
3898 (void) s->fe_add_enum_val (e);
3910 Decl_Annotations_Pair_Pair* type_pair = $1;
3911 Decl_Annotations_Pair *key_type = type_pair->first;
3912 Decl_Annotations_Pair *val_type = type_pair->second;
3915 * Remove map marker from scopes stack.
3917 if (idl_global->scopes ().top () == 0)
3919 idl_global->scopes ().pop ();
3922 UTL_Scope *s = idl_global->scopes ().top_non_null ();
3925 * Create a node representing a map.
3927 if (key_type && val_type)
3929 AST_Type *ktp = dynamic_cast<AST_Type*> (key_type->decl);
3930 AST_Type *vtp = dynamic_cast<AST_Type*> (val_type->decl);
3932 if (ktp == 0 || vtp == 0)
3934 ; // Error will be caught in FE_Declarator.
3938 Identifier id ("map");
3939 UTL_ScopedName sn (&id, 0);
3940 ACE_CDR::ULong bound = 0UL;
3943 idl_global->gen ()->create_map (
3944 idl_global->gen ()->create_expr (
3946 AST_Expression::EV_ulong
3954 map->key_type_annotations (*key_type->annotations);
3955 map->value_type_annotations (*val_type->annotations);
3957 idl_global->err ()->anonymous_type_diagnostic ();
3961 delete key_type->annotations;
3962 delete val_type->annotations;
3971 idl_global->set_parse_state (IDL_GlobalData::PS_MapSeen);
3974 * Push a map marker on scopes stack.
3976 idl_global->scopes ().push (0);
3979 annotations_maybe simple_type_spec
3981 idl_global->set_parse_state(IDL_GlobalData::PS_MapKeyTypeSeen);
3984 annotations_maybe simple_type_spec
3986 idl_global->set_parse_state(IDL_GlobalData::PS_MapValueTypeSeen);
3987 Decl_Annotations_Pair *key = new Decl_Annotations_Pair;
3989 key->annotations = $4;
3991 Decl_Annotations_Pair *value = new Decl_Annotations_Pair;
3993 value->annotations = $8;
3995 Decl_Annotations_Pair_Pair* pairs = new Decl_Annotations_Pair_Pair;
3997 pairs->second = value;
4006 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen);
4010 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen);
4014 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
4016 AST_Sequence *seq = 0;
4017 Decl_Annotations_Pair *seq_head = $1;
4019 AST_Annotation_Appls *type_annotations = 0;
4022 type = seq_head->decl;
4023 type_annotations = seq_head->annotations;
4028 * Remove sequence marker from scopes stack.
4030 if (idl_global->scopes ().top () == 0)
4032 idl_global->scopes ().pop ();
4035 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4038 * Create a node representing a sequence
4040 AST_Expression::AST_ExprValue *ev = 0;
4041 AST_Param_Holder *param_holder = 0;
4046 $4->param_holder ();
4048 ev = $4->coerce (AST_Expression::EV_ulong);
4051 // If the expression corresponds to a template parameter,
4052 // it's ok for the coercion to fail at this point. We check
4053 // for a type mismatch below.
4055 || (0 == ev && 0 == param_holder))
4057 idl_global->err ()->coercion_error ($4,
4058 AST_Expression::EV_ulong);
4062 AST_Type *tp = dynamic_cast<AST_Type*> (type);
4066 ; // Error will be caught in FE_Declarator.
4070 Identifier id ("sequence");
4071 UTL_ScopedName sn (&id,
4075 idl_global->gen ()->create_sequence (
4082 seq->base_type_annotations (*type_annotations);
4084 idl_global->err ()->anonymous_type_diagnostic ();
4088 delete type_annotations;
4096 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
4098 AST_Sequence *seq = 0;
4099 Decl_Annotations_Pair *seq_head = $1;
4101 AST_Annotation_Appls *type_annotations = 0;
4104 type = seq_head->decl;
4105 type_annotations = seq_head->annotations;
4110 * Remove sequence marker from scopes stack.
4112 if (idl_global->scopes ().top () == 0)
4114 idl_global->scopes ().pop ();
4117 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4120 * Create a node representing a sequence.
4124 AST_Type *tp = dynamic_cast<AST_Type*> (type);
4128 ; // Error will be caught in FE_Declarator.
4132 Identifier id ("sequence");
4133 UTL_ScopedName sn (&id, 0);
4134 ACE_CDR::ULong bound = 0UL;
4137 idl_global->gen ()->create_sequence (
4138 idl_global->gen ()->create_expr (
4140 AST_Expression::EV_ulong
4147 seq->base_type_annotations (*type_annotations);
4149 idl_global->err ()->anonymous_type_diagnostic ();
4153 delete type_annotations;
4161 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
4164 * Push a sequence marker on scopes stack.
4166 idl_global->scopes ().push (0);
4170 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen);
4172 annotations_maybe simple_type_spec
4174 idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen);
4175 Decl_Annotations_Pair *seq_head = new Decl_Annotations_Pair;
4176 seq_head->decl = $6;
4177 seq_head->annotations = $5;
4183 : IDL_FIXED '<' positive_int_expr ',' const_expr '>'
4185 $5->evaluate (AST_Expression::EK_positive_int);
4186 $$ = idl_global->gen ()->create_fixed ($3, $5);
4194 idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
4198 idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
4202 idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
4205 * Create a node representing a string.
4207 AST_Expression::AST_ExprValue *ev = 0;
4211 ev = $4->coerce (AST_Expression::EV_ulong);
4214 if (0 == $4 || 0 == ev)
4216 idl_global->err ()->coercion_error ($4,
4217 AST_Expression::EV_ulong);
4222 tao_string_decl = idl_global->gen ()->create_string ($4);
4225 * Add this AST_String to the types defined in the global scope.
4227 idl_global->root ()->fe_add_string (
4228 dynamic_cast<AST_String*> (
4231 idl_global->err ()->anonymous_type_diagnostic ();
4233 $$ = tao_string_decl;
4241 idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
4244 * Create a node representing a string.
4246 ACE_CDR::ULong bound = 0UL;
4248 idl_global->gen ()->create_string (
4249 idl_global->gen ()->create_expr (bound,
4250 AST_Expression::EV_ulong)
4254 * Add this AST_String to the types defined in the global scope.
4256 idl_global->root ()->fe_add_string (
4257 dynamic_cast<AST_String*> (
4260 $$ = tao_string_decl;
4267 idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
4275 idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
4279 idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
4283 idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
4286 * Create a node representing a string.
4288 AST_Expression::AST_ExprValue *ev = 0;
4292 ev = $4->coerce (AST_Expression::EV_ulong);
4295 if (0 == $4 || 0 == ev)
4297 idl_global->err ()->coercion_error ($4,
4298 AST_Expression::EV_ulong);
4303 AST_String *string = idl_global->gen ()->create_wstring ($4);
4306 * Add this AST_String to the types defined in the global scope.
4308 idl_global->root ()->fe_add_string (
4309 dynamic_cast<AST_String*> (
4312 idl_global->err ()->anonymous_type_diagnostic ();
4322 idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
4325 * Create a node representing a wstring.
4327 ACE_CDR::ULong bound = 0UL;
4328 AST_String *string =
4329 idl_global->gen ()->create_wstring (
4330 idl_global->gen ()->create_expr (bound,
4331 AST_Expression::EV_ulong)
4335 * Add this AST_String to the types defined in the global scope.
4337 idl_global->root ()->fe_add_string (
4338 dynamic_cast<AST_String*> (
4348 idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
4355 idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen);
4357 annotations_maybe at_least_one_array_dim
4359 idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted);
4361 AST_Array *array = 0;
4362 AST_Annotation_Appls *base_type_annotations = $3;
4363 UTL_ExprList *array_dims = $4;
4366 * Create a node representing an array.
4370 UTL_ScopedName sn ($1,
4373 idl_global->gen ()->create_array (
4375 array_dims->length (),
4380 array->base_type_annotations (*base_type_annotations);
4383 idl_global->err ()->anonymous_type_diagnostic ();
4386 array_dims->destroy ();
4389 delete base_type_annotations;
4395 at_least_one_array_dim :
4396 array_dim array_dims
4406 : array_dims array_dim
4408 UTL_ExprList *el = 0;
4433 idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen);
4437 idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen);
4441 idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen);
4444 * Array dimensions are expressions which must be coerced to
4445 * positive integers.
4447 AST_Expression::AST_ExprValue *ev = 0;
4448 AST_Param_Holder *param_holder = 0;
4453 $3->param_holder ();
4456 $3->coerce (AST_Expression::EV_ulong);
4460 || (ev == 0 && param_holder == 0))
4462 idl_global->err ()->coercion_error ($3,
4463 AST_Expression::EV_ulong);
4468 if (param_holder != 0)
4470 AST_Expression::ExprType et =
4471 param_holder->info ()->const_type_;
4473 // If the bound expression represents a
4474 // template parameter, it must be a const
4475 // and of type unsigned long.
4476 if (et != AST_Expression::EV_ulong)
4478 idl_global->err ()->mismatched_template_param (
4479 param_holder->info ()->name_.c_str ());
4496 : attribute_readonly
4497 | attribute_readwrite
4500 attribute_readonly :
4503 idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
4507 idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
4511 idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
4513 at_least_one_simple_declarator
4515 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
4519 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4520 AST_Attribute *a = 0;
4521 FE_Declarator *d = 0;
4523 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4526 * Create nodes representing attributes and add them to the
4529 if (s != 0 && $5 != 0 && $7 != 0)
4531 for (UTL_DecllistActiveIterator l ($7); !l.is_done (); l.next ())
4540 AST_Type *tp = d->compose ($5);
4547 a = idl_global->gen ()->create_attribute (
4548 true, tp, d->name (), s->is_local (), s->is_abstract ());
4552 (void) a->fe_add_get_exceptions ($9);
4559 (void) s->fe_add_attribute (a);
4571 attribute_readwrite :
4574 idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
4578 idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
4580 at_least_one_simple_declarator
4582 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
4586 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseCompleted);
4590 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4591 AST_Attribute *a = 0;
4592 FE_Declarator *d = 0;
4594 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseCompleted);
4597 * Create nodes representing attributes and add them to the
4600 if (s != 0 && $3 != 0 && $5 != 0)
4602 for (UTL_DecllistActiveIterator l ($5); !l.is_done (); l.next ())
4611 AST_Type *tp = d->compose ($3);
4618 a = idl_global->gen ()->create_attribute (
4619 false, tp, d->name (), s->is_local (), s->is_abstract ());
4623 (void) a->fe_add_get_exceptions ($7);
4632 (void) a->fe_add_set_exceptions ($9);
4639 (void) s->fe_add_attribute (a);
4654 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
4658 Identifier *&id = $3;
4659 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
4660 UTL_ScopedName scoped_name (id, 0);
4661 AST_Exception *exception = 0;
4662 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen);
4665 * Create a node representing an exception and add it to
4666 * the enclosing scope.
4670 exception = idl_global->gen ()->create_exception (
4673 scope->is_abstract ());
4674 scope->fe_add_exception (exception);
4678 * Push the exception scope on the scope stack.
4680 idl_global->scopes ().push (exception);
4686 $<dcval>$ = exception;
4690 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen);
4694 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen);
4698 idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen);
4700 * Done with this exception. Pop its scope from the scope stack.
4702 idl_global->scopes ().pop ();
4709 : opt_op_attribute op_type_spec
4711 idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
4715 AST_Operation *op = 0;
4716 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
4718 AST_Operation::Flags op_flags = $1;
4719 AST_Decl *type_node = $2;
4722 ACE::strdelete ($4);
4725 UTL_ScopedName name (&id, 0);
4726 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
4729 * Create a node representing an operation on an interface
4730 * and add it to its enclosing scope.
4732 if (scope != 0 && type_node != 0)
4734 AST_Type *type = dynamic_cast<AST_Type*> (type_node);
4738 idl_global->err ()->not_a_type (type_node);
4740 else if (type->node_type () == AST_Decl::NT_except)
4742 idl_global->err ()->not_a_type (type_node);
4746 AST_Decl *d = ScopeAsDecl (scope);
4747 AST_Decl::NodeType nt = d->node_type ();
4748 const bool local = scope->is_local ()
4749 || nt == AST_Decl::NT_valuetype
4750 || nt == AST_Decl::NT_eventtype;
4752 op = idl_global->gen ()->create_operation (
4753 type, op_flags, &name, local, scope->is_abstract ());
4755 if (!local && type->is_local ())
4757 idl_global->err ()->local_remote_mismatch (type, op);
4764 scope->fe_add_operation (op);
4770 * Push the operation scope onto the scopes stack.
4772 idl_global->scopes ().push (op);
4776 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
4780 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4784 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4785 AST_Operation *o = 0;
4786 idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted);
4789 * Add exceptions and context to the operation.
4791 if (s != 0 && s->scope_node_type () == AST_Decl::NT_op)
4793 o = dynamic_cast<AST_Operation*> (s);
4795 if ($8 != 0 && o != 0)
4797 (void) o->fe_add_exceptions ($8);
4802 (void) o->fe_add_context ($10);
4807 * Done with this operation. Pop its scope from the scopes stack.
4809 idl_global->scopes ().pop ();
4818 idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
4819 $$ = AST_Operation::OP_oneway;
4823 idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
4824 $$ = AST_Operation::OP_idempotent;
4828 $$ = AST_Operation::OP_noflags;
4837 idl_global->scopes ().bottom ()->lookup_primitive_type (
4838 AST_Expression::EV_void
4846 //@@ PS_FactorySeen?
4847 idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
4851 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4853 if (s->is_abstract ())
4856 ACE_ERROR ((LM_ERROR,
4857 ACE_TEXT ("error in %C line %d:\n")
4858 ACE_TEXT ("Abstract valuetype can't have a ")
4859 ACE_TEXT ("factory construct.\n"),
4860 idl_global->filename ()->get_string (),
4861 idl_global->lineno ()));
4863 idl_global->set_err_count (idl_global->err_count () + 1);
4867 ACE::strdelete ($3);
4870 UTL_ScopedName n (&id,
4872 AST_Factory *factory = 0;
4873 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
4876 * Create a node representing an factory construct
4877 * and add it to its enclosing scope
4881 factory = idl_global->gen ()->create_factory (&n);
4882 (void) s->fe_add_factory (factory);
4886 * Push the operation scope onto the scopes stack.
4888 idl_global->scopes ().push (factory);
4890 $<dcval>$ = factory;
4894 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
4898 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
4902 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4903 AST_Factory *f = dynamic_cast<AST_Factory*> (s);
4904 (void) f->fe_add_exceptions ($7);
4907 idl_global->scopes ().pop ();
4916 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4920 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4924 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4926 at_least_one_in_parameter
4929 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4933 at_least_one_in_parameter : in_parameter in_parameters ;
4939 idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
4948 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
4952 idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
4956 UTL_Scope *s = idl_global->scopes ().top_non_null ();
4957 AST_Argument *a = 0;
4958 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
4961 * Create a node representing an argument to an operation
4962 * Add it to the enclosing scope (the operation scope).
4968 AST_Type *tp = $5->compose ($3);
4972 a = idl_global->gen ()->create_argument (
4973 AST_Argument::dir_IN,
4978 (void) s->fe_add_argument (a);
4991 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
4995 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
4999 idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
5001 at_least_one_parameter
5004 idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
5008 at_least_one_parameter : parameter parameters ;
5014 idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
5023 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
5027 idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
5031 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5032 AST_Argument *a = 0;
5033 idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
5036 * Create a node representing an argument to an operation
5037 * Add it to the enclosing scope (the operation scope).
5043 AST_Type *tp = $5->compose ($3);
5047 if (!s->is_local () && tp->is_local ())
5049 idl_global->err ()->local_remote_mismatch (tp, s);
5054 idl_global->gen ()->create_argument (
5059 (void) s->fe_add_argument (a);
5074 idl_global->scopes ().bottom ()->lookup_primitive_type (
5082 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5084 UTL_ScopedName *n = $1;
5088 d = s->lookup_by_name (n, false, false);
5093 idl_global->err ()->lookup_error (n);
5097 /* If we don't return here, we'll crash later.*/
5102 d->last_referenced_as ($1);
5103 AST_Decl::NodeType nt = d->node_type ();
5104 AST_Type *t = dynamic_cast<AST_Type*> (d);
5105 AST_Typedef *td = 0;
5106 bool can_be_undefined = false;
5108 if (nt == AST_Decl::NT_typedef)
5110 // This code block ensures that a sequence of
5111 // as-yet-undefined struct or union isn't used
5112 // as a return type or argument.
5113 td = dynamic_cast<AST_Typedef*> (d);
5114 AST_Type *pbt = td->primitive_base_type ();
5116 if (pbt->node_type () == AST_Decl::NT_sequence)
5119 AST_Sequence *seq_type =
5120 dynamic_cast<AST_Sequence*> (pbt);
5121 AST_Type *elem_type =
5122 seq_type->base_type ();
5123 AST_Decl::NodeType elem_nt =
5124 elem_type->node_type ();
5126 if (elem_nt == AST_Decl::NT_typedef)
5128 AST_Typedef *elem_td =
5129 dynamic_cast<AST_Typedef*> (elem_type);
5130 elem_type = elem_td->primitive_base_type ();
5131 elem_nt = elem_type->node_type ();
5134 if (elem_nt == AST_Decl::NT_interface
5135 || elem_nt == AST_Decl::NT_interface_fwd
5136 || elem_nt == AST_Decl::NT_valuetype
5137 || elem_nt == AST_Decl::NT_valuetype_fwd
5138 || elem_nt == AST_Decl::NT_component
5139 || elem_nt == AST_Decl::NT_component_fwd)
5141 can_be_undefined = true;
5145 if (pbt->node_type() == AST_Decl::NT_map)
5149 dynamic_cast<AST_Map*> (pbt);
5150 AST_Type *key_type =
5151 map_type->key_type ();
5152 AST_Type *val_type =
5153 map_type->value_type ();
5155 AST_Decl::NodeType key_nt =
5156 key_type->node_type ();
5157 AST_Decl::NodeType val_nt =
5158 val_type->node_type ();
5160 if (key_nt == AST_Decl::NT_typedef)
5162 AST_Typedef *key_td =
5163 dynamic_cast<AST_Typedef*> (key_type);
5164 key_type = key_td->primitive_base_type ();
5165 key_nt = key_type->node_type ();
5168 if (val_nt == AST_Decl::NT_typedef)
5170 AST_Typedef *val_td =
5171 dynamic_cast<AST_Typedef*> (val_type);
5172 val_type = val_td->primitive_base_type ();
5173 val_nt = val_type->node_type ();
5176 if (key_nt == AST_Decl::NT_interface
5177 || key_nt == AST_Decl::NT_interface_fwd
5178 || key_nt == AST_Decl::NT_valuetype
5179 || key_nt == AST_Decl::NT_valuetype_fwd
5180 || key_nt == AST_Decl::NT_component
5181 || key_nt == AST_Decl::NT_component_fwd
5182 || val_nt == AST_Decl::NT_interface
5183 || val_nt == AST_Decl::NT_interface_fwd
5184 || val_nt == AST_Decl::NT_valuetype
5185 || val_nt == AST_Decl::NT_valuetype_fwd
5186 || val_nt == AST_Decl::NT_component
5187 || val_nt == AST_Decl::NT_component_fwd)
5189 can_be_undefined = true;
5193 if (! t->is_defined () && ! can_be_undefined)
5195 idl_global->err ()->error1 (
5196 UTL_Error::EIDL_ILLEGAL_ADD,
5197 (nt == AST_Decl::NT_typedef ? td : t));
5199 /* If we don't return here, we'll crash later.*/
5205 // For forward declared structs and unions, we
5206 // want the full definition, but we need to
5207 // check that it's been fully defined.
5208 AST_StructureFwd *fwd =
5209 dynamic_cast<AST_StructureFwd*> (d);
5213 t = fwd->full_definition ();
5215 if (! t->is_defined ())
5217 idl_global->err ()->error1 (
5218 UTL_Error::EIDL_ILLEGAL_ADD,
5221 /* If we don't return here, we'll crash later.*/
5237 $$ = AST_Argument::dir_IN;
5241 $$ = AST_Argument::dir_OUT;
5245 $$ = AST_Argument::dir_INOUT;
5252 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen);
5256 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen);
5258 at_least_one_scoped_name
5261 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen);
5273 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSeen);
5277 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSqSeen);
5279 at_least_one_scoped_name
5282 idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseQsSeen);
5294 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSeen);
5298 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSqSeen);
5300 at_least_one_scoped_name
5303 idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseQsSeen);
5315 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen);
5319 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen);
5321 at_least_one_string_literal
5324 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
5333 at_least_one_string_literal :
5334 IDL_STRING_LITERAL string_literals
5336 ACE_NEW_RETURN ($<slval>$,
5347 idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
5351 UTL_StrList *sl = 0;
5374 : IDL_TYPEID scoped_name IDL_STRING_LITERAL
5376 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5378 s->lookup_by_name ($2);
5382 idl_global->err ()->lookup_error ($2);
5386 d->set_id_with_typeid (
5404 : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL
5406 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5407 AST_Decl *d = ScopeAsDecl (s);
5409 // If we are in a module, we want to avoid a lookup unless the
5410 // typeprefix is to be applied to some other scope, since we
5411 // might get a previous opening of the module, and the prefix
5412 // of this opening would never get checked or set.
5413 if (d->name ()->compare ($2) != 0)
5416 s->lookup_by_name ($2);
5421 idl_global->err ()->lookup_error ($2);
5425 d->set_prefix_with_typeprefix (
5444 | component_forward_decl
5447 component_forward_decl :
5451 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5452 UTL_ScopedName n ($2,
5454 AST_ComponentFwd *f = 0;
5455 idl_global->set_parse_state (
5456 IDL_GlobalData::PS_ComponentForwardSeen
5460 * Create a node representing a forward declaration of a
5461 * component. Store it in the enclosing scope.
5465 f = idl_global->gen ()->create_component_fwd (&n);
5466 (void) s->fe_add_component_fwd (f);
5480 FE_ComponentHeader *&component_header = $1;
5481 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
5482 AST_Component *component = 0;
5485 * Make a new component node and add it to the enclosing scope.
5487 if (scope && component_header)
5489 component = idl_global->gen ()->create_component (
5490 component_header->name (),
5491 component_header->base_component (),
5492 component_header->supports (),
5493 component_header->n_supports (),
5494 component_header->supports_flat (),
5495 component_header->n_supports_flat ());
5496 AST_Interface *component_as_interface =
5497 dynamic_cast<AST_Interface *> (component);
5498 AST_Interface::fwd_redefinition_helper (
5499 component_as_interface, scope);
5500 component = dynamic_cast<AST_Component *> (component_as_interface);
5503 * Add the component to its definition scope.
5505 scope->fe_add_component (component);
5507 // This FE_ComponentHeader class isn't destroyed with the AST.
5508 component_header->destroy ();
5509 delete component_header;
5510 component_header = 0;
5514 * Push it on the scope stack.
5516 idl_global->scopes ().push (component);
5518 $<dcval>$ = component;
5522 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentSqSeen);
5526 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentBodySeen);
5530 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentQsSeen);
5533 * Done with this component - pop it off the scopes stack.
5535 idl_global->scopes ().pop ();
5545 idl_global->set_parse_state (IDL_GlobalData::PS_ComponentIDSeen);
5547 component_inheritance_spec
5549 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
5553 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
5556 * Create an AST representation of the information in the header
5557 * part of a component.
5559 UTL_ScopedName *n = 0;
5564 ACE_NEW_RETURN ($<chval>$,
5565 FE_ComponentHeader (n,
5587 component_inheritance_spec
5590 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
5603 : component_exports at_least_one_annotation component_export
5605 AST_Annotation_Appls *&annotations = $2;
5606 AST_Decl *&node = $3;
5609 node->annotation_appls (*annotations);
5613 idl_global->err ()-> unsupported_warning (
5614 "Annotating this is not supported");
5618 | component_exports component_export
5625 idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
5629 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5634 idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
5638 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5643 idl_global->set_parse_state (IDL_GlobalData::PS_EmitsDeclSeen);
5647 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5652 idl_global->set_parse_state (IDL_GlobalData::PS_PublishesDeclSeen);
5656 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5661 idl_global->set_parse_state (IDL_GlobalData::PS_ConsumesDeclSeen);
5665 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5670 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
5674 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5677 | extended_port_decl
5679 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
5683 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
5688 provides_decl : IDL_PROVIDES interface_type id
5690 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5691 bool so_far_so_good = true;
5692 AST_Decl::NodeType nt = AST_Decl::NT_type;
5693 AST_Param_Holder *ph = 0;
5696 s->lookup_by_name ($2, true, false);
5700 idl_global->err ()->lookup_error ($2);
5701 so_far_so_good = false;
5706 nt = d->node_type ();
5710 case AST_Decl::NT_interface:
5712 case AST_Decl::NT_param_holder:
5713 ph = dynamic_cast<AST_Param_Holder*> (d);
5714 nt = ph->info ()->type_;
5716 if (nt != AST_Decl::NT_type
5717 && nt != AST_Decl::NT_interface)
5719 idl_global->err ()->mismatched_template_param (
5720 ph->info ()->name_.c_str ());
5722 so_far_so_good = false;
5726 case AST_Decl::NT_pre_defined:
5727 // Nothing else but CORBA::Object can have
5730 ACE_OS::strcmp (d->local_name ()->get_string (),
5733 // Simple provides port must use IDL interface
5734 // or CORBA::Object.
5737 idl_global->err ()->interface_expected (d);
5738 so_far_so_good = false;
5743 idl_global->err ()->interface_expected (d);
5744 so_far_so_good = false;
5749 AST_Provides *provides = 0;
5753 AST_Type *port_interface_type =
5754 dynamic_cast<AST_Type*> (d);
5756 // Strip off _cxx_, if any, for port name.
5757 FE_Utils::original_local_name ($3);
5759 UTL_ScopedName sn ($3,
5762 provides = idl_global->gen ()->create_provides (
5763 &sn, port_interface_type);
5765 (void) s->fe_add_provides (provides);
5776 $$ = dynamic_cast<AST_Decl *> (provides);
5783 // Lookups and checking are done where the 'interface_type'
5784 // token is used, in 'provides_decl' and 'uses_decl'.
5789 Identifier *corba_id = 0;
5791 ACE_NEW_RETURN (corba_id,
5792 Identifier ("Object"),
5795 UTL_IdList *conc_name = 0;
5796 ACE_NEW_RETURN (conc_name,
5797 UTL_IdList (corba_id,
5801 ACE_NEW_RETURN (corba_id,
5802 Identifier ("CORBA"),
5805 ACE_NEW_RETURN ($<idlist>$,
5806 UTL_IdList (corba_id,
5812 uses_decl : uses_opt_multiple interface_type id
5814 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5815 bool so_far_so_good = true;
5816 AST_Decl::NodeType nt = AST_Decl::NT_type;
5817 AST_Param_Holder *ph = 0;
5820 s->lookup_by_name ($2, true, false);
5824 idl_global->err ()->lookup_error ($2);
5825 so_far_so_good = false;
5830 nt = d->node_type ();
5834 case AST_Decl::NT_interface:
5836 case AST_Decl::NT_param_holder:
5837 ph = dynamic_cast<AST_Param_Holder*> (d);
5838 nt = ph->info ()->type_;
5840 if (nt != AST_Decl::NT_type
5841 && nt != AST_Decl::NT_interface)
5843 idl_global->err ()->mismatched_template_param (
5844 ph->info ()->name_.c_str ());
5846 so_far_so_good = false;
5850 case AST_Decl::NT_pre_defined:
5851 // Nothing else but CORBA::Object can have
5854 ACE_OS::strcmp (d->local_name ()->get_string (),
5857 // Simple provides port must use IDL interface
5858 // or CORBA::Object.
5861 idl_global->err ()->interface_expected (d);
5862 so_far_so_good = false;
5867 idl_global->err ()->interface_expected (d);
5868 so_far_so_good = false;
5877 AST_Type *port_interface_type =
5878 dynamic_cast<AST_Type*> (d);
5880 // Strip off _cxx_, if any, for port name.
5881 FE_Utils::original_local_name ($3);
5883 UTL_ScopedName sn ($3,
5886 uses = idl_global->gen ()->create_uses (
5887 &sn, port_interface_type, $1);
5888 s->fe_add_uses (uses);
5891 dynamic_cast<AST_Component*> (s);
5894 && uses->is_multiple ()
5895 && !idl_global->using_ifr_backend ()
5896 && !idl_global->ignore_idl3 ()
5897 && nt != AST_Decl::NT_param_holder)
5899 // These datatypes must be created in the
5900 // front end so they can be looked up
5901 // when compiling the generated executor IDL.
5902 FE_Utils::create_uses_multiple_stuff (c, uses);
5919 : IDL_USES opt_multiple
5921 // We use this extra rule here to use in both uses_decl and
5922 // extended_uses_decl, so the LALR(1) parser can avoid conflicts.
5939 : IDL_EMITS scoped_name id
5941 UTL_Scope *s = idl_global->scopes ().top_non_null ();
5942 bool so_far_so_good = true;
5943 AST_Decl::NodeType nt = AST_Decl::NT_type;
5944 AST_Param_Holder *ph = 0;
5947 s->lookup_by_name ($2, true, false);
5951 idl_global->err ()->lookup_error ($2);
5952 so_far_so_good = false;
5956 nt = d->node_type ();
5960 case AST_Decl::NT_eventtype:
5962 case AST_Decl::NT_param_holder:
5963 ph = dynamic_cast<AST_Param_Holder*> (d);
5964 nt = ph->info ()->type_;
5966 if (nt != AST_Decl::NT_type
5967 && nt != AST_Decl::NT_eventtype)
5969 idl_global->err ()->mismatched_template_param (
5970 ph->info ()->name_.c_str ());
5972 so_far_so_good = false;
5977 idl_global->err ()->eventtype_expected (d);
5978 so_far_so_good = false;
5987 AST_Type *event_type =
5988 dynamic_cast<AST_Type*> (d);
5990 // Strip off _cxx_, if any, for port name.
5991 FE_Utils::original_local_name ($3);
5993 UTL_ScopedName sn ($3,
5996 e = idl_global->gen ()->create_emits (&sn, event_type);
5998 (void) s->fe_add_emits (e);
6014 : IDL_PUBLISHES scoped_name id
6016 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6017 bool so_far_so_good = true;
6018 AST_Decl::NodeType nt = AST_Decl::NT_type;
6019 AST_Param_Holder *ph = 0;
6022 s->lookup_by_name ($2, true, false);
6026 idl_global->err ()->lookup_error ($2);
6027 so_far_so_good = false;
6031 nt = d->node_type ();
6035 case AST_Decl::NT_eventtype:
6037 case AST_Decl::NT_param_holder:
6038 ph = dynamic_cast<AST_Param_Holder*> (d);
6039 nt = ph->info ()->type_;
6041 if (nt != AST_Decl::NT_type
6042 && nt != AST_Decl::NT_eventtype)
6044 idl_global->err ()->mismatched_template_param (
6045 ph->info ()->name_.c_str ());
6047 so_far_so_good = false;
6052 idl_global->err ()->eventtype_expected (d);
6053 so_far_so_good = false;
6058 AST_Publishes *p = 0;
6062 AST_Type *event_type =
6063 dynamic_cast<AST_Type*> (d);
6065 // Strip off _cxx_, if any, for port name.
6066 FE_Utils::original_local_name ($3);
6068 UTL_ScopedName sn ($3, 0);
6069 p = idl_global->gen ()->create_publishes (&sn, event_type);
6070 s->fe_add_publishes (p);
6086 : IDL_CONSUMES scoped_name id
6088 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6089 bool so_far_so_good = true;
6090 AST_Decl::NodeType nt = AST_Decl::NT_type;
6091 AST_Param_Holder *ph = 0;
6094 s->lookup_by_name ($2, true, false);
6098 idl_global->err ()->lookup_error ($2);
6099 so_far_so_good = false;
6103 nt = d->node_type ();
6107 case AST_Decl::NT_eventtype:
6109 case AST_Decl::NT_param_holder:
6110 ph = dynamic_cast<AST_Param_Holder*> (d);
6111 nt = ph->info ()->type_;
6113 if (nt != AST_Decl::NT_type
6114 && nt != AST_Decl::NT_eventtype)
6116 idl_global->err ()->mismatched_template_param (
6117 ph->info ()->name_.c_str ());
6119 so_far_so_good = false;
6124 idl_global->err ()->eventtype_expected (d);
6125 so_far_so_good = false;
6130 AST_Consumes *c = 0;
6134 AST_Type *event_type =
6135 dynamic_cast<AST_Type*> (d);
6137 // Strip off _cxx_, if any, for port name.
6138 FE_Utils::original_local_name ($3);
6140 UTL_ScopedName sn ($3,
6143 c = idl_global->gen ()->create_consumes (&sn, event_type);
6145 (void) s->fe_add_consumes (c);
6163 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6167 * Make a new home node and add it to the enclosing scope.
6169 if (s != 0 && $1 != 0)
6172 idl_global->gen ()->create_home (
6175 $1->managed_component (),
6179 $1->supports_flat (),
6180 $1->n_supports_flat ()
6183 * Add the home to its definition scope.
6185 (void) s->fe_add_home (h);
6187 // This FE_HomeHeader class isn't destroyed with the AST.
6194 * Push it on the scope stack.
6196 idl_global->scopes ().push (h);
6201 * Done with this component - pop it off the scopes stack.
6203 idl_global->scopes ().pop ();
6212 idl_global->set_parse_state (IDL_GlobalData::PS_HomeSeen);
6216 idl_global->set_parse_state (IDL_GlobalData::PS_HomeIDSeen);
6218 home_inheritance_spec
6220 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
6224 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
6228 idl_global->set_parse_state (IDL_GlobalData::PS_ManagesSeen);
6232 idl_global->set_parse_state (IDL_GlobalData::PS_ManagesIDSeen);
6236 idl_global->set_parse_state (IDL_GlobalData::PS_PrimaryKeySpecSeen);
6239 * Create an AST representation of the information in the header
6240 * part of a component home.
6242 UTL_ScopedName *n = 0;
6244 UTL_ScopedName ($3, 0),
6247 ACE_NEW_RETURN ($<hhval>$,
6282 home_inheritance_spec
6285 idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
6312 idl_global->set_parse_state (IDL_GlobalData::PS_HomeSqSeen);
6316 idl_global->set_parse_state (IDL_GlobalData::PS_HomeBodySeen);
6320 idl_global->set_parse_state (IDL_GlobalData::PS_HomeQsSeen);
6325 : home_exports home_export
6333 idl_global->set_parse_state (IDL_GlobalData::PS_FactoryDeclSeen);
6337 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
6341 idl_global->set_parse_state (IDL_GlobalData::PS_FinderDeclSeen);
6345 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
6353 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6354 UTL_ScopedName n ($2,
6356 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
6359 * Create a node representing a factory operation
6360 * and add it to the enclosing scope.
6362 AST_Factory *f = idl_global->gen ()->create_factory (&n);
6363 (void) s->fe_add_factory (f);
6370 * Push the factory scope onto the scopes stack.
6372 idl_global->scopes ().push (f);
6376 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
6380 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6381 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
6384 * Add exceptions and context to the factory.
6388 (void) s->fe_add_exceptions ($6);
6392 * Done with this factory. Pop its scope from the scopes stack.
6394 idl_global->scopes ().pop ();
6402 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6403 UTL_ScopedName n ($2,
6406 idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
6409 * Create a node representing a home finder
6410 * and add it to the enclosing scope.
6413 idl_global->gen ()->create_finder (&n);
6415 (void) s->fe_add_finder (f);
6423 * Push the operation scope onto the scopes stack.
6425 idl_global->scopes ().push (f);
6429 idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
6433 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6434 idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
6437 * Add exceptions and context to the finder.
6441 (void) s->fe_add_exceptions ($6);
6445 * Done with this operation. Pop its scope from the scopes stack.
6447 idl_global->scopes ().pop ();
6454 | event_forward_decl
6458 : event_abs_forward_decl
6459 | event_concrete_forward_decl
6462 event_concrete_forward_decl :
6466 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6467 UTL_ScopedName n ($2,
6469 AST_EventTypeFwd *f = 0;
6470 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
6473 * Create a node representing a forward declaration of an
6474 * eventtype. Store it in the enclosing scope
6478 f = idl_global->gen ()->create_eventtype_fwd (&n,
6480 (void) s->fe_add_valuetype_fwd (f);
6491 event_abs_forward_decl :
6496 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6497 UTL_ScopedName n ($3,
6499 AST_EventTypeFwd *f = 0;
6500 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
6503 * Create a node representing a forward declaration of an
6504 * eventtype. Store it in the enclosing scope
6508 f = idl_global->gen ()->create_eventtype_fwd (&n,
6510 (void) s->fe_add_valuetype_fwd (f);
6523 event_rest_of_header
6525 UTL_Scope *s = idl_global->scopes ().top_non_null ();
6526 AST_EventType *e = 0;
6527 AST_Interface *i = 0;
6529 if (s != 0 && $1 != 0)
6531 UTL_ScopedName sn ($1,
6534 idl_global->gen ()->create_eventtype (
6538 $2->inherits_concrete (),
6539 $2->inherits_flat (),
6540 $2->n_inherits_flat (),
6543 $2->supports_concrete (),
6548 i = dynamic_cast<AST_Interface*> (e);
6549 AST_Interface::fwd_redefinition_helper (i,
6552 * Add the eventetype to its definition scope
6554 e = dynamic_cast<AST_EventType*> (i);
6555 (void) s->fe_add_eventtype (e);
6559 * Push it on the scope stack.
6561 idl_global->scopes ().push (e);
6569 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
6573 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
6577 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
6580 * Done with this eventtype - pop it off the scopes stack.
6582 idl_global->scopes ().pop ();
6597 event_custom_header :
6602 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
6604 ACE_DEBUG ((LM_DEBUG,
6605 ACE_TEXT ("error in %C line %d\n"),
6606 idl_global->filename ()->get_string (),
6607 idl_global->lineno ()));
6608 ACE_DEBUG ((LM_DEBUG,
6609 ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
6610 ACE_TEXT (" custom yet\n")));
6615 event_plain_header :
6619 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
6625 event_rest_of_header :
6628 idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
6632 idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
6634 ACE_NEW_RETURN ($<vhval>$,
6640 ? $1->truncatable ()
6663 event_rest_of_header
6665 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
6666 Identifier *&event_id = $1;
6667 FE_OBVHeader *&event_header = $2;
6668 AST_EventType *eventtype = 0;
6670 if (scope && event_header)
6672 // We create the scoped name here instead of with the
6673 // FE_OBVHeader because there is a token for it only here.
6674 UTL_ScopedName sn (event_id, 0);
6675 eventtype = idl_global->gen ()->create_eventtype (
6677 event_header->inherits (),
6678 event_header->n_inherits (),
6679 event_header->inherits_concrete (),
6680 event_header->inherits_flat (),
6681 event_header->n_inherits_flat (),
6682 event_header->supports (),
6683 event_header->n_supports (),
6684 event_header->supports_concrete (),
6686 event_header->truncatable (),
6688 AST_Interface *eventtype_as_interface =
6689 dynamic_cast<AST_Interface *> (eventtype);
6690 AST_Interface::fwd_redefinition_helper (
6691 eventtype_as_interface, scope);
6692 eventtype = dynamic_cast<AST_EventType *> (eventtype_as_interface);
6695 * Add the eventetype to its definition scope
6697 scope->fe_add_eventtype (eventtype);
6699 // FE_OBVHeader is not automatically destroyed in the AST
6700 event_header->destroy ();
6701 delete event_header;
6708 * Push it on the scope stack.
6710 idl_global->scopes ().push (eventtype);
6712 $<dcval>$ = eventtype;
6716 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
6720 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
6724 idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
6727 * Done with this eventtype - pop it off the scopes stack.
6729 idl_global->scopes ().pop ();
6736 : event_custom_header
6740 | event_plain_header
6746 formal_parameter_type
6749 $<ntval>$ = AST_Decl::NT_type;
6753 $<ntval>$ = AST_Decl::NT_struct;
6757 $<ntval>$ = AST_Decl::NT_union;
6761 $<ntval>$ = AST_Decl::NT_eventtype;
6765 $<ntval>$ = AST_Decl::NT_sequence;
6769 $<ntval>$ = AST_Decl::NT_map;
6773 $<ntval>$ = AST_Decl::NT_interface;
6777 $<ntval>$ = AST_Decl::NT_valuetype;
6781 $<ntval>$ = AST_Decl::NT_enum;
6785 $<ntval>$ = AST_Decl::NT_except;
6787 | IDL_CONST const_type
6789 $<ntval>$ = AST_Decl::NT_const;
6790 t_param_const_type = $2;
6794 at_least_one_formal_parameter
6795 : formal_parameter formal_parameters
6799 ACE_NEW_RETURN ($2, FE_Utils::T_PARAMLIST_INFO, 1);
6802 $2->enqueue_head (*$1);
6806 // The param added above is always the last one parsed,
6807 // so we check for matches between sequence<T> & T here.
6808 ACE_CString bad_id =
6809 FE_Utils::check_for_seq_of_param (
6812 if (!bad_id.empty ())
6817 idl_global->err ()->mismatch_seq_of_param (bad_id.c_str ());
6826 : formal_parameters ',' formal_parameter
6830 ACE_NEW_RETURN ($1, FE_Utils::T_PARAMLIST_INFO, 1);
6833 $1->enqueue_tail (*$3);
6846 : formal_parameter_type IDENTIFIER
6850 FE_Utils::T_Param_Info,
6853 AST_Decl::NodeType nt = $1;
6857 ACE::strdelete ($2);
6860 if (nt == AST_Decl::NT_const)
6862 $$->const_type_ = t_param_const_type;
6863 $$->enum_const_type_decl_ =
6864 tao_enum_constant_decl;
6866 // Reset these values.
6867 t_param_const_type = AST_Expression::EV_none;
6868 tao_enum_constant_decl = 0;
6871 | IDL_SEQUENCE '<' IDENTIFIER '>' IDENTIFIER
6874 FE_Utils::T_Param_Info,
6877 $$->type_ = AST_Decl::NT_sequence;
6878 $$->seq_param_ref_ = $3;
6881 ACE::strdelete ($3);
6883 ACE::strdelete ($5);
6888 at_least_one_formal_parameter_name
6889 : formal_parameter_name formal_parameter_names
6891 ACE_NEW_RETURN ($$, UTL_StrList ($1, $2), 1);
6895 formal_parameter_names
6896 : formal_parameter_names ',' formal_parameter_name
6898 UTL_StrList *sl = 0;
6899 ACE_NEW_RETURN (sl, UTL_StrList ($3, 0), 1);
6917 formal_parameter_name
6921 UTL_String ($1, true),
6929 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeSeen);
6933 char *&id_value = $3;
6934 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeIDSeen);
6935 UTL_Scope *scope = idl_global->scopes ().top_non_null ();
6937 Identifier id (id_value);
6938 ACE::strdelete (id_value);
6941 UTL_ScopedName scoped_name (&id, 0);
6942 AST_PortType *porttype = idl_global->gen ()->create_porttype (
6944 scope->fe_add_porttype (porttype);
6945 $<dcval>$ = porttype;
6947 // Push it on the scopes stack.
6948 idl_global->scopes ().push (porttype);
6952 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeSqSeen);
6955 * NOTE: IDL4.2 spec has a different definition of what can go inside a
6958 at_least_one_port_export
6960 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeBodySeen);
6964 idl_global->set_parse_state (IDL_GlobalData::PS_PorttypeQsSeen);
6966 // Done with this port type - pop it off the scopes stack.
6967 idl_global->scopes ().pop ();
6973 at_least_one_port_export
6974 : port_exports at_least_one_annotation port_export
6976 AST_Annotation_Appls *&annotations = $2;
6977 AST_Decl *&node = $3;
6980 node->annotation_appls (*annotations);
6984 idl_global->err ()-> unsupported_warning (
6985 "Annotating this is not supported");
6989 | port_exports port_export
6993 : at_least_one_port_export
7002 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
7011 : IDL_PORT scoped_name IDENTIFIER
7013 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
7014 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7016 s->lookup_by_name ($2);
7017 AST_PortType *pt = 0;
7018 bool so_far_so_good = true;
7022 idl_global->err ()->lookup_error ($2);
7023 so_far_so_good = false;
7027 pt = dynamic_cast<AST_PortType*> (d);
7031 idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
7033 so_far_so_good = false;
7037 AST_Extended_Port *ep = 0;
7042 ACE::strdelete ($3);
7045 UTL_ScopedName sn (&id, 0);
7046 ep = idl_global->gen ()->create_extended_port (&sn, pt);
7047 s->fe_add_extended_port (ep);
7049 // Create (in the AST) the struct(s) and sequence(s)
7050 // needed for multiplex uses ports, if any.
7051 for (UTL_ScopeActiveIterator i (pt, UTL_Scope::IK_decls);
7057 AST_Uses *u = dynamic_cast<AST_Uses*> (d);
7059 if (u != 0 && u->is_multiple ())
7062 dynamic_cast<AST_Component*> (s);
7064 FE_Utils::create_uses_multiple_stuff (
7078 | IDL_MIRRORPORT scoped_name IDENTIFIER
7080 idl_global->set_parse_state (IDL_GlobalData::PS_MirrorPortDeclSeen);
7081 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7083 s->lookup_by_name ($2);
7084 AST_PortType *pt = 0;
7085 bool so_far_so_good = true;
7089 idl_global->err ()->lookup_error ($2);
7090 so_far_so_good = false;
7094 pt = dynamic_cast<AST_PortType*> (d);
7098 idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
7100 so_far_so_good = false;
7104 AST_Mirror_Port *mp = 0;
7109 ACE::strdelete ($3);
7112 UTL_ScopedName sn (&id, 0);
7113 mp = idl_global->gen ()->create_mirror_port (&sn, pt);
7114 s->fe_add_mirror_port (mp);
7125 at_least_one_actual_parameter
7126 : annotations_maybe actual_parameter actual_parameters
7131 FE_Utils::T_ARGLIST,
7136 $3->enqueue_head ($2);
7142 : actual_parameters ',' annotations_maybe actual_parameter
7147 FE_Utils::T_ARGLIST,
7152 $1->enqueue_tail ($4);
7164 // To avoid grammar conflicts with this LALR(1) parser,
7165 // we take advantage of the fact that an expression can
7166 // be a scoped name. At that lower level, we create an
7167 // expression containing the scoped name, and at a
7168 // higher lever, deduce that it's not supposed to be
7169 // a constant and look up the type to add to the template
7171 AST_Expression *ex = $1;
7172 UTL_ScopedName *sn = ex->n ();
7174 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7178 d = s->lookup_by_name (sn);
7182 idl_global->err ()->lookup_error (sn);
7187 AST_Decl::NodeType nt = d->node_type ();
7189 if (nt == AST_Decl::NT_enum_val)
7192 AST_Expression::EK_const);
7195 idl_global->gen ()->create_constant (
7209 AST_Expression::EK_const);
7212 idl_global->gen ()->create_constant (
7221 : connector_header connector_body
7230 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorSeen);
7232 annotations_maybe IDENTIFIER
7234 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorIDSeen);
7236 component_inheritance_spec
7238 UTL_Scope *s = idl_global->scopes ().top_non_null ();
7239 AST_Connector *parent = 0;
7240 bool so_far_so_good = true;
7243 ACE::strdelete ($4);
7246 UTL_ScopedName sn (&id, 0);
7251 s->lookup_by_name ($6);
7255 idl_global->err ()->lookup_error ($6);
7256 so_far_so_good = false;
7260 dynamic_cast<AST_Connector*> (d);
7264 idl_global->err ()->error1 (
7265 UTL_Error::EIDL_CONNECTOR_EXPECTED,
7268 so_far_so_good = false;
7279 idl_global->gen ()->create_connector (&sn,
7282 (void) s->fe_add_connector (c);
7284 // Push it on the scopes stack.
7285 idl_global->scopes ().push (c);
7295 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorSqSeen);
7299 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorBodySeen);
7303 idl_global->set_parse_state (IDL_GlobalData::PS_ConnectorQsSeen);
7305 // Done with this connector - pop it off the scope stack.
7306 idl_global->scopes ().pop ();
7311 : connector_exports connector_export
7318 idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
7322 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7326 idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
7330 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7334 idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
7338 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7340 | extended_port_decl
7342 idl_global->set_parse_state (IDL_GlobalData::PS_ExtendedPortDeclSeen);
7346 idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
7363 * Report an error situation discovered in a production
7366 tao_yyerror (const char *msg)
7368 ACE_ERROR ((LM_ERROR, "%C\n", msg));