From 99b33004d366439aa592692cd2ae8ccc0683451e Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Mon, 1 Oct 2018 16:57:35 -0500 Subject: tao_idl: Simple Annotations in AST For now only simple annotations on member fields are put into the AST and dumped when "-d" is used. --- TAO/TAO_IDL/fe/idl.ypp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'TAO/TAO_IDL/fe/idl.ypp') diff --git a/TAO/TAO_IDL/fe/idl.ypp b/TAO/TAO_IDL/fe/idl.ypp index 5f3461df675..4dd5160e8e6 100644 --- a/TAO/TAO_IDL/fe/idl.ypp +++ b/TAO/TAO_IDL/fe/idl.ypp @@ -120,6 +120,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_visitor_tmpl_module_inst.h" #include "ast_visitor_tmpl_module_ref.h" #include "ast_visitor_context.h" +#include "ast_annotation.h" #include "fe_declarator.h" #include "fe_interface_header.h" @@ -185,6 +186,7 @@ AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none; FE_Utils::T_Param_Info *pival; /* Template interface param */ FE_Utils::T_PARAMLIST_INFO *plval; /* List of template params */ FE_Utils::T_ARGLIST *alval; /* List of template args */ + Annotations *annotations; } /* @@ -355,6 +357,8 @@ AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none; %type formal_parameter_name %type actual_parameters at_least_one_actual_parameter + +%type annotations %% /* @@ -363,7 +367,7 @@ AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none; start : definitions ; definitions - : definitions annotations definition + : definitions definition | /* EMPTY */ ; @@ -380,7 +384,7 @@ definition ; at_least_one_definition - : definitions annotations definition + : definitions definition ; fixed_definition @@ -2361,7 +2365,7 @@ annotation_dcl ACE_DEBUG ((LM_WARNING, ACE_TEXT ("WARNING: in %C on line %d:\n") ACE_TEXT ("Declaring annotations is not supported at the ") - ACE_TEXT ("momment, it is being ignored!\n"), + ACE_TEXT ("momment, this annotation is being ignored!\n"), idl_global->filename ()->get_string (), idl_global->lineno () )); @@ -2422,14 +2426,26 @@ annotations idl_global->lineno (), idl_global->idl_version_.to_string () )); - idl_global->err()->syntax_error (idl_global->parse_state()); + idl_global->err ()->syntax_error (idl_global->parse_state ()); } + + Annotations *annotations = $1; + AST_Annotation *annotation = + idl_global->gen ()->create_annotation ($2); + annotations->insert_head (annotation); + $$ = annotations; } | /* EMPTY */ + { + $$ = new Annotations (); + } ; annotation_appl : IDL_ANNOTATION_SYMBOL scoped_name annotation_appl_params_maybe + { + $$ = $2; + } ; annotation_appl_params_maybe @@ -3057,6 +3073,7 @@ member_i : d->name (), $0 ); + f->annotations ($1); (void) s->fe_add_field (f); } } -- cgit v1.2.1