56 #include "absyntax_utils.hh" |
56 #include "absyntax_utils.hh" |
57 |
57 |
58 |
58 |
59 search_var_instance_decl_c::search_var_instance_decl_c(symbol_c *search_scope) { |
59 search_var_instance_decl_c::search_var_instance_decl_c(symbol_c *search_scope) { |
60 this->current_vartype = none_vt; |
60 this->current_vartype = none_vt; |
61 this->current_varqualifier = none_vq; |
|
62 this->search_scope = search_scope; |
61 this->search_scope = search_scope; |
63 this->search_name = NULL; |
62 this->search_name = NULL; |
64 this->current_type_decl = NULL; |
63 this->current_type_decl = NULL; |
65 } |
64 } |
66 |
65 |
67 symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable_instance_name) { |
66 symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable_instance_name) { |
68 this->current_vartype = none_vt; |
67 this->current_vartype = none_vt; |
69 this->current_varqualifier = none_vq; |
|
70 this->search_name = variable_instance_name; |
68 this->search_name = variable_instance_name; |
71 return (symbol_c *)search_scope->accept(*this); |
69 return (symbol_c *)search_scope->accept(*this); |
72 } |
70 } |
73 |
71 |
74 unsigned int search_var_instance_decl_c::get_vartype() { |
72 unsigned int search_var_instance_decl_c::get_vartype() { |
75 return current_vartype; |
73 return current_vartype; |
76 } |
|
77 |
|
78 unsigned int search_var_instance_decl_c::get_varqualifier() { |
|
79 return current_varqualifier; |
|
80 } |
74 } |
81 |
75 |
82 /***************************/ |
76 /***************************/ |
83 /* B 0 - Programming Model */ |
77 /* B 0 - Programming Model */ |
84 /***************************/ |
78 /***************************/ |
93 |
87 |
94 /******************************************/ |
88 /******************************************/ |
95 /* B 1.4.3 - Declaration & Initialization */ |
89 /* B 1.4.3 - Declaration & Initialization */ |
96 /******************************************/ |
90 /******************************************/ |
97 |
91 |
98 void *search_var_instance_decl_c::visit(constant_option_c *symbol) { |
|
99 current_varqualifier = constant_vq; |
|
100 return NULL; |
|
101 } |
|
102 |
|
103 void *search_var_instance_decl_c::visit(retain_option_c *symbol) { |
|
104 current_varqualifier = retain_vq; |
|
105 return NULL; |
|
106 } |
|
107 |
|
108 void *search_var_instance_decl_c::visit(non_retain_option_c *symbol) { |
|
109 current_varqualifier = non_retain_vq; |
|
110 return NULL; |
|
111 } |
|
112 |
|
113 /* edge -> The F_EDGE or R_EDGE directive */ |
92 /* edge -> The F_EDGE or R_EDGE directive */ |
114 // SYM_REF2(edge_declaration_c, edge, var1_list) |
93 // SYM_REF2(edge_declaration_c, edge, var1_list) |
115 // TODO |
94 // TODO |
116 |
95 |
117 void *search_var_instance_decl_c::visit(input_declarations_c *symbol) { |
96 void *search_var_instance_decl_c::visit(input_declarations_c *symbol) { |
118 current_vartype = input_vt; |
97 current_vartype = input_vt; |
119 if (symbol->option != NULL) |
|
120 symbol->option->accept(*this); |
|
121 void *res = symbol->input_declaration_list->accept(*this); |
98 void *res = symbol->input_declaration_list->accept(*this); |
122 if (res == NULL) { |
99 if (res == NULL) { |
123 current_vartype = none_vt; |
100 current_vartype = none_vt; |
124 current_varqualifier = none_vq; |
|
125 } |
101 } |
126 return res; |
102 return res; |
127 } |
103 } |
128 |
104 |
129 /* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
105 /* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
130 /* option -> may be NULL ! */ |
106 /* option -> may be NULL ! */ |
131 void *search_var_instance_decl_c::visit(output_declarations_c *symbol) { |
107 void *search_var_instance_decl_c::visit(output_declarations_c *symbol) { |
132 current_vartype = output_vt; |
108 current_vartype = output_vt; |
133 if (symbol->option != NULL) |
|
134 symbol->option->accept(*this); |
|
135 void *res = symbol->var_init_decl_list->accept(*this); |
109 void *res = symbol->var_init_decl_list->accept(*this); |
136 if (res == NULL) { |
110 if (res == NULL) { |
137 current_vartype = none_vt; |
111 current_vartype = none_vt; |
138 current_varqualifier = none_vq; |
|
139 } |
112 } |
140 return res; |
113 return res; |
141 } |
114 } |
142 |
115 |
143 /* VAR_IN_OUT var_declaration_list END_VAR */ |
116 /* VAR_IN_OUT var_declaration_list END_VAR */ |
161 /* VAR [CONSTANT] var_init_decl_list END_VAR */ |
134 /* VAR [CONSTANT] var_init_decl_list END_VAR */ |
162 /* option -> may be NULL ! */ |
135 /* option -> may be NULL ! */ |
163 /* helper symbol for input_declarations */ |
136 /* helper symbol for input_declarations */ |
164 void *search_var_instance_decl_c::visit(var_declarations_c *symbol) { |
137 void *search_var_instance_decl_c::visit(var_declarations_c *symbol) { |
165 current_vartype = private_vt; |
138 current_vartype = private_vt; |
166 if (symbol->option != NULL) |
|
167 symbol->option->accept(*this); |
|
168 void *res = symbol->var_init_decl_list->accept(*this); |
139 void *res = symbol->var_init_decl_list->accept(*this); |
169 if (res == NULL) { |
140 if (res == NULL) { |
170 current_vartype = none_vt; |
141 current_vartype = none_vt; |
171 current_varqualifier = none_vq; |
|
172 } |
142 } |
173 return res; |
143 return res; |
174 } |
144 } |
175 |
145 |
176 /* VAR RETAIN var_init_decl_list END_VAR */ |
146 /* VAR RETAIN var_init_decl_list END_VAR */ |
177 void *search_var_instance_decl_c::visit(retentive_var_declarations_c *symbol) { |
147 void *search_var_instance_decl_c::visit(retentive_var_declarations_c *symbol) { |
178 current_vartype = private_vt; |
148 current_vartype = private_vt; |
179 current_varqualifier = retain_vq; |
|
180 void *res = symbol->var_init_decl_list->accept(*this); |
149 void *res = symbol->var_init_decl_list->accept(*this); |
181 if (res == NULL) { |
150 if (res == NULL) { |
182 current_vartype = none_vt; |
151 current_vartype = none_vt; |
183 current_varqualifier = none_vq; |
|
184 } |
152 } |
185 return res; |
153 return res; |
186 } |
154 } |
187 |
155 |
188 /* VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */ |
156 /* VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */ |
189 /* option -> may be NULL ! */ |
157 /* option -> may be NULL ! */ |
190 //SYM_REF2(located_var_declarations_c, option, located_var_decl_list) |
158 //SYM_REF2(located_var_declarations_c, option, located_var_decl_list) |
191 void *search_var_instance_decl_c::visit(located_var_declarations_c *symbol) { |
159 void *search_var_instance_decl_c::visit(located_var_declarations_c *symbol) { |
192 current_vartype = located_vt; |
160 current_vartype = located_vt; |
193 if (symbol->option != NULL) |
|
194 symbol->option->accept(*this); |
|
195 void *res = symbol->located_var_decl_list->accept(*this); |
161 void *res = symbol->located_var_decl_list->accept(*this); |
196 if (res == NULL) { |
162 if (res == NULL) { |
197 current_vartype = none_vt; |
163 current_vartype = none_vt; |
198 current_varqualifier = none_vq; |
|
199 } |
164 } |
200 return res; |
165 return res; |
201 } |
166 } |
202 |
167 |
203 /*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */ |
168 /*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */ |
204 /* option -> may be NULL ! */ |
169 /* option -> may be NULL ! */ |
205 //SYM_REF2(external_var_declarations_c, option, external_declaration_list) |
170 //SYM_REF2(external_var_declarations_c, option, external_declaration_list) |
206 void *search_var_instance_decl_c::visit(external_var_declarations_c *symbol) { |
171 void *search_var_instance_decl_c::visit(external_var_declarations_c *symbol) { |
207 current_vartype = external_vt; |
172 current_vartype = external_vt; |
208 if (symbol->option != NULL) |
|
209 symbol->option->accept(*this); |
|
210 void *res = symbol->external_declaration_list->accept(*this); |
173 void *res = symbol->external_declaration_list->accept(*this); |
211 if (res == NULL) { |
174 if (res == NULL) { |
212 current_vartype = none_vt; |
175 current_vartype = none_vt; |
213 current_varqualifier = none_vq; |
|
214 } |
176 } |
215 return res; |
177 return res; |
216 } |
178 } |
217 |
179 |
218 /*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */ |
180 /*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */ |
219 /* option -> may be NULL ! */ |
181 /* option -> may be NULL ! */ |
220 //SYM_REF2(global_var_declarations_c, option, global_var_decl_list) |
182 //SYM_REF2(global_var_declarations_c, option, global_var_decl_list) |
221 void *search_var_instance_decl_c::visit(global_var_declarations_c *symbol) { |
183 void *search_var_instance_decl_c::visit(global_var_declarations_c *symbol) { |
222 current_vartype = global_vt; |
184 current_vartype = global_vt; |
223 if (symbol->option != NULL) |
|
224 symbol->option->accept(*this); |
|
225 void *res = symbol->global_var_decl_list->accept(*this); |
185 void *res = symbol->global_var_decl_list->accept(*this); |
226 if (res == NULL) { |
186 if (res == NULL) { |
227 current_vartype = none_vt; |
187 current_vartype = none_vt; |
228 current_varqualifier = none_vq; |
|
229 } |
188 } |
230 return res; |
189 return res; |
231 } |
190 } |
232 |
191 |
233 /* var1_list is one of the following... |
192 /* var1_list is one of the following... |