342 symbol->candidate_datatypes.push_back(&search_constant_type_c::ulint_type_name); |
342 symbol->candidate_datatypes.push_back(&search_constant_type_c::ulint_type_name); |
343 if (debug) std::cout << "ANY_INT [" << symbol->candidate_datatypes.size()<< "]" << std::endl; |
343 if (debug) std::cout << "ANY_INT [" << symbol->candidate_datatypes.size()<< "]" << std::endl; |
344 return NULL; |
344 return NULL; |
345 } |
345 } |
346 |
346 |
|
347 // SYM_REF2(integer_literal_c, type, value) |
347 void *fill_candidate_datatypes_c::visit(integer_literal_c *symbol) { |
348 void *fill_candidate_datatypes_c::visit(integer_literal_c *symbol) { |
348 symbol->candidate_datatypes.push_back(symbol->type); |
349 symbol->value->accept(*this); |
|
350 if (search_in_datatype_list(symbol->type, symbol->value->candidate_datatypes) >= 0) |
|
351 symbol->candidate_datatypes.push_back(symbol->type); |
349 if (debug) std::cout << "INT_LITERAL [" << symbol->candidate_datatypes.size() << "]\n"; |
352 if (debug) std::cout << "INT_LITERAL [" << symbol->candidate_datatypes.size() << "]\n"; |
350 return NULL; |
353 return NULL; |
351 } |
354 } |
352 |
355 |
353 void *fill_candidate_datatypes_c::visit(real_literal_c *symbol) { |
356 void *fill_candidate_datatypes_c::visit(real_literal_c *symbol) { |
354 symbol->candidate_datatypes.push_back(symbol->type); |
357 symbol->value->accept(*this); |
|
358 if (search_in_datatype_list(symbol->type, symbol->value->candidate_datatypes) >= 0) |
|
359 symbol->candidate_datatypes.push_back(symbol->type); |
355 if (debug) std::cout << "REAL_LITERAL [" << symbol->candidate_datatypes.size() << "]\n"; |
360 if (debug) std::cout << "REAL_LITERAL [" << symbol->candidate_datatypes.size() << "]\n"; |
356 return NULL; |
361 return NULL; |
357 } |
362 } |
358 |
363 |
359 void *fill_candidate_datatypes_c::visit(bit_string_literal_c *symbol) { |
364 void *fill_candidate_datatypes_c::visit(bit_string_literal_c *symbol) { |
360 symbol->candidate_datatypes.push_back(symbol->type); |
365 symbol->value->accept(*this); |
|
366 if (search_in_datatype_list(symbol->type, symbol->value->candidate_datatypes) >= 0) |
|
367 symbol->candidate_datatypes.push_back(symbol->type); |
361 return NULL; |
368 return NULL; |
362 } |
369 } |
363 |
370 |
364 void *fill_candidate_datatypes_c::visit(boolean_literal_c *symbol) { |
371 void *fill_candidate_datatypes_c::visit(boolean_literal_c *symbol) { |
365 symbol->candidate_datatypes.push_back(&search_constant_type_c::bool_type_name); |
372 symbol->value->accept(*this); |
|
373 if (search_in_datatype_list(symbol->type, symbol->value->candidate_datatypes) >= 0) |
|
374 /* if an explicit datat type has been provided (e.g. SAFEBOOL#true), check whether |
|
375 * the possible datatypes of the value is consistent with the desired type. |
|
376 */ |
|
377 symbol->candidate_datatypes.push_back(symbol->type); |
|
378 else { |
|
379 /* Then only a literal TRUE or FALSE was given! */ |
|
380 /* In this case, symbol->type will be NULL! */ |
|
381 symbol->candidate_datatypes.push_back(&search_constant_type_c::bool_type_name); |
|
382 symbol->candidate_datatypes.push_back(&search_constant_type_c::safebool_type_name); |
|
383 } |
366 return NULL; |
384 return NULL; |
367 } |
385 } |
368 |
386 |
369 void *fill_candidate_datatypes_c::visit(boolean_true_c *symbol) { |
387 void *fill_candidate_datatypes_c::visit(boolean_true_c *symbol) { |
370 symbol->candidate_datatypes.push_back(&search_constant_type_c::bool_type_name); |
388 symbol->candidate_datatypes.push_back(&search_constant_type_c::bool_type_name); |
|
389 symbol->candidate_datatypes.push_back(&search_constant_type_c::safebool_type_name); |
371 return NULL; |
390 return NULL; |
372 } |
391 } |
373 |
392 |
374 void *fill_candidate_datatypes_c::visit(boolean_false_c *symbol) { |
393 void *fill_candidate_datatypes_c::visit(boolean_false_c *symbol) { |
375 symbol->candidate_datatypes.push_back(&search_constant_type_c::bool_type_name); |
394 symbol->candidate_datatypes.push_back(&search_constant_type_c::bool_type_name); |
|
395 symbol->candidate_datatypes.push_back(&search_constant_type_c::safebool_type_name); |
376 return NULL; |
396 return NULL; |
377 } |
397 } |
378 |
398 |
379 /*******************************/ |
399 /*******************************/ |
380 /* B.1.2.2 Character Strings */ |
400 /* B.1.2.2 Character Strings */ |