480 } |
480 } |
481 |
481 |
482 void *visit(equ_expression_c *symbol) { |
482 void *visit(equ_expression_c *symbol) { |
483 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
483 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
484 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
484 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
485 if (!search_expression_type->is_same_type(left_type, right_type)) |
485 // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! |
486 ERROR; |
|
487 if (search_expression_type->is_time_type(left_type) || |
486 if (search_expression_type->is_time_type(left_type) || |
488 search_expression_type->is_string_type(left_type)) |
487 search_expression_type->is_string_type(left_type)) |
489 return print_compare_function("EQ_", left_type, symbol->l_exp, symbol->r_exp); |
488 return print_compare_function("EQ_", left_type, symbol->l_exp, symbol->r_exp); |
490 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
489 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
491 } |
490 } |
492 |
491 |
493 void *visit(notequ_expression_c *symbol) { |
492 void *visit(notequ_expression_c *symbol) { |
494 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
493 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
495 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
494 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
496 if (!search_expression_type->is_same_type(left_type, right_type)) |
495 // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! |
497 ERROR; |
|
498 if (search_expression_type->is_time_type(left_type) || |
496 if (search_expression_type->is_time_type(left_type) || |
499 search_expression_type->is_string_type(left_type)) |
497 search_expression_type->is_string_type(left_type)) |
500 return print_compare_function("NE_", left_type, symbol->l_exp, symbol->r_exp); |
498 return print_compare_function("NE_", left_type, symbol->l_exp, symbol->r_exp); |
501 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
499 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
502 } |
500 } |
503 |
501 |
504 void *visit(lt_expression_c *symbol) { |
502 void *visit(lt_expression_c *symbol) { |
505 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
503 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
506 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
504 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
507 if (!search_expression_type->is_same_type(left_type, right_type)) |
505 // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! |
508 ERROR; |
|
509 if (search_expression_type->is_time_type(left_type) || |
506 if (search_expression_type->is_time_type(left_type) || |
510 search_expression_type->is_string_type(left_type)) |
507 search_expression_type->is_string_type(left_type)) |
511 return print_compare_function("LT_", left_type, symbol->l_exp, symbol->r_exp); |
508 return print_compare_function("LT_", left_type, symbol->l_exp, symbol->r_exp); |
512 if (!search_base_type.type_is_enumerated(left_type)) |
509 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
513 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
|
514 ERROR; |
|
515 return NULL; |
|
516 } |
510 } |
517 |
511 |
518 void *visit(gt_expression_c *symbol) { |
512 void *visit(gt_expression_c *symbol) { |
519 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
513 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
520 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
514 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
521 if (!search_expression_type->is_same_type(left_type, right_type)) |
515 // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! |
522 ERROR; |
|
523 if (search_expression_type->is_time_type(left_type) || |
516 if (search_expression_type->is_time_type(left_type) || |
524 search_expression_type->is_string_type(left_type)) |
517 search_expression_type->is_string_type(left_type)) |
525 return print_compare_function("GT_", left_type, symbol->l_exp, symbol->r_exp); |
518 return print_compare_function("GT_", left_type, symbol->l_exp, symbol->r_exp); |
526 if (!search_base_type.type_is_enumerated(left_type)) |
519 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
527 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
|
528 ERROR; |
|
529 return NULL; |
|
530 } |
520 } |
531 |
521 |
532 void *visit(le_expression_c *symbol) { |
522 void *visit(le_expression_c *symbol) { |
533 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
523 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
534 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
524 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
535 if (!search_expression_type->is_same_type(left_type, right_type)) |
525 // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! |
536 ERROR; |
|
537 if (search_expression_type->is_time_type(left_type) || |
526 if (search_expression_type->is_time_type(left_type) || |
538 search_expression_type->is_string_type(left_type)) |
527 search_expression_type->is_string_type(left_type)) |
539 return print_compare_function("LE_", left_type, symbol->l_exp, symbol->r_exp); |
528 return print_compare_function("LE_", left_type, symbol->l_exp, symbol->r_exp); |
540 if (!search_base_type.type_is_enumerated(left_type)) |
529 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
541 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
|
542 ERROR; |
|
543 return NULL; |
|
544 } |
530 } |
545 |
531 |
546 void *visit(ge_expression_c *symbol) { |
532 void *visit(ge_expression_c *symbol) { |
547 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
533 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
548 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
534 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
549 if (!search_expression_type->is_same_type(left_type, right_type)) |
535 // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! |
550 ERROR; |
|
551 if (search_expression_type->is_time_type(left_type) || |
536 if (search_expression_type->is_time_type(left_type) || |
552 search_expression_type->is_string_type(left_type)) |
537 search_expression_type->is_string_type(left_type)) |
553 return print_compare_function("GE_", left_type, symbol->l_exp, symbol->r_exp); |
538 return print_compare_function("GE_", left_type, symbol->l_exp, symbol->r_exp); |
554 if (!search_base_type.type_is_enumerated(left_type)) |
539 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
555 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
|
556 ERROR; |
|
557 return NULL; |
|
558 } |
540 } |
559 |
541 |
560 void *visit(add_expression_c *symbol) { |
542 void *visit(add_expression_c *symbol) { |
561 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
543 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
562 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
544 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |