author | mjsousa |
Sun, 19 Oct 2014 11:53:36 +0100 | |
changeset 937 | 887e7d90445a |
parent 912 | 252a69d6ecae |
child 945 | 477393b00f95 |
permissions | -rwxr-xr-x |
181 | 1 |
/* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
181
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
181 | 3 |
* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
181
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 |
181 | 6 |
* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
181
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:
181
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:
181
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:
181
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:
181
diff
changeset
|
11 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
181
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:
181
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:
181
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:
181
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:
181
diff
changeset
|
16 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
181
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:
181
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:
181
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:
181
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 |
||
33 |
/* |
|
34 |
* Seperation of type specification and default value constructs |
|
35 |
* (for e.g. simple_spec_init_c), into a type specificiation part, |
|
36 |
* and a default value part. |
|
37 |
*/ |
|
38 |
||
39 |
#include "spec_init_separator.hh" |
|
596
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
40 |
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros. |
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
41 |
|
181 | 42 |
|
43 |
//#define DEBUG |
|
44 |
#ifdef DEBUG |
|
45 |
#define TRACE(classname) printf("\n____%s____\n",classname); |
|
46 |
#else |
|
47 |
#define TRACE(classname) |
|
48 |
#endif |
|
49 |
||
50 |
||
51 |
||
52 |
spec_init_sperator_c *spec_init_sperator_c::get_class_instance(void) { |
|
53 |
if (NULL == class_instance) |
|
54 |
class_instance = new spec_init_sperator_c(); |
|
55 |
||
56 |
if (NULL == class_instance) |
|
57 |
ERROR; |
|
58 |
||
59 |
return class_instance; |
|
60 |
} |
|
61 |
||
62 |
/* the only two public functions... */ |
|
63 |
symbol_c *spec_init_sperator_c::get_spec(symbol_c *spec_init) { |
|
64 |
search_what = search_spec; |
|
65 |
return (symbol_c *)spec_init->accept(*get_class_instance()); |
|
66 |
} |
|
67 |
||
68 |
symbol_c *spec_init_sperator_c::get_init(symbol_c *spec_init) { |
|
69 |
search_what = search_init; |
|
70 |
return (symbol_c *)spec_init->accept(*get_class_instance()); |
|
71 |
} |
|
72 |
||
73 |
/*******************************************/ |
|
74 |
/* B 1.1 - Letters, digits and identifiers */ |
|
75 |
/*******************************************/ |
|
76 |
// SYM_TOKEN(identifier_c) |
|
77 |
void *spec_init_sperator_c::visit(identifier_c *symbol) { |
|
78 |
TRACE("spec_init_sperator_c::identifier_c"); |
|
79 |
switch (search_what) { |
|
80 |
/* if we ever get called sith a simple identifier_c, then it must be a previously declared type... */ |
|
81 |
case search_spec: return symbol; |
|
82 |
case search_init: return NULL; |
|
83 |
} |
|
84 |
ERROR; /* should never occur */ |
|
85 |
return NULL; |
|
86 |
} |
|
87 |
||
88 |
||
89 |
/********************************/ |
|
90 |
/* B 1.3.3 - Derived data types */ |
|
91 |
/********************************/ |
|
92 |
||
93 |
/* simple_specification ASSIGN constant */ |
|
94 |
void *spec_init_sperator_c::visit(simple_spec_init_c *symbol) { |
|
95 |
TRACE("spec_init_sperator_c::simple_spec_init_c"); |
|
96 |
switch (search_what) { |
|
97 |
case search_spec: return symbol->simple_specification; |
|
98 |
case search_init: return symbol->constant; |
|
99 |
} |
|
100 |
ERROR; /* should never occur */ |
|
101 |
return NULL; |
|
102 |
} |
|
103 |
||
104 |
/* subrange_specification ASSIGN signed_integer */ |
|
105 |
void *spec_init_sperator_c::visit(subrange_spec_init_c *symbol) { |
|
106 |
TRACE("spec_init_sperator_c::subrange_spec_init_c"); |
|
107 |
switch (search_what) { |
|
108 |
case search_spec: return symbol->subrange_specification->accept(*this); |
|
109 |
case search_init: return symbol->signed_integer; |
|
110 |
} |
|
111 |
ERROR; /* should never occur */ |
|
112 |
return NULL; |
|
113 |
} |
|
114 |
||
115 |
/* integer_type_name '(' subrange')' */ |
|
116 |
void *spec_init_sperator_c::visit(subrange_specification_c *symbol) { |
|
117 |
TRACE("spec_init_sperator_c::subrange_specification_c"); |
|
118 |
switch (search_what) { |
|
119 |
case search_spec: return symbol->integer_type_name; |
|
120 |
case search_init: return NULL; /* should never occur */ |
|
121 |
} |
|
122 |
ERROR; /* should never occur */ |
|
123 |
return NULL; |
|
124 |
} |
|
125 |
||
126 |
/* array_specification [ASSIGN array_initialization} */ |
|
127 |
/* array_initialization may be NULL ! */ |
|
128 |
void *spec_init_sperator_c::visit(array_spec_init_c *symbol) { |
|
129 |
TRACE("spec_init_sperator_c::array_spec_init_c"); |
|
130 |
switch (search_what) { |
|
131 |
case search_spec: return symbol->array_specification; |
|
132 |
case search_init: return symbol->array_initialization; |
|
133 |
} |
|
134 |
return NULL; |
|
135 |
} |
|
136 |
||
912
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
137 |
/* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
138 |
/* NOTE: this symbol may be used directly in implictly defined variables in VAR_TEMP!! |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
139 |
* so we must consider it here too! |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
140 |
*/ |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
141 |
void *spec_init_sperator_c::visit(array_specification_c *symbol) { |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
142 |
TRACE("spec_init_sperator_c::array_spec_init_c"); |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
143 |
switch (search_what) { |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
144 |
case search_spec: return symbol; |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
145 |
case search_init: return NULL; |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
146 |
} |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
147 |
return NULL; |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
148 |
} |
252a69d6ecae
array_specification_c may be used as a datatype! Add it to spec_init_separator_c
mjsousa
parents:
909
diff
changeset
|
149 |
|
181 | 150 |
/* enumerated_specification ASSIGN enumerated_value */ |
151 |
void *spec_init_sperator_c::visit(enumerated_spec_init_c *symbol) { |
|
152 |
TRACE("spec_init_sperator_c::enumerated_spec_init_c"); |
|
153 |
switch (search_what) { |
|
154 |
case search_spec: return symbol->enumerated_specification; |
|
155 |
case search_init: return symbol->enumerated_value; |
|
156 |
} |
|
157 |
ERROR; /* should never occur */ |
|
158 |
return NULL; |
|
159 |
} |
|
160 |
||
161 |
/* structure_type_name ASSIGN structure_initialization */ |
|
162 |
/* structure_initialization may be NULL ! */ |
|
163 |
//SYM_REF2(initialized_structure_c, structure_type_name, structure_initialization) |
|
164 |
void *spec_init_sperator_c::visit(initialized_structure_c *symbol) { |
|
165 |
TRACE("spec_init_sperator_c::initialized_structure_c"); |
|
166 |
switch (search_what) { |
|
167 |
case search_spec: return symbol->structure_type_name; |
|
168 |
case search_init: return symbol->structure_initialization; |
|
169 |
} |
|
170 |
ERROR; /* should never occur */ |
|
171 |
return NULL; |
|
172 |
} |
|
173 |
||
810
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
174 |
/* function_block_type_name ASSIGN structure_initialization */ |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
175 |
/* structure_initialization -> may be NULL ! */ |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
176 |
//SYM_REF2(fb_spec_init_c, function_block_type_name, structure_initialization) |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
177 |
void *spec_init_sperator_c::visit(fb_spec_init_c *symbol) { |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
178 |
TRACE("spec_init_sperator_c::fb_spec_init_c"); |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
179 |
switch (search_what) { |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
180 |
case search_spec: return symbol->function_block_type_name; |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
181 |
case search_init: return symbol->structure_initialization; |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
182 |
} |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
183 |
ERROR; /* should never occur */ |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
184 |
return NULL; |
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
185 |
} |
181 | 186 |
|
909
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
187 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
188 |
/* ref_spec: REF_TO (non_generic_type_name | function_block_type_name) */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
189 |
// SYM_REF1(ref_spec_c, type_name) |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
190 |
void *spec_init_sperator_c::visit(ref_spec_c *symbol) { |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
191 |
TRACE("spec_init_sperator_c::ref_spec_c"); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
192 |
/* This visitor should never really be called, but there is no harm in including it... */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
193 |
switch (search_what) { |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
194 |
case search_spec: return symbol; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
195 |
case search_init: return NULL; /* should never occur */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
196 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
197 |
ERROR; /* should never occur */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
198 |
return NULL; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
199 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
200 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
201 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
202 |
/* For the moment, we do not support initialising reference data types */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
203 |
/* ref_spec_init: ref_spec [ ASSIGN ref_initialization ] */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
204 |
/* NOTE: ref_initialization may be NULL!! */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
205 |
// SYM_REF2(ref_spec_init_c, ref_spec, ref_initialization) |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
206 |
void *spec_init_sperator_c::visit(ref_spec_init_c *symbol) { |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
207 |
TRACE("spec_init_sperator_c::ref_spec_init_c"); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
208 |
switch (search_what) { |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
209 |
case search_spec: return symbol->ref_spec; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
210 |
case search_init: return symbol->ref_initialization; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
211 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
212 |
ERROR; /* should never occur */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
213 |
return NULL; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
214 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
215 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
216 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
810
diff
changeset
|
217 |
|
181 | 218 |
/******************************************/ |
219 |
/* B 1.4.3 - Declaration & Initialisation */ |
|
220 |
/******************************************/ |
|
221 |
||
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
222 |
/* STRING '[' integer ']' |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
223 |
* STRING ASSIGN single_byte_character_string |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
224 |
* STRING '[' integer ']' ASSIGN single_byte_character_string |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
225 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
226 |
void *spec_init_sperator_c::visit(single_byte_string_spec_c *symbol) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
227 |
TRACE("spec_init_sperator_c::single_byte_string_spec_c"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
228 |
switch (search_what) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
229 |
case search_spec: return symbol->string_spec; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
230 |
case search_init: return symbol->single_byte_character_string; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
231 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
232 |
ERROR; /* should never occur */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
233 |
return NULL; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
234 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
235 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
236 |
/* WSTRING '[' integer ']' |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
237 |
* WSTRING ASSIGN double_byte_character_string |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
238 |
* WSTRING '[' integer ']' ASSIGN double_byte_character_string |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
239 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
240 |
void *spec_init_sperator_c::visit(double_byte_string_spec_c *symbol) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
241 |
TRACE("spec_init_sperator_c::double_byte_string_spec_c"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
242 |
switch (search_what) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
243 |
case search_spec: return symbol->string_spec; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
244 |
case search_init: return symbol->double_byte_character_string; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
245 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
246 |
ERROR; /* should never occur */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
247 |
return NULL; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
248 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
249 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
250 |
|
181 | 251 |
spec_init_sperator_c *spec_init_sperator_c ::class_instance = NULL; |
252 |
spec_init_sperator_c::search_what_t spec_init_sperator_c::search_what; |