stage3/print_datatypes_error.cc
changeset 732 f6a46e29853b
parent 718 a9f8cc778444
child 778 44e02a88f1e7
equal deleted inserted replaced
731:151f0b57b4e4 732:f6a46e29853b
   534 			*/
   534 			*/
   535 	}
   535 	}
   536 	return NULL;
   536 	return NULL;
   537 }
   537 }
   538 
   538 
   539 void *print_datatypes_error_c::visit(data_type_declaration_c *symbol) {
       
   540 	// TODO !!!
       
   541 	/* for the moment we must return NULL so semantic analysis of remaining code is not interrupted! */
       
   542 	return NULL;
       
   543 }
       
   544 
   539 
   545 void *print_datatypes_error_c::visit(enumerated_value_c *symbol) {
   540 void *print_datatypes_error_c::visit(enumerated_value_c *symbol) {
   546 	if (symbol->candidate_datatypes.size() == 0)
   541 	if (symbol->candidate_datatypes.size() == 0)
   547 		STAGE3_ERROR(0, symbol, symbol, "Ambiguous enumerate value or Variable not declared in this scope.");
   542 		STAGE3_ERROR(0, symbol, symbol, "Ambiguous enumerate value or Variable not declared in this scope.");
   548 	return NULL;
   543 	return NULL;
   646 /*********************/
   641 /*********************/
   647 /* B 1.5.1 Functions */
   642 /* B 1.5.1 Functions */
   648 /*********************/
   643 /*********************/
   649 void *print_datatypes_error_c::visit(function_declaration_c *symbol) {
   644 void *print_datatypes_error_c::visit(function_declaration_c *symbol) {
   650 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   645 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   651 	/* We do not check for data type errors in variable declarations, Skip this for now... */
   646  	symbol->var_declarations_list->accept(*this);
   652 // 	symbol->var_declarations_list->accept(*this);
       
   653 	if (debug) printf("Print error data types list in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
   647 	if (debug) printf("Print error data types list in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
   654 	il_parenthesis_level = 0;
   648 	il_parenthesis_level = 0;
   655 	il_error = false;
   649 	il_error = false;
   656 	symbol->function_body->accept(*this);
   650 	symbol->function_body->accept(*this);
   657 	delete search_varfb_instance_type;
   651 	delete search_varfb_instance_type;
   662 /***************************/
   656 /***************************/
   663 /* B 1.5.2 Function blocks */
   657 /* B 1.5.2 Function blocks */
   664 /***************************/
   658 /***************************/
   665 void *print_datatypes_error_c::visit(function_block_declaration_c *symbol) {
   659 void *print_datatypes_error_c::visit(function_block_declaration_c *symbol) {
   666 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   660 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   667 	/* We do not check for data type errors in variable declarations, Skip this for now... */
   661  	symbol->var_declarations->accept(*this);
   668 // 	symbol->var_declarations->accept(*this);
       
   669 	if (debug) printf("Print error data types list in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
   662 	if (debug) printf("Print error data types list in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
   670 	il_parenthesis_level = 0;
   663 	il_parenthesis_level = 0;
   671 	il_error = false;
   664 	il_error = false;
   672 	symbol->fblock_body->accept(*this);
   665 	symbol->fblock_body->accept(*this);
   673 	delete search_varfb_instance_type;
   666 	delete search_varfb_instance_type;
   678 /**********************/
   671 /**********************/
   679 /* B 1.5.3 - Programs */
   672 /* B 1.5.3 - Programs */
   680 /**********************/
   673 /**********************/
   681 void *print_datatypes_error_c::visit(program_declaration_c *symbol) {
   674 void *print_datatypes_error_c::visit(program_declaration_c *symbol) {
   682 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   675 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   683 	/* We do not check for data type errors in variable declarations, Skip this for now... */
       
   684 	symbol->var_declarations->accept(*this);
   676 	symbol->var_declarations->accept(*this);
   685 	if (debug) printf("Print error data types list in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
   677 	if (debug) printf("Print error data types list in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
   686 	il_parenthesis_level = 0;
   678 	il_parenthesis_level = 0;
   687 	il_error = false;
   679 	il_error = false;
   688 	symbol->function_block_body->accept(*this);
   680 	symbol->function_block_body->accept(*this);