absyntax_utils/get_datatype_info.cc
changeset 1041 56ebe2a31b5b
parent 1016 91bef6704b44
equal deleted inserted replaced
1040:e8563dcaefca 1041:56ebe2a31b5b
   360     /* structure_declaration:  STRUCT structure_element_declaration_list END_STRUCT */
   360     /* structure_declaration:  STRUCT structure_element_declaration_list END_STRUCT */
   361     /* structure_element_declaration_list structure_element_declaration ';' */
   361     /* structure_element_declaration_list structure_element_declaration ';' */
   362     void *visit(structure_element_declaration_list_c *symbol) {
   362     void *visit(structure_element_declaration_list_c *symbol) {
   363       /* now search the structure declaration */
   363       /* now search the structure declaration */
   364       for(int i = 0; i < symbol->n; i++) {
   364       for(int i = 0; i < symbol->n; i++) {
   365         void *tmp = symbol->elements[i]->accept(*this);
   365         void *tmp = symbol->get_element(i)->accept(*this);
   366         if (NULL != tmp) return tmp;
   366         if (NULL != tmp) return tmp;
   367       }
   367       }
   368       return NULL; // not found!!
   368       return NULL; // not found!!
   369     }  
   369     }  
   370 
   370 
   711   if (subrange_list_1->n != subrange_list_2->n)
   711   if (subrange_list_1->n != subrange_list_2->n)
   712     return false;
   712     return false;
   713   
   713   
   714   // comparison of each subrange start and end elements
   714   // comparison of each subrange start and end elements
   715   for (int i = 0; i < subrange_list_1->n; i++) {
   715   for (int i = 0; i < subrange_list_1->n; i++) {
   716     subrange_c *subrange_1 = dynamic_cast<subrange_c *>(subrange_list_1->elements[i]);
   716     subrange_c *subrange_1 = dynamic_cast<subrange_c *>(subrange_list_1->get_element(i));
   717     subrange_c *subrange_2 = dynamic_cast<subrange_c *>(subrange_list_2->elements[i]);
   717     subrange_c *subrange_2 = dynamic_cast<subrange_c *>(subrange_list_2->get_element(i));
   718     if ((NULL == subrange_1) || (NULL == subrange_2)) ERROR;
   718     if ((NULL == subrange_1) || (NULL == subrange_2)) ERROR;
   719     
   719     
   720     /* check whether the subranges have the same values, using the result of the constant folding agorithm.
   720     /* check whether the subranges have the same values, using the result of the constant folding agorithm.
   721      * This method has the drawback that it inserts a dependency on having to run the constant folding algorithm before
   721      * This method has the drawback that it inserts a dependency on having to run the constant folding algorithm before
   722      *  the get_datatype_info_c::is_type_equal() method is called.
   722      *  the get_datatype_info_c::is_type_equal() method is called.