334 /* B 1.2.1 - Numeric Literals */ |
335 /* B 1.2.1 - Numeric Literals */ |
335 /******************************/ |
336 /******************************/ |
336 void *print_datatypes_error_c::visit(real_c *symbol) { |
337 void *print_datatypes_error_c::visit(real_c *symbol) { |
337 if (symbol->candidate_datatypes.size() == 0) { |
338 if (symbol->candidate_datatypes.size() == 0) { |
338 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_REAL data type."); |
339 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_REAL data type."); |
339 } else if (NULL == symbol->datatype) { |
340 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
340 STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location."); |
341 STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location."); |
341 } |
342 } |
342 return NULL; |
343 return NULL; |
343 } |
344 } |
344 |
345 |
345 void *print_datatypes_error_c::visit(integer_c *symbol) { |
346 void *print_datatypes_error_c::visit(integer_c *symbol) { |
346 if (symbol->candidate_datatypes.size() == 0) { |
347 if (symbol->candidate_datatypes.size() == 0) { |
347 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
348 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
348 } else if (NULL == symbol->datatype) { |
349 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
349 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
350 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
350 } |
351 } |
351 return NULL; |
352 return NULL; |
352 } |
353 } |
353 |
354 |
354 void *print_datatypes_error_c::visit(neg_real_c *symbol) { |
355 void *print_datatypes_error_c::visit(neg_real_c *symbol) { |
355 if (symbol->candidate_datatypes.size() == 0) { |
356 if (symbol->candidate_datatypes.size() == 0) { |
356 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_REAL data type."); |
357 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_REAL data type."); |
357 } else if (NULL == symbol->datatype) { |
358 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
358 STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location."); |
359 STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location."); |
359 } |
360 } |
360 return NULL; |
361 return NULL; |
361 } |
362 } |
362 |
363 |
363 void *print_datatypes_error_c::visit(neg_integer_c *symbol) { |
364 void *print_datatypes_error_c::visit(neg_integer_c *symbol) { |
364 if (symbol->candidate_datatypes.size() == 0) { |
365 if (symbol->candidate_datatypes.size() == 0) { |
365 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
366 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
366 } else if (NULL == symbol->datatype) { |
367 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
367 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
368 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
368 } |
369 } |
369 return NULL; |
370 return NULL; |
370 } |
371 } |
371 |
372 |
372 void *print_datatypes_error_c::visit(binary_integer_c *symbol) { |
373 void *print_datatypes_error_c::visit(binary_integer_c *symbol) { |
373 if (symbol->candidate_datatypes.size() == 0) { |
374 if (symbol->candidate_datatypes.size() == 0) { |
374 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
375 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
375 } else if (NULL == symbol->datatype) { |
376 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
376 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
377 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
377 } |
378 } |
378 return NULL; |
379 return NULL; |
379 } |
380 } |
380 |
381 |
381 void *print_datatypes_error_c::visit(octal_integer_c *symbol) { |
382 void *print_datatypes_error_c::visit(octal_integer_c *symbol) { |
382 if (symbol->candidate_datatypes.size() == 0) { |
383 if (symbol->candidate_datatypes.size() == 0) { |
383 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
384 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
384 } else if (NULL == symbol->datatype) { |
385 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
385 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
386 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
386 } |
387 } |
387 return NULL; |
388 return NULL; |
388 } |
389 } |
389 |
390 |
390 void *print_datatypes_error_c::visit(hex_integer_c *symbol) { |
391 void *print_datatypes_error_c::visit(hex_integer_c *symbol) { |
391 if (symbol->candidate_datatypes.size() == 0) { |
392 if (symbol->candidate_datatypes.size() == 0) { |
392 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
393 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for ANY_INT data type."); |
393 } else if (NULL == symbol->datatype) { |
394 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
394 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
395 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
395 } |
396 } |
396 return NULL; |
397 return NULL; |
397 } |
398 } |
398 |
399 |
399 void *print_datatypes_error_c::visit(integer_literal_c *symbol) { |
400 void *print_datatypes_error_c::visit(integer_literal_c *symbol) { |
400 if (symbol->candidate_datatypes.size() == 0) { |
401 if (symbol->candidate_datatypes.size() == 0) { |
401 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", get_datatype_info_c::get_id_str(symbol->type)); |
402 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) { |
403 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
403 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
404 STAGE3_ERROR(4, symbol, symbol, "ANY_INT data type not valid in this location."); |
404 } |
405 } |
405 return NULL; |
406 return NULL; |
406 } |
407 } |
407 |
408 |
408 void *print_datatypes_error_c::visit(real_literal_c *symbol) { |
409 void *print_datatypes_error_c::visit(real_literal_c *symbol) { |
409 if (symbol->candidate_datatypes.size() == 0) { |
410 if (symbol->candidate_datatypes.size() == 0) { |
410 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", get_datatype_info_c::get_id_str(symbol->type)); |
411 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) { |
412 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
412 STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location."); |
413 STAGE3_ERROR(4, symbol, symbol, "ANY_REAL data type not valid in this location."); |
413 } |
414 } |
414 return NULL; |
415 return NULL; |
415 } |
416 } |
416 |
417 |
417 void *print_datatypes_error_c::visit(bit_string_literal_c *symbol) { |
418 void *print_datatypes_error_c::visit(bit_string_literal_c *symbol) { |
418 if (symbol->candidate_datatypes.size() == 0) { |
419 if (symbol->candidate_datatypes.size() == 0) { |
419 STAGE3_ERROR(0, symbol, symbol, "Numerical value exceeds range for %s data type.", get_datatype_info_c::get_id_str(symbol->type)); |
420 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) { |
421 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
421 STAGE3_ERROR(4, symbol, symbol, "ANY_BIT data type not valid in this location."); |
422 STAGE3_ERROR(4, symbol, symbol, "ANY_BIT data type not valid in this location."); |
422 } |
423 } |
423 return NULL; |
424 return NULL; |
424 } |
425 } |
425 |
426 |
426 void *print_datatypes_error_c::visit(boolean_literal_c *symbol) { |
427 void *print_datatypes_error_c::visit(boolean_literal_c *symbol) { |
427 if (symbol->candidate_datatypes.size() == 0) { |
428 if (symbol->candidate_datatypes.size() == 0) { |
428 STAGE3_ERROR(0, symbol, symbol, "Value is not valid for %s data type.", get_datatype_info_c::get_id_str(symbol->type)); |
429 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) { |
430 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
430 STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location."); |
431 STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location."); |
431 } |
432 } |
432 return NULL; |
433 return NULL; |
433 } |
434 } |
434 |
435 |
435 void *print_datatypes_error_c::visit(boolean_true_c *symbol) { |
436 void *print_datatypes_error_c::visit(boolean_true_c *symbol) { |
436 if (symbol->candidate_datatypes.size() == 0) { |
437 if (symbol->candidate_datatypes.size() == 0) { |
437 STAGE3_ERROR(0, symbol, symbol, "Value is not valid for ANY_BOOL data type."); |
438 STAGE3_ERROR(0, symbol, symbol, "Value is not valid for ANY_BOOL data type."); |
438 } else if (NULL == symbol->datatype) { |
439 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
439 STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location."); |
440 STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location."); |
440 } |
441 } |
441 return NULL; |
442 return NULL; |
442 } |
443 } |
443 |
444 |
444 void *print_datatypes_error_c::visit(boolean_false_c *symbol) { |
445 void *print_datatypes_error_c::visit(boolean_false_c *symbol) { |
445 if (symbol->candidate_datatypes.size() == 0) { |
446 if (symbol->candidate_datatypes.size() == 0) { |
446 STAGE3_ERROR(0, symbol, symbol, "Value is not valid for ANY_BOOL data type."); |
447 STAGE3_ERROR(0, symbol, symbol, "Value is not valid for ANY_BOOL data type."); |
447 } else if (NULL == symbol->datatype) { |
448 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
448 STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location."); |
449 STAGE3_ERROR(4, symbol, symbol, "ANY_BOOL data type not valid in this location."); |
449 } |
450 } |
450 return NULL; |
451 return NULL; |
451 } |
452 } |
452 |
453 |
490 /* B 1.2.3.2 - Time of day and Date */ |
491 /* B 1.2.3.2 - Time of day and Date */ |
491 /************************************/ |
492 /************************************/ |
492 void *print_datatypes_error_c::visit(time_of_day_c *symbol) { |
493 void *print_datatypes_error_c::visit(time_of_day_c *symbol) { |
493 if (symbol->candidate_datatypes.size() == 0) { |
494 if (symbol->candidate_datatypes.size() == 0) { |
494 STAGE3_ERROR(0, symbol, symbol, "Invalid syntax for TOD data type."); |
495 STAGE3_ERROR(0, symbol, symbol, "Invalid syntax for TOD data type."); |
495 } else if (NULL == symbol->datatype) { |
496 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
496 STAGE3_ERROR(4, symbol, symbol, "TOD data type not valid in this location."); |
497 STAGE3_ERROR(4, symbol, symbol, "TOD data type not valid in this location."); |
497 } |
498 } |
498 return NULL; |
499 return NULL; |
499 } |
500 } |
500 |
501 |
501 void *print_datatypes_error_c::visit(date_c *symbol) { |
502 void *print_datatypes_error_c::visit(date_c *symbol) { |
502 if (symbol->candidate_datatypes.size() == 0) { |
503 if (symbol->candidate_datatypes.size() == 0) { |
503 STAGE3_ERROR(0, symbol, symbol, "Invalid syntax for DATE data type."); |
504 STAGE3_ERROR(0, symbol, symbol, "Invalid syntax for DATE data type."); |
504 } else if (NULL == symbol->datatype) { |
505 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
505 STAGE3_ERROR(4, symbol, symbol, "DATE data type not valid in this location."); |
506 STAGE3_ERROR(4, symbol, symbol, "DATE data type not valid in this location."); |
506 } |
507 } |
507 return NULL; |
508 return NULL; |
508 } |
509 } |
509 |
510 |
510 void *print_datatypes_error_c::visit(date_and_time_c *symbol) { |
511 void *print_datatypes_error_c::visit(date_and_time_c *symbol) { |
511 if (symbol->candidate_datatypes.size() == 0) { |
512 if (symbol->candidate_datatypes.size() == 0) { |
512 STAGE3_ERROR(0, symbol, symbol, "Invalid syntax for DT data type."); |
513 STAGE3_ERROR(0, symbol, symbol, "Invalid syntax for DT data type."); |
513 } else if (NULL == symbol->datatype) { |
514 } else if (!get_datatype_info_c::is_type_valid(symbol->datatype)) { |
514 STAGE3_ERROR(4, symbol, symbol, "DT data type not valid in this location."); |
515 STAGE3_ERROR(4, symbol, symbol, "DT data type not valid in this location."); |
515 } |
516 } |
516 return NULL; |
517 return NULL; |
517 } |
518 } |
518 |
519 |
927 |
930 |
928 /*******************/ |
931 /*******************/ |
929 /* B 2.2 Operators */ |
932 /* B 2.2 Operators */ |
930 /*******************/ |
933 /*******************/ |
931 void *print_datatypes_error_c::print_binary_operator_errors(const char *il_operator, symbol_c *symbol, bool deprecated_operation) { |
934 void *print_datatypes_error_c::print_binary_operator_errors(const char *il_operator, symbol_c *symbol, bool deprecated_operation) { |
932 if ((symbol->candidate_datatypes.size() == 0) && (il_operand->candidate_datatypes.size() > 0)) { |
935 if (NULL == il_operand) { |
933 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for '%s' operator.", il_operator); |
936 STAGE3_ERROR(0, symbol, symbol, "Missing operand for %s operator.", il_operator); // message (a) |
934 } else if (NULL == symbol->datatype) { |
937 } else if ((symbol->candidate_datatypes.size() == 0) && (il_operand->candidate_datatypes.size() > 0)) { |
935 STAGE3_WARNING(symbol, symbol, "Result of '%s' operation is never used.", il_operator); |
938 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for '%s' operator.", il_operator); // message (b) |
|
939 } else if (NULL == symbol->datatype) { // do NOT use !get_datatype_info_c::is_type_valid() here! |
|
940 STAGE3_WARNING(symbol, symbol, "Result of '%s' operation is never used.", il_operator); // message (c) |
936 } else if (deprecated_operation) |
941 } else if (deprecated_operation) |
937 STAGE3_WARNING(symbol, symbol, "Deprecated operation for '%s' operator.", il_operator); |
942 STAGE3_WARNING(symbol, symbol, "Deprecated operation for '%s' operator.", il_operator); // message (d) |
938 return NULL; |
943 return NULL; |
939 } |
944 } |
940 |
945 |
941 |
946 |
942 void *print_datatypes_error_c::visit(LD_operator_c *symbol) { |
947 void *print_datatypes_error_c::visit( LD_operator_c *symbol) {return print_binary_operator_errors("LD" , symbol);} // I believe it will never emit messages (b) and (c)!! |
943 return NULL; |
948 void *print_datatypes_error_c::visit( LDN_operator_c *symbol) {return print_binary_operator_errors("LDN" , symbol);} // I believe it will never emit message (c) |
944 } |
949 void *print_datatypes_error_c::visit( ST_operator_c *symbol) {return print_binary_operator_errors("ST" , symbol);} // I believe it will never emit message (c) |
945 |
950 void *print_datatypes_error_c::visit( STN_operator_c *symbol) {return print_binary_operator_errors("STN" , symbol);} // I believe it will never emit message (c) |
946 void *print_datatypes_error_c::visit(LDN_operator_c *symbol) { |
|
947 if ((symbol->candidate_datatypes.size() == 0) && |
|
948 (il_operand->candidate_datatypes.size() > 0)) |
|
949 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'LDN' operator."); |
|
950 return NULL; |
|
951 } |
|
952 |
|
953 void *print_datatypes_error_c::visit(ST_operator_c *symbol) { |
|
954 /* MANU: |
|
955 * if prev_instruction is NULL we can print a message error or warning error like: |
|
956 * we can't use a ST like first instruction. |
|
957 * What do you think? |
|
958 */ |
|
959 if ((symbol->candidate_datatypes.size() == 0) && |
|
960 (il_operand->candidate_datatypes.size() > 0)) |
|
961 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ST' operator."); |
|
962 return NULL; |
|
963 } |
|
964 |
|
965 void *print_datatypes_error_c::visit(STN_operator_c *symbol) { |
|
966 /* MANU: |
|
967 * if prev_instruction is NULL we can print a message error or warning error like: |
|
968 * we can't use a ST like first instruction. |
|
969 * What do you think? |
|
970 */ |
|
971 if ((symbol->candidate_datatypes.size() == 0) && |
|
972 (il_operand->candidate_datatypes.size() > 0)) |
|
973 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'STN' operator."); |
|
974 return NULL; |
|
975 } |
|
976 |
951 |
977 void *print_datatypes_error_c::visit(NOT_operator_c *symbol) { |
952 void *print_datatypes_error_c::visit(NOT_operator_c *symbol) { |
978 /* NOTE: the standard allows syntax in which the NOT operator is followed by an optional <il_operand> |
953 /* NOTE: the standard allows syntax in which the NOT operator is followed by an optional <il_operand> |
979 * NOT [<il_operand>] |
954 * NOT [<il_operand>] |
980 * However, it does not define the semantic of the NOT operation when the <il_operand> is specified. |
955 * However, it does not define the semantic of the NOT operation when the <il_operand> is specified. |
981 * We therefore consider it an error if an il_operand is specified! |
956 * We therefore consider it an error if an il_operand is specified! |
982 */ |
957 */ |
983 if (il_operand != NULL) |
958 if (il_operand != NULL) { |
984 STAGE3_ERROR(0, symbol, symbol, "'NOT' operator may not have an operand."); |
959 STAGE3_ERROR(0, symbol, symbol, "'NOT' operator may not have an operand."); |
985 if (symbol->candidate_datatypes.size() == 0) |
960 } else if (symbol->candidate_datatypes.size() == 0) |
986 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'NOT' operator."); |
961 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'NOT' operator."); |
987 return NULL; |
962 return NULL; |
988 } |
963 } |
989 |
964 |
990 void *print_datatypes_error_c::visit(S_operator_c *symbol) { |
965 void *print_datatypes_error_c::visit(S_operator_c *symbol) { |
991 /* TODO: what if this is a FB call ?? */ |
966 if (NULL != symbol->called_fb_declaration) /* FB call semantics */ return handle_implicit_il_fb_invocation("S", symbol, symbol->called_fb_declaration); |
992 if ((symbol->candidate_datatypes.size() == 0) && |
967 else /* Reset semantics */ return print_binary_operator_errors ("S", symbol); |
993 (il_operand->candidate_datatypes.size() > 0)) |
|
994 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'S' operator."); |
|
995 return NULL; |
|
996 } |
968 } |
997 |
969 |
998 void *print_datatypes_error_c::visit(R_operator_c *symbol) { |
970 void *print_datatypes_error_c::visit(R_operator_c *symbol) { |
999 /* TODO: what if this is a FB call ?? */ |
971 if (NULL != symbol->called_fb_declaration) /* FB call semantics */ return handle_implicit_il_fb_invocation("R", symbol, symbol->called_fb_declaration); |
1000 if ((symbol->candidate_datatypes.size() == 0) && |
972 else /* Reset semantics */ return print_binary_operator_errors ("R", symbol); |
1001 (il_operand->candidate_datatypes.size() > 0)) |
|
1002 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'R' operator."); |
|
1003 return NULL; |
|
1004 } |
973 } |
1005 |
974 |
1006 void *print_datatypes_error_c::visit( S1_operator_c *symbol) {return handle_implicit_il_fb_invocation( "S1", symbol, symbol->called_fb_declaration);} |
975 void *print_datatypes_error_c::visit( S1_operator_c *symbol) {return handle_implicit_il_fb_invocation( "S1", symbol, symbol->called_fb_declaration);} |
1007 void *print_datatypes_error_c::visit( R1_operator_c *symbol) {return handle_implicit_il_fb_invocation( "R1", symbol, symbol->called_fb_declaration);} |
976 void *print_datatypes_error_c::visit( R1_operator_c *symbol) {return handle_implicit_il_fb_invocation( "R1", symbol, symbol->called_fb_declaration);} |
1008 void *print_datatypes_error_c::visit(CLK_operator_c *symbol) {return handle_implicit_il_fb_invocation("CLK", symbol, symbol->called_fb_declaration);} |
977 void *print_datatypes_error_c::visit(CLK_operator_c *symbol) {return handle_implicit_il_fb_invocation("CLK", symbol, symbol->called_fb_declaration);} |
1227 void *print_datatypes_error_c::visit(for_statement_c *symbol) { |
1196 void *print_datatypes_error_c::visit(for_statement_c *symbol) { |
1228 symbol->control_variable->accept(*this); |
1197 symbol->control_variable->accept(*this); |
1229 symbol->beg_expression->accept(*this); |
1198 symbol->beg_expression->accept(*this); |
1230 symbol->end_expression->accept(*this); |
1199 symbol->end_expression->accept(*this); |
1231 /* Control variable */ |
1200 /* Control variable */ |
1232 if ((NULL == symbol->control_variable->datatype) && |
1201 if ((!get_datatype_info_c::is_type_valid(symbol->control_variable->datatype)) && |
1233 (symbol->control_variable->candidate_datatypes.size() > 0)) { |
1202 (symbol->control_variable->candidate_datatypes.size() > 0)) { |
1234 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' control variable."); |
1203 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' control variable."); |
1235 } |
1204 } |
1236 /* BEG expression */ |
1205 /* BEG expression */ |
1237 if ((NULL == symbol->beg_expression->datatype) && |
1206 if ((!get_datatype_info_c::is_type_valid(symbol->beg_expression->datatype)) && |
1238 (symbol->beg_expression->candidate_datatypes.size() > 0)) { |
1207 (symbol->beg_expression->candidate_datatypes.size() > 0)) { |
1239 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' begin expression."); |
1208 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' begin expression."); |
1240 } |
1209 } |
1241 /* END expression */ |
1210 /* END expression */ |
1242 if ((NULL == symbol->end_expression->datatype) && |
1211 if ((!get_datatype_info_c::is_type_valid(symbol->end_expression->datatype)) && |
1243 (symbol->end_expression->candidate_datatypes.size() > 0)) { |
1212 (symbol->end_expression->candidate_datatypes.size() > 0)) { |
1244 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' end expression."); |
1213 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' end expression."); |
1245 } |
1214 } |
1246 /* BY expression */ |
1215 /* BY expression */ |
1247 if ((NULL != symbol->by_expression) && |
1216 if ((NULL != symbol->by_expression) && |
1248 (NULL == symbol->by_expression->datatype) && |
1217 (!get_datatype_info_c::is_type_valid(symbol->by_expression->datatype)) && |
1249 (symbol->end_expression->candidate_datatypes.size() > 0)) { |
1218 (symbol->end_expression->candidate_datatypes.size() > 0)) { |
1250 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' by expression."); |
1219 STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'FOR' by expression."); |
1251 } |
1220 } |
1252 /* DO statement */ |
1221 /* DO statement */ |
1253 if (NULL != symbol->statement_list) |
1222 if (NULL != symbol->statement_list) |
1254 symbol->statement_list->accept(*this); |
1223 symbol->statement_list->accept(*this); |