changeset 719 | 19595fce59f0 |
parent 718 | a9f8cc778444 |
child 728 | 3700fd83e5de |
718:a9f8cc778444 | 719:19595fce59f0 |
---|---|
41 * Fill the candidate datatype list for all symbols that may legally 'have' a data type (e.g. variables, literals, function calls, expressions, etc.) |
41 * Fill the candidate datatype list for all symbols that may legally 'have' a data type (e.g. variables, literals, function calls, expressions, etc.) |
42 * |
42 * |
43 * The candidate datatype list will be filled with a list of all the data types that expression may legally take. |
43 * The candidate datatype list will be filled with a list of all the data types that expression may legally take. |
44 * For example, the very simple literal '0' (as in foo := 0), may represent a: |
44 * For example, the very simple literal '0' (as in foo := 0), may represent a: |
45 * BOOL, BYTE, WORD, DWORD, LWORD, USINT, SINT, UINT, INT, UDINT, DINT, ULINT, LINT (as well as the SAFE versions of these data tyes too!) |
45 * BOOL, BYTE, WORD, DWORD, LWORD, USINT, SINT, UINT, INT, UDINT, DINT, ULINT, LINT (as well as the SAFE versions of these data tyes too!) |
46 * |
|
47 * WARNING: This visitor class starts off by building a map of all enumeration constants that are defined in the source code (i.e. a library_c symbol), |
|
48 * and this map is later used to determine the datatpe of each use of an enumeration constant. By implication, the fill_candidate_datatypes_c |
|
49 * visitor class will only work corretly if it is asked to visit a symbol of class library_c!! |
|
46 */ |
50 */ |
47 |
51 |
48 |
52 |
49 #include "../absyntax_utils/absyntax_utils.hh" |
53 #include "../absyntax_utils/absyntax_utils.hh" |
50 #include "datatype_functions.hh" |
54 #include "datatype_functions.hh" |
67 * a function declaration. |
71 * a function declaration. |
68 */ |
72 */ |
69 // search_var_instance_decl_c *search_var_instance_decl; |
73 // search_var_instance_decl_c *search_var_instance_decl; |
70 |
74 |
71 /* This variable was created to pass information from |
75 /* This variable was created to pass information from |
72 * fill_candidate_datatypes_c::visit(case_statement_c *symbol) function to |
|
73 * fill_candidate_datatypes_c::visit(case_list_c *symbol) function. |
|
74 */ |
|
75 // symbol_c *case_expression_type; |
|
76 |
|
77 /* In IL code, once we find a type mismatch error, it is best to |
|
78 * ignore any further errors until the end of the logical operation, |
|
79 * i.e. until the next LD. |
|
80 * However, we cannot clear the il_error flag on all LD operations, |
|
81 * as these may also be used within parenthesis. LD operations |
|
82 * within parenthesis may not clear the error flag. |
|
83 * We therefore need a counter to know how deep inside a parenthesis |
|
84 * structure we are. |
|
85 */ |
|
86 // int il_parenthesis_level; |
|
87 // bool error_found; |
|
88 |
|
89 /* This variable was created to pass information from |
|
90 * fill_candidate_datatypes_c::visit(enumerated_spec_init_c *symbol) function to |
76 * fill_candidate_datatypes_c::visit(enumerated_spec_init_c *symbol) function to |
91 * fill_candidate_datatypes_c::visit(enumerated_value_list_c *symbol) function. |
77 * fill_candidate_datatypes_c::visit(enumerated_value_list_c *symbol) function. |
92 */ |
78 */ |
93 symbol_c *current_enumerated_spec_type; |
79 symbol_c *current_enumerated_spec_type; |
94 |
80 |
121 |
107 |
122 public: |
108 public: |
123 fill_candidate_datatypes_c(symbol_c *ignore); |
109 fill_candidate_datatypes_c(symbol_c *ignore); |
124 virtual ~fill_candidate_datatypes_c(void); |
110 virtual ~fill_candidate_datatypes_c(void); |
125 |
111 |
112 |
|
113 /***************************/ |
|
114 /* B 0 - Programming Model */ |
|
115 /***************************/ |
|
116 void *visit(library_c *symbol); |
|
126 |
117 |
127 /*********************/ |
118 /*********************/ |
128 /* B 1.2 - Constants */ |
119 /* B 1.2 - Constants */ |
129 /*********************/ |
120 /*********************/ |
130 /******************************/ |
121 /******************************/ |