@@ -362,15 +362,27 @@ struct action<identifier>
362
362
}
363
363
else
364
364
{
365
- state[" enum_member_names" ] += scoped_identifier_name + " ;" ;
366
-
367
- if (state.count (" annotation_names" ) && !state[" annotation_names" ].empty ())
365
+ if (state.count (" parsing_annotation" ) && state[" parsing_annotation" ] == " true" )
366
+ {
367
+ // identifier is an annotation's name, and handled in action<scoped_name>. Do nothing
368
+ return ;
369
+ }
370
+ if (state.count (" parsing_annotation_params" ) && state[" parsing_annotation_params" ] == " true" )
371
+ {
372
+ // identifier is an annotation's parameter name, and handled in action<annotation_appl_param>. Do nothing
373
+ return ;
374
+ }
375
+ else
368
376
{
369
- state[" annotation_member_name " ] = identifier_name ;
370
- if (!ctx-> annotations (). update_pending_annotations (state ))
377
+ state[" enum_member_names " ] += scoped_identifier_name + " ; " ;
378
+ if (state. count ( " annotation_names " ) && !state[ " annotation_names " ]. empty ( ))
371
379
{
372
- EPROSIMA_LOG_ERROR (IDLPARSER, " Error annotating enum member" );
373
- return ;
380
+ state[" annotation_member_name" ] = identifier_name;
381
+ if (!ctx->annotations ().update_pending_annotations (state))
382
+ {
383
+ EPROSIMA_LOG_ERROR (IDLPARSER, " Error annotating enum member" );
384
+ return ;
385
+ }
374
386
}
375
387
}
376
388
}
@@ -1901,7 +1913,7 @@ struct action<enum_dcl>
1901
1913
1902
1914
if (RETCODE_OK != builder->add_member (member_descriptor))
1903
1915
{
1904
- EPROSIMA_LOG_ERROR (IDLPARSER, " Error adding member to union : " << scoped_enum_name
1916
+ EPROSIMA_LOG_ERROR (IDLPARSER, " Error adding member to enum : " << scoped_enum_name
1905
1917
<< " , member: " << member_name);
1906
1918
return ;
1907
1919
}
@@ -1995,7 +2007,6 @@ struct action<struct_def>
1995
2007
1996
2008
}
1997
2009
cleanup_guard{state, ctx};
1998
-
1999
2010
auto module = ctx->modules ().current ();
2000
2011
const std::string scoped_struct_name = module ->create_scoped_name (state[" struct_name" ]);
2001
2012
@@ -2703,6 +2714,36 @@ struct action<annotation_begin>
2703
2714
2704
2715
};
2705
2716
2717
+ template <>
2718
+ struct action <annotation_param_context_begin>
2719
+ {
2720
+ template <typename Input>
2721
+ static void apply (
2722
+ const Input& /* in*/ ,
2723
+ Context* /* ctx*/ ,
2724
+ std::map<std::string, std::string>& state,
2725
+ std::vector<traits<DynamicData>::ref_type>& /* operands*/ )
2726
+ {
2727
+ state[" parsing_annotation_params" ] = " true" ;
2728
+ }
2729
+ };
2730
+
2731
+ template <>
2732
+ struct action <annotation_param_context_end>
2733
+ {
2734
+ template <typename Input>
2735
+ static void apply (
2736
+ const Input& /* in*/ ,
2737
+ Context* /* ctx*/ ,
2738
+ std::map<std::string, std::string>& state,
2739
+ std::vector<traits<DynamicData>::ref_type>& /* operands*/ )
2740
+ {
2741
+ assert (state.count (" parsing_annotation_params" ));
2742
+ state.erase (" parsing_annotation_params" );
2743
+ }
2744
+ };
2745
+
2746
+
2706
2747
template <>
2707
2748
struct action <annotation_appl_params>
2708
2749
{
0 commit comments