Acceept structure_element_declaration_c symbol as a possible (non base type) data type
authorMario de Sousa <msousa@fe.up.pt>
Tue, 04 Apr 2017 15:28:49 +0100
changeset 1045 428e0748b5cd
parent 1044 519a30dbf96c
child 1046 292b7dcf14f6
Acceept structure_element_declaration_c symbol as a possible (non base type) data type
absyntax_utils/search_base_type.cc
--- a/absyntax_utils/search_base_type.cc	Tue Apr 04 15:24:28 2017 +0100
+++ b/absyntax_utils/search_base_type.cc	Tue Apr 04 15:28:49 2017 +0100
@@ -255,7 +255,7 @@
 }
 
 /*  signed_integer DOTDOT signed_integer */
-void *search_base_type_c::visit(subrange_c *symbol)                                     {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(subrange_c *symbol)                           {ERROR; return NULL;} /* should never get called... */
 
 /*  enumerated_type_name ':' enumerated_spec_init */
 void *search_base_type_c::visit(enumerated_type_declaration_c *symbol) {
@@ -293,7 +293,7 @@
 
 /* enumerated_type_name '#' identifier */
 // SYM_REF2(enumerated_value_c, type, value)
-void *search_base_type_c::visit(enumerated_value_c *symbol)                             {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(enumerated_value_c *symbol)                   {ERROR; return NULL;} /* should never get called... */
 
 /*  identifier ':' array_spec_init */
 void *search_base_type_c::visit(array_type_declaration_c *symbol) {
@@ -312,20 +312,20 @@
 }
 
 /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */
-void *search_base_type_c::visit(array_specification_c *symbol)                          {return (void *)symbol;}
+void *search_base_type_c::visit(array_specification_c *symbol)                {return (void *)symbol;}
 
 /* helper symbol for array_specification */
 /* array_subrange_list ',' subrange */
-void *search_base_type_c::visit(array_subrange_list_c *symbol)                          {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(array_subrange_list_c *symbol)                {ERROR; return NULL;} /* should never get called... */
 
 /* array_initialization:  '[' array_initial_elements_list ']' */
 /* helper symbol for array_initialization */
 /* array_initial_elements_list ',' array_initial_elements */
-void *search_base_type_c::visit(array_initial_elements_list_c *symbol)                  {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(array_initial_elements_list_c *symbol)        {ERROR; return NULL;} /* should never get called... */
 
 /* integer '(' [array_initial_element] ')' */
 /* array_initial_element may be NULL ! */
-void *search_base_type_c::visit(array_initial_elements_c *symbol)                       {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(array_initial_elements_c *symbol)             {ERROR; return NULL;} /* should never get called... */
 
 /*  structure_type_name ':' structure_specification */
 /* NOTE: structure_specification will point to either a
@@ -339,31 +339,27 @@
 }
 
 /*  var1_list ':' structure_type_name */
-void *search_base_type_c::visit(structured_var_declaration_c *symbol) {
-	return symbol;
-}
+void *search_base_type_c::visit(structured_var_declaration_c *symbol)         {return symbol;}
 
 /* structure_type_name ASSIGN structure_initialization */
 /* structure_initialization may be NULL ! */
-void *search_base_type_c::visit(initialized_structure_c *symbol)	{
-  return symbol->structure_type_name->accept(*this);
-}
+void *search_base_type_c::visit(initialized_structure_c *symbol)              {return symbol->structure_type_name->accept(*this);}
 
 /* helper symbol for structure_declaration */
 /* structure_declaration:  STRUCT structure_element_declaration_list END_STRUCT */
 /* structure_element_declaration_list structure_element_declaration ';' */
-void *search_base_type_c::visit(structure_element_declaration_list_c *symbol)           {return (void *)symbol;}
+void *search_base_type_c::visit(structure_element_declaration_list_c *symbol) {return (void *)symbol;}
 
 /*  structure_element_name ':' *_spec_init */
-void *search_base_type_c::visit(structure_element_declaration_c *symbol)                {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(structure_element_declaration_c *symbol)      {return symbol->spec_init->accept(*this);}
 
 /* helper symbol for structure_initialization */
 /* structure_initialization: '(' structure_element_initialization_list ')' */
 /* structure_element_initialization_list ',' structure_element_initialization */
-void *search_base_type_c::visit(structure_element_initialization_list_c *symbol)        {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(structure_element_initialization_list_c *symbol) {ERROR; return NULL;} /* should never get called... */
 
 /*  structure_element_name ASSIGN value */
-void *search_base_type_c::visit(structure_element_initialization_c *symbol)             {ERROR; return NULL;} /* should never get called... */
+void *search_base_type_c::visit(structure_element_initialization_c *symbol)   {ERROR; return NULL;} /* should never get called... */
 
 /*  string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */
 /*
@@ -372,7 +368,7 @@
 					string_type_declaration_size,
 					string_type_declaration_init) // may be == NULL!
 */
-void *search_base_type_c::visit(string_type_declaration_c *symbol)                      {return (void *)symbol;}
+void *search_base_type_c::visit(string_type_declaration_c *symbol)            {return (void *)symbol;}
 
 
 /*  function_block_type_name ASSIGN structure_initialization */
@@ -386,15 +382,13 @@
 
 /* ref_spec:  REF_TO (non_generic_type_name | function_block_type_name) */
 // SYM_REF1(ref_spec_c, type_name)
-void *search_base_type_c::visit(ref_spec_c *symbol)                                     {return (void *)symbol;}
+void *search_base_type_c::visit(ref_spec_c *symbol)                           {return (void *)symbol;}
 
 /* For the moment, we do not support initialising reference data types */
 /* ref_spec_init: ref_spec [ ASSIGN ref_initialization ]; */ 
 /* NOTE: ref_initialization may be NULL!! */
 // SYM_REF2(ref_spec_init_c, ref_spec, ref_initialization)
-void *search_base_type_c::visit(ref_spec_init_c *symbol) {
-  return symbol->ref_spec->accept(*this);
-}
+void *search_base_type_c::visit(ref_spec_init_c *symbol)                      {return symbol->ref_spec->accept(*this);}
 
 /* ref_type_decl: identifier ':' ref_spec_init */
 // SYM_REF2(ref_type_decl_c, ref_type_name, ref_spec_init)
@@ -410,9 +404,7 @@
 /*****************************/
 /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
 // SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body)
-void *search_base_type_c::visit(function_block_declaration_c *symbol)                   {
-	return (void *)symbol;
-}
+void *search_base_type_c::visit(function_block_declaration_c *symbol)         {return (void *)symbol;}