author | Mario de Sousa <msousa@fe.up.pt> |
Tue, 17 Apr 2012 10:11:45 +0100 | |
changeset 517 | 889f4e577964 |
parent 511 | b22ae67d8003 |
child 531 | e7d6f28fc882 |
permissions | -rw-r--r-- |
181 | 1 |
/* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
3 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
4 |
* Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) |
279
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
265
diff
changeset
|
5 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
6 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
7 |
* This program is free software: you can redistribute it and/or modify |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
8 |
* it under the terms of the GNU General Public License as published by |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
9 |
* the Free Software Foundation, either version 3 of the License, or |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
10 |
* (at your option) any later version. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
11 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
12 |
* This program is distributed in the hope that it will be useful, |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
15 |
* GNU General Public License for more details. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
16 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
19 |
* |
181 | 20 |
* |
21 |
* This code is made available on the understanding that it will not be |
|
22 |
* used in safety-critical situations without a full and competent review. |
|
23 |
*/ |
|
24 |
||
25 |
/* |
|
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
26 |
* An IEC 61131-3 compiler. |
181 | 27 |
* |
28 |
* Based on the |
|
29 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
30 |
* |
|
31 |
*/ |
|
32 |
||
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
33 |
/* Search in a VAR* END_VAR declaration for the delcration of the specified variable instance. |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
34 |
* Will return: |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
35 |
* - the declaration itself (get_decl() ) |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
36 |
* - the type of declaration in which the variable was declared (get_vartype() ) |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
37 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
38 |
* The variable instance may NOT be a member of a structure of a memeber |
181 | 39 |
* of a structure of an element of an array of ... |
40 |
* |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
41 |
* For example, considering the following 'variables': |
181 | 42 |
* window.points[1].coordinate.x |
43 |
* window.points[1].colour |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
44 |
* offset[99] |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
45 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
46 |
* passing a reference to 'points', 'points[1]', 'points[1].colour', 'colour' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
47 |
* ARE NOT ALLOWED! |
181 | 48 |
* |
49 |
* This class must only be passed the name of the variable that will appear |
|
50 |
* in the variable declaration. In the above examples, this would be |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
51 |
* 'window.points[1].coordinate.x' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
52 |
* 'window.points[1].coordinate' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
53 |
* 'window.points[1]' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
54 |
* 'window' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
55 |
* 'window.points[1].colour' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
56 |
* 'offset' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
57 |
* 'offset[99]' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
58 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
59 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
60 |
*/ |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
61 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
62 |
/* Note: |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
63 |
* Determining the declaration type of a specific variable instance (including |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
64 |
* function block instances) really means determining whether the variable was declared in a |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
65 |
* VAR_INPUT |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
66 |
* VAR_OUTPUT |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
67 |
* VAR_IN_OUT |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
68 |
* VAR |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
69 |
* VAR_TEMP |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
70 |
* VAR_EXTERNAL |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
71 |
* VAR_GLOBAL |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
72 |
* VAR <var_name> AT <location> -> Located variable! |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
73 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
74 |
*/ |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
75 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
76 |
/* Note: |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
77 |
* The current_type_decl that this class returns may reference the |
181 | 78 |
* name of a type, or the type declaration itself! |
79 |
* For an example of the first, consider a variable declared as ... |
|
80 |
* x : AAA; |
|
81 |
* where the AAA type is previously declared as whatever. |
|
82 |
* For an example of the second, consider a variable declared as ... |
|
83 |
* x : array of int [10]; ----> is allowed |
|
84 |
* |
|
85 |
* If it is the first, we will return a reference to the name, if the second |
|
86 |
* we return a reference to the declaration!! |
|
87 |
*/ |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
88 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
89 |
|
181 | 90 |
#include "absyntax_utils.hh" |
91 |
||
92 |
||
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
93 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
94 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
95 |
|
181 | 96 |
search_var_instance_decl_c::search_var_instance_decl_c(symbol_c *search_scope) { |
97 |
this->current_vartype = none_vt; |
|
98 |
this->search_scope = search_scope; |
|
99 |
this->search_name = NULL; |
|
100 |
this->current_type_decl = NULL; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
101 |
this->current_option = none_opt; |
181 | 102 |
} |
103 |
||
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
104 |
symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable) { |
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
105 |
this->current_vartype = none_vt; |
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
106 |
this->current_option = none_opt; |
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
107 |
this->search_name = get_var_name_c::get_name(variable); |
181 | 108 |
return (symbol_c *)search_scope->accept(*this); |
109 |
} |
|
110 |
||
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
111 |
unsigned int search_var_instance_decl_c::get_vartype(symbol_c *variable) { |
417
d48f53715f77
Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
112 |
this->current_vartype = none_vt; |
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
113 |
this->current_option = none_opt; |
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
114 |
this->search_name = get_var_name_c::get_name(variable); |
417
d48f53715f77
Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
115 |
search_scope->accept(*this); |
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
116 |
return this->current_vartype; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
117 |
} |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
118 |
|
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
119 |
unsigned int search_var_instance_decl_c::get_option(symbol_c *variable) { |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
120 |
this->current_vartype = none_vt; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
121 |
this->current_option = none_opt; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
122 |
this->search_name = get_var_name_c::get_name(variable); |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
123 |
search_scope->accept(*this); |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
124 |
return this->current_option; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
125 |
} |
417
d48f53715f77
Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
126 |
|
181 | 127 |
/***************************/ |
128 |
/* B 0 - Programming Model */ |
|
129 |
/***************************/ |
|
130 |
void *search_var_instance_decl_c::visit(library_c *symbol) { |
|
131 |
/* we do not want to search multiple declaration scopes, |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
132 |
* so we do not visit all the functions, function blocks, etc... |
181 | 133 |
*/ |
134 |
return NULL; |
|
135 |
} |
|
136 |
||
137 |
||
138 |
||
139 |
/******************************************/ |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
140 |
/* B 1.4.3 - Declaration & Initialization */ |
181 | 141 |
/******************************************/ |
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
142 |
|
181 | 143 |
/* edge -> The F_EDGE or R_EDGE directive */ |
144 |
// SYM_REF2(edge_declaration_c, edge, var1_list) |
|
145 |
// TODO |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
146 |
void *search_var_instance_decl_c::visit(constant_option_c *symbol) { |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
147 |
current_option = constant_opt; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
148 |
return NULL; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
149 |
} |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
150 |
|
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
151 |
void *search_var_instance_decl_c::visit(retain_option_c *symbol) { |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
152 |
current_option = retain_opt; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
153 |
return NULL; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
154 |
} |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
155 |
|
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
156 |
void *search_var_instance_decl_c::visit(non_retain_option_c *symbol) { |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
157 |
current_option = non_retain_opt; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
158 |
return NULL; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
159 |
} |
181 | 160 |
|
161 |
void *search_var_instance_decl_c::visit(input_declarations_c *symbol) { |
|
162 |
current_vartype = input_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
163 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
164 |
if (NULL != symbol->option) |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
165 |
symbol->option->accept(*this); |
181 | 166 |
void *res = symbol->input_declaration_list->accept(*this); |
167 |
if (res == NULL) { |
|
168 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
169 |
current_option = none_opt; |
181 | 170 |
} |
171 |
return res; |
|
172 |
} |
|
173 |
||
174 |
/* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
|
175 |
/* option -> may be NULL ! */ |
|
176 |
void *search_var_instance_decl_c::visit(output_declarations_c *symbol) { |
|
177 |
current_vartype = output_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
178 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
179 |
if (NULL != symbol->option) |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
180 |
symbol->option->accept(*this); |
181 | 181 |
void *res = symbol->var_init_decl_list->accept(*this); |
182 |
if (res == NULL) { |
|
183 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
184 |
current_option = none_opt; |
181 | 185 |
} |
186 |
return res; |
|
187 |
} |
|
188 |
||
189 |
/* VAR_IN_OUT var_declaration_list END_VAR */ |
|
190 |
void *search_var_instance_decl_c::visit(input_output_declarations_c *symbol) { |
|
191 |
current_vartype = inoutput_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
192 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
181 | 193 |
void *res = symbol->var_declaration_list->accept(*this); |
194 |
if (res == NULL) { |
|
195 |
current_vartype = none_vt; |
|
196 |
} |
|
197 |
return res; |
|
198 |
} |
|
199 |
||
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
200 |
/* ENO : BOOL */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
201 |
void *search_var_instance_decl_c::visit(eno_param_declaration_c *symbol) { |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
202 |
if (compare_identifiers(symbol->name, search_name) == 0) |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
203 |
return symbol->type; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
204 |
return NULL; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
205 |
} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
206 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
207 |
|
181 | 208 |
/* VAR [CONSTANT] var_init_decl_list END_VAR */ |
209 |
/* option -> may be NULL ! */ |
|
210 |
/* helper symbol for input_declarations */ |
|
211 |
void *search_var_instance_decl_c::visit(var_declarations_c *symbol) { |
|
212 |
current_vartype = private_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
213 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
214 |
if (NULL != symbol->option) |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
215 |
symbol->option->accept(*this); |
181 | 216 |
void *res = symbol->var_init_decl_list->accept(*this); |
217 |
if (res == NULL) { |
|
218 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
219 |
current_option = none_opt; |
181 | 220 |
} |
221 |
return res; |
|
222 |
} |
|
223 |
||
224 |
/* VAR RETAIN var_init_decl_list END_VAR */ |
|
225 |
void *search_var_instance_decl_c::visit(retentive_var_declarations_c *symbol) { |
|
226 |
current_vartype = private_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
227 |
current_option = retain_opt; |
181 | 228 |
void *res = symbol->var_init_decl_list->accept(*this); |
229 |
if (res == NULL) { |
|
230 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
231 |
current_option = none_opt; |
181 | 232 |
} |
233 |
return res; |
|
234 |
} |
|
235 |
||
236 |
/* VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */ |
|
237 |
/* option -> may be NULL ! */ |
|
238 |
//SYM_REF2(located_var_declarations_c, option, located_var_decl_list) |
|
239 |
void *search_var_instance_decl_c::visit(located_var_declarations_c *symbol) { |
|
240 |
current_vartype = located_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
241 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
242 |
if (NULL != symbol->option) |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
243 |
symbol->option->accept(*this); |
181 | 244 |
void *res = symbol->located_var_decl_list->accept(*this); |
245 |
if (res == NULL) { |
|
246 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
247 |
current_option = none_opt; |
181 | 248 |
} |
249 |
return res; |
|
250 |
} |
|
251 |
||
252 |
/*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */ |
|
253 |
/* option -> may be NULL ! */ |
|
254 |
//SYM_REF2(external_var_declarations_c, option, external_declaration_list) |
|
255 |
void *search_var_instance_decl_c::visit(external_var_declarations_c *symbol) { |
|
256 |
current_vartype = external_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
257 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
258 |
if (NULL != symbol->option) |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
259 |
symbol->option->accept(*this); |
181 | 260 |
void *res = symbol->external_declaration_list->accept(*this); |
261 |
if (res == NULL) { |
|
262 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
263 |
current_option = none_opt; |
181 | 264 |
} |
265 |
return res; |
|
266 |
} |
|
267 |
||
268 |
/*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */ |
|
269 |
/* option -> may be NULL ! */ |
|
270 |
//SYM_REF2(global_var_declarations_c, option, global_var_decl_list) |
|
271 |
void *search_var_instance_decl_c::visit(global_var_declarations_c *symbol) { |
|
272 |
current_vartype = global_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
273 |
current_option = none_opt; /* not really required. Just to make the code more readable */ |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
274 |
if (NULL != symbol->option) |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
275 |
symbol->option->accept(*this); |
181 | 276 |
void *res = symbol->global_var_decl_list->accept(*this); |
277 |
if (res == NULL) { |
|
278 |
current_vartype = none_vt; |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
279 |
current_option = none_opt; |
181 | 280 |
} |
281 |
return res; |
|
282 |
} |
|
283 |
||
284 |
/* var1_list is one of the following... |
|
285 |
* simple_spec_init_c * |
|
286 |
* subrange_spec_init_c * |
|
287 |
* enumerated_spec_init_c * |
|
288 |
*/ |
|
289 |
// SYM_REF2(var1_init_decl_c, var1_list, spec_init) |
|
290 |
void *search_var_instance_decl_c::visit(var1_init_decl_c *symbol) { |
|
291 |
current_type_decl = symbol->spec_init; |
|
292 |
return symbol->var1_list->accept(*this); |
|
293 |
} |
|
294 |
||
295 |
/* var1_list ',' variable_name */ |
|
296 |
// SYM_LIST(var1_list_c) |
|
297 |
void *search_var_instance_decl_c::visit(var1_list_c *symbol) { |
|
298 |
list_c *list = symbol; |
|
299 |
for(int i = 0; i < list->n; i++) { |
|
300 |
if (compare_identifiers(list->elements[i], search_name) == 0) |
|
301 |
/* by now, current_type_decl should be != NULL */ |
|
302 |
return current_type_decl; |
|
303 |
} |
|
304 |
return NULL; |
|
305 |
} |
|
306 |
||
307 |
/* name_list ':' function_block_type_name ASSIGN structure_initialization */ |
|
308 |
/* structure_initialization -> may be NULL ! */ |
|
309 |
void *search_var_instance_decl_c::visit(fb_name_decl_c *symbol) { |
|
310 |
current_type_decl = symbol->function_block_type_name; |
|
311 |
return symbol->fb_name_list->accept(*this); |
|
312 |
} |
|
313 |
||
314 |
/* name_list ',' fb_name */ |
|
315 |
void *search_var_instance_decl_c::visit(fb_name_list_c *symbol) { |
|
316 |
list_c *list = symbol; |
|
317 |
for(int i = 0; i < list->n; i++) { |
|
318 |
if (compare_identifiers(list->elements[i], search_name) == 0) |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
319 |
/* by now, current_fb_declaration should be != NULL */ |
181 | 320 |
return current_type_decl; |
321 |
} |
|
322 |
return NULL; |
|
323 |
} |
|
324 |
||
325 |
/* var1_list ':' array_spec_init */ |
|
326 |
// SYM_REF2(array_var_init_decl_c, var1_list, array_spec_init) |
|
327 |
void *search_var_instance_decl_c::visit(array_var_init_decl_c *symbol) { |
|
328 |
current_type_decl = symbol->array_spec_init; |
|
329 |
return symbol->var1_list->accept(*this); |
|
330 |
} |
|
331 |
||
332 |
/* var1_list ':' initialized_structure */ |
|
333 |
// SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure) |
|
334 |
void *search_var_instance_decl_c::visit(structured_var_init_decl_c *symbol) { |
|
335 |
current_type_decl = symbol->initialized_structure; |
|
336 |
return symbol->var1_list->accept(*this); |
|
337 |
} |
|
338 |
||
339 |
/* var1_list ':' array_specification */ |
|
340 |
// SYM_REF2(array_var_declaration_c, var1_list, array_specification) |
|
341 |
void *search_var_instance_decl_c::visit(array_var_declaration_c *symbol) { |
|
342 |
current_type_decl = symbol->array_specification; |
|
343 |
return symbol->var1_list->accept(*this); |
|
344 |
} |
|
345 |
||
346 |
/* var1_list ':' structure_type_name */ |
|
347 |
// SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name) |
|
348 |
void *search_var_instance_decl_c::visit(structured_var_declaration_c *symbol) { |
|
349 |
current_type_decl = symbol->structure_type_name; |
|
350 |
return symbol->var1_list->accept(*this); |
|
351 |
} |
|
352 |
||
353 |
/* [variable_name] location ':' located_var_spec_init */ |
|
354 |
/* variable_name -> may be NULL ! */ |
|
355 |
// SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
356 |
// TODO!! |
|
357 |
||
358 |
/* global_var_name ':' (simple_specification|subrange_specification|enumerated_specification|array_specification|prev_declared_structure_type_name|function_block_type_name */ |
|
359 |
// SYM_REF2(external_declaration_c, global_var_name, specification) |
|
360 |
void *search_var_instance_decl_c::visit(external_declaration_c *symbol) { |
|
361 |
if (compare_identifiers(symbol->global_var_name, search_name) == 0) |
|
362 |
return symbol->specification; |
|
363 |
return NULL; |
|
364 |
} |
|
365 |
||
366 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
367 |
/* type_specification ->may be NULL ! */ |
|
368 |
// SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
369 |
void *search_var_instance_decl_c::visit(global_var_decl_c *symbol) { |
|
370 |
if (symbol->type_specification != NULL) { |
|
371 |
current_type_decl = symbol->type_specification; |
|
372 |
return symbol->global_var_spec->accept(*this); |
|
373 |
} |
|
374 |
else |
|
375 |
return NULL; |
|
376 |
} |
|
377 |
||
378 |
/*| global_var_name location */ |
|
379 |
//SYM_REF2(global_var_spec_c, global_var_name, location) |
|
380 |
void *search_var_instance_decl_c::visit(global_var_spec_c *symbol) { |
|
381 |
if (symbol->global_var_name != NULL && compare_identifiers(symbol->global_var_name, search_name) == 0) |
|
382 |
return current_type_decl; |
|
383 |
else |
|
384 |
return symbol->location->accept(*this); |
|
385 |
} |
|
386 |
||
387 |
/*| global_var_list ',' global_var_name */ |
|
388 |
//SYM_LIST(global_var_list_c) |
|
389 |
void *search_var_instance_decl_c::visit(global_var_list_c *symbol) { |
|
390 |
list_c *list = symbol; |
|
391 |
for(int i = 0; i < list->n; i++) { |
|
392 |
if (compare_identifiers(list->elements[i], search_name) == 0) |
|
393 |
/* by now, current_type_decl should be != NULL */ |
|
394 |
return current_type_decl; |
|
395 |
} |
|
396 |
return NULL; |
|
397 |
} |
|
398 |
||
399 |
/* [variable_name] location ':' located_var_spec_init */ |
|
400 |
/* variable_name -> may be NULL ! */ |
|
401 |
//SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
402 |
void *search_var_instance_decl_c::visit(located_var_decl_c *symbol) { |
|
403 |
if (symbol->variable_name != NULL && compare_identifiers(symbol->variable_name, search_name) == 0) |
|
404 |
return symbol->located_var_spec_init; |
|
405 |
else { |
|
406 |
current_type_decl = symbol->located_var_spec_init; |
|
407 |
return symbol->location->accept(*this); |
|
408 |
} |
|
409 |
} |
|
410 |
||
411 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
412 |
/* type_specification ->may be NULL ! */ |
|
413 |
// SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
414 |
// TODO!! |
|
415 |
||
416 |
/* AT direct_variable */ |
|
417 |
// SYM_REF2(location_c, direct_variable, unused) |
|
418 |
void *search_var_instance_decl_c::visit(location_c *symbol) { |
|
419 |
if (compare_identifiers(symbol->direct_variable, search_name) == 0) |
|
420 |
return current_type_decl; |
|
421 |
else |
|
422 |
return NULL; |
|
423 |
} |
|
424 |
||
425 |
/*| global_var_list ',' global_var_name */ |
|
426 |
// SYM_LIST(global_var_list_c) |
|
427 |
// TODO!! |
|
428 |
||
429 |
/* var1_list ':' single_byte_string_spec */ |
|
430 |
// SYM_REF2(single_byte_string_var_declaration_c, var1_list, single_byte_string_spec) |
|
431 |
void *search_var_instance_decl_c::visit(single_byte_string_var_declaration_c *symbol) { |
|
432 |
current_type_decl = symbol->single_byte_string_spec; |
|
433 |
return symbol->var1_list->accept(*this); |
|
434 |
} |
|
435 |
||
436 |
/* STRING ['[' integer ']'] [ASSIGN single_byte_character_string] */ |
|
437 |
/* integer ->may be NULL ! */ |
|
438 |
/* single_byte_character_string ->may be NULL ! */ |
|
439 |
// SYM_REF2(single_byte_string_spec_c, integer, single_byte_character_string) |
|
440 |
// TODO!! |
|
441 |
||
442 |
/* var1_list ':' double_byte_string_spec */ |
|
443 |
// SYM_REF2(double_byte_string_var_declaration_c, var1_list, double_byte_string_spec) |
|
444 |
void *search_var_instance_decl_c::visit(double_byte_string_var_declaration_c *symbol) { |
|
445 |
current_type_decl = symbol->double_byte_string_spec; |
|
446 |
return symbol->var1_list->accept(*this); |
|
447 |
} |
|
448 |
||
449 |
/* WSTRING ['[' integer ']'] [ASSIGN double_byte_character_string] */ |
|
450 |
/* integer ->may be NULL ! */ |
|
451 |
/* double_byte_character_string ->may be NULL ! */ |
|
452 |
// SYM_REF2(double_byte_string_spec_c, integer, double_byte_character_string) |
|
453 |
// TODO!! |
|
454 |
||
455 |
/* variable_name incompl_location ':' var_spec */ |
|
456 |
// SYM_REF4(incompl_located_var_decl_c, variable_name, incompl_location, var_spec, unused) |
|
457 |
// TODO!! |
|
458 |
||
459 |
/* AT incompl_location_token */ |
|
460 |
// SYM_TOKEN(incompl_location_c) |
|
461 |
// TODO!! |
|
462 |
||
463 |
||
464 |
/**************************************/ |
|
465 |
/* B.1.5 - Program organization units */ |
|
466 |
/**************************************/ |
|
467 |
/***********************/ |
|
468 |
/* B 1.5.1 - Functions */ |
|
469 |
/***********************/ |
|
470 |
// SYM_REF4(function_declaration_c, derived_function_name, type_name, var_declarations_list, function_body) |
|
471 |
void *search_var_instance_decl_c::visit(function_declaration_c *symbol) { |
|
472 |
/* functions have a variable named after themselves, to store |
|
473 |
* the variable that will be returned!! |
|
474 |
*/ |
|
475 |
if (compare_identifiers(symbol->derived_function_name, search_name) == 0) |
|
476 |
return symbol->type_name; |
|
477 |
||
478 |
/* no need to search through all the body, so we only |
|
479 |
* visit the variable declarations...! |
|
480 |
*/ |
|
481 |
return symbol->var_declarations_list->accept(*this); |
|
482 |
} |
|
483 |
||
484 |
/*****************************/ |
|
485 |
/* B 1.5.2 - Function Blocks */ |
|
486 |
/*****************************/ |
|
487 |
void *search_var_instance_decl_c::visit(function_block_declaration_c *symbol) { |
|
488 |
/* no need to search through all the body, so we only |
|
489 |
* visit the variable declarations...! |
|
490 |
*/ |
|
491 |
return symbol->var_declarations->accept(*this); |
|
492 |
} |
|
493 |
||
494 |
/**********************/ |
|
495 |
/* B 1.5.3 - Programs */ |
|
496 |
/**********************/ |
|
497 |
void *search_var_instance_decl_c::visit(program_declaration_c *symbol) { |
|
498 |
/* no need to search through all the body, so we only |
|
499 |
* visit the variable declarations...! |
|
500 |
*/ |
|
501 |
return symbol->var_declarations->accept(*this); |
|
502 |
} |
|
503 |
||
504 |
||
505 |
/********************************/ |
|
506 |
/* B 1.7 Configuration elements */ |
|
507 |
/********************************/ |
|
508 |
||
509 |
/* |
|
510 |
CONFIGURATION configuration_name |
|
511 |
optional_global_var_declarations |
|
512 |
(resource_declaration_list | single_resource_declaration) |
|
513 |
optional_access_declarations |
|
514 |
optional_instance_specific_initializations |
|
515 |
END_CONFIGURATION |
|
516 |
*/ |
|
517 |
/* |
|
518 |
SYM_REF6(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations, unused) |
|
519 |
*/ |
|
520 |
void *search_var_instance_decl_c::visit(configuration_declaration_c *symbol) { |
|
521 |
/* no need to search through all the configuration, so we only |
|
522 |
* visit the global variable declarations...! |
|
523 |
*/ |
|
524 |
if (symbol->global_var_declarations != NULL) |
|
525 |
return symbol->global_var_declarations->accept(*this); |
|
526 |
else |
|
527 |
return NULL; |
|
528 |
} |
|
529 |
||
530 |
/* |
|
531 |
RESOURCE resource_name ON resource_type_name |
|
532 |
optional_global_var_declarations |
|
533 |
single_resource_declaration |
|
534 |
END_RESOURCE |
|
535 |
*/ |
|
536 |
// SYM_REF4(resource_declaration_c, resource_name, resource_type_name, global_var_declarations, resource_declaration) |
|
537 |
void *search_var_instance_decl_c::visit(resource_declaration_c *symbol) { |
|
538 |
/* no need to search through all the resource, so we only |
|
539 |
* visit the global variable declarations...! |
|
540 |
*/ |
|
541 |
if (symbol->global_var_declarations != NULL) |
|
542 |
return symbol->global_var_declarations->accept(*this); |
|
543 |
else |
|
544 |
return NULL; |
|
545 |
} |
|
546 |
||
547 |
/* task_configuration_list program_configuration_list */ |
|
548 |
// SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list) |
|
549 |
void *search_var_instance_decl_c::visit(single_resource_declaration_c *symbol) { |
|
550 |
/* no need to search through all the resource, |
|
551 |
* and there is no global variable declarations...! |
|
552 |
*/ |
|
553 |
return NULL; |
|
554 |
} |
|
555 |