diff -r da78d0d93c75 -r 66cd5d9893dd absyntax_utils/search_constant_type.cc --- a/absyntax_utils/search_constant_type.cc Mon Jun 27 18:01:43 2011 +0200 +++ b/absyntax_utils/search_constant_type.cc Tue Jun 28 19:03:15 2011 +0200 @@ -41,8 +41,16 @@ */ +#include "../util/symtable.hh" #include "search_constant_type.hh" +/* A symbol table with all values declared for enumerated type... */ +/* Note that if the value is defined multiple times the value + * is the null pointer. + */ +extern symbol_c null_symbol4; +extern symtable_c enumerated_value_symtable; + #define ERROR error_exit(__FILE__,__LINE__) /* function defined in main.cc */ extern void error_exit(const char *file_name, int line_no); @@ -117,6 +125,18 @@ void *search_constant_type_c::visit(date_literal_c *symbol) {ERROR; return NULL;} /* this member function should never be called. */ void *search_constant_type_c::visit(date_and_time_c *symbol) {return (void *)(symbol->type_name);} +/********************************/ +/* B 1.3.3 - Derived data types */ +/********************************/ +void *search_constant_type_c::visit(enumerated_value_c *symbol) { + if (symbol->type != NULL) + return (void *)(symbol->type); + + symbol_c *value_type = enumerated_value_symtable.find_value(symbol->value); + if (value_type == enumerated_value_symtable.end_value()) ERROR; + + return (void *)value_type; +} real_type_name_c search_constant_type_c::real_type_name; sint_type_name_c search_constant_type_c::sint_type_name;