stage3/print_datatypes_error.cc
changeset 778 44e02a88f1e7
parent 732 f6a46e29853b
child 827 e3800aff352c
equal deleted inserted replaced
777:e74a882c8d22 778:44e02a88f1e7
   396 	return NULL;
   396 	return NULL;
   397 }
   397 }
   398 
   398 
   399 void *print_datatypes_error_c::visit(integer_literal_c *symbol) {
   399 void *print_datatypes_error_c::visit(integer_literal_c *symbol) {
   400 	if (symbol->candidate_datatypes.size() == 0) {
   400 	if (symbol->candidate_datatypes.size() == 0) {
   401 		STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", elementary_type_c::to_string(symbol->type));
   401 		STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", get_datatype_info_c::get_id_str(symbol->type));
   402 	} else if (NULL == symbol->datatype) {
   402 	} else if (NULL == symbol->datatype) {
   403 		STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location.");
   403 		STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location.");
   404 	}
   404 	}
   405 	return NULL;
   405 	return NULL;
   406 }
   406 }
   407 
   407 
   408 void *print_datatypes_error_c::visit(real_literal_c *symbol) {
   408 void *print_datatypes_error_c::visit(real_literal_c *symbol) {
   409 	if (symbol->candidate_datatypes.size() == 0) {
   409 	if (symbol->candidate_datatypes.size() == 0) {
   410 		STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", elementary_type_c::to_string(symbol->type));
   410 		STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", get_datatype_info_c::get_id_str(symbol->type));
   411 	} else if (NULL == symbol->datatype) {
   411 	} else if (NULL == symbol->datatype) {
   412 		STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location.");
   412 		STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location.");
   413 	}
   413 	}
   414 	return NULL;
   414 	return NULL;
   415 }
   415 }
   416 
   416 
   417 void *print_datatypes_error_c::visit(bit_string_literal_c *symbol) {
   417 void *print_datatypes_error_c::visit(bit_string_literal_c *symbol) {
   418 	if (symbol->candidate_datatypes.size() == 0) {
   418 	if (symbol->candidate_datatypes.size() == 0) {
   419 		STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", elementary_type_c::to_string(symbol->type));
   419 		STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", get_datatype_info_c::get_id_str(symbol->type));
   420 	} else if (NULL == symbol->datatype) {
   420 	} else if (NULL == symbol->datatype) {
   421 		STAGE3_ERROR(4, symbol, symbol, "ANY_BIT data type not valid in this location.");
   421 		STAGE3_ERROR(4, symbol, symbol, "ANY_BIT data type not valid in this location.");
   422 	}
   422 	}
   423 	return NULL;
   423 	return NULL;
   424 }
   424 }
   425 
   425 
   426 void *print_datatypes_error_c::visit(boolean_literal_c *symbol) {
   426 void *print_datatypes_error_c::visit(boolean_literal_c *symbol) {
   427 	if (symbol->candidate_datatypes.size() == 0) {
   427 	if (symbol->candidate_datatypes.size() == 0) {
   428 		STAGE3_ERROR(0, symbol, symbol, "Value is not valid for %s data type.", elementary_type_c::to_string(symbol->type));
   428 		STAGE3_ERROR(0, symbol, symbol, "Value is not valid for %s data type.", get_datatype_info_c::get_id_str(symbol->type));
   429 	} else if (NULL == symbol->datatype) {
   429 	} else if (NULL == symbol->datatype) {
   430 		STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location.");
   430 		STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location.");
   431 	}
   431 	}
   432 	return NULL;
   432 	return NULL;
   433 }
   433 }