author | mjsousa |
Sun, 14 Dec 2014 19:15:29 +0000 | |
changeset 964 | 5f4dfe6670da |
parent 596 | 4efb11e44065 |
child 1041 | 56ebe2a31b5b |
permissions | -rwxr-xr-x |
347
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
1 |
/* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
3 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
4 |
* Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
5 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
6 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
7 |
* This program is free software: you can redistribute it and/or modify |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
8 |
* it under the terms of the GNU General Public License as published by |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
9 |
* the Free Software Foundation, either version 3 of the License, or |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
10 |
* (at your option) any later version. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
11 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
12 |
* This program is distributed in the hope that it will be useful, |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
15 |
* GNU General Public License for more details. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
16 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
19 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
20 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
21 |
* This code is made available on the understanding that it will not be |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
22 |
* used in safety-critical situations without a full and competent review. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
23 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
24 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
25 |
/* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
26 |
* An IEC 61131-3 compiler. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
27 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
28 |
* Based on the |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
29 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
30 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
31 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
32 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
33 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
34 |
/* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
35 |
* Case element iterator. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
36 |
* Iterate through the elements of a case list. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
37 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
38 |
* This is part of the 4th stage that generates |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
39 |
* a c++ source program equivalent to the IL and ST |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
40 |
* code. |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
41 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
42 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
43 |
/* Given a case_list_c and a type of element, iterate through |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
44 |
* each element, returning the symbol of each element if from |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
45 |
* the good type...case_element_iterator_c |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
46 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
47 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
48 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
49 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
50 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
51 |
#include "case_element_iterator.hh" |
596
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
377
diff
changeset
|
52 |
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros. |
347
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
53 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
54 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
55 |
//#define DEBUG |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
56 |
#ifdef DEBUG |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
57 |
#define TRACE(classname) printf("\n____%s____\n",classname); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
58 |
#else |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
59 |
#define TRACE(classname) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
60 |
#endif |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
61 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
62 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
63 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
64 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
65 |
void* case_element_iterator_c::handle_case_element(symbol_c *case_element) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
66 |
if (current_case_element == case_element) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
67 |
current_case_element = NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
68 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
69 |
else if (current_case_element == NULL) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
70 |
current_case_element = case_element; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
71 |
return case_element; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
72 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
73 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
74 |
/* Not found! */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
75 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
76 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
77 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
78 |
void* case_element_iterator_c::iterate_list(list_c *list) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
79 |
void *res; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
80 |
for (int i = 0; i < list->n; i++) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
81 |
res = list->elements[i]->accept(*this); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
82 |
if (res != NULL) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
83 |
return res; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
84 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
85 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
86 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
87 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
88 |
/* start off at the first case element once again... */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
89 |
void case_element_iterator_c::reset(void) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
90 |
current_case_element = NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
91 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
92 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
93 |
|
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
347
diff
changeset
|
94 |
/* initialize the iterator object. |
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
347
diff
changeset
|
95 |
* We must be given a reference to a case_list_c that will be analyzed... |
347
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
96 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
97 |
case_element_iterator_c::case_element_iterator_c(symbol_c *list, case_element_t element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
98 |
/* do some consistency check... */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
99 |
case_list_c* case_list = dynamic_cast<case_list_c*>(list); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
100 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
101 |
if (NULL == case_list) ERROR; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
102 |
|
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
347
diff
changeset
|
103 |
/* OK. Now initialize this object... */ |
347
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
104 |
this->case_list = list; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
105 |
this->wanted_element_type = element_type; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
106 |
reset(); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
107 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
108 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
109 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
110 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
111 |
/* Skip to the next case element of type chosen. After object creation, |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
112 |
* the object references on case element _before_ the first, so |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
113 |
* this function must be called once to get the object to |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
114 |
* reference the first element... |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
115 |
* |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
116 |
* Returns the case element's symbol! |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
117 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
118 |
symbol_c *case_element_iterator_c::next(void) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
119 |
void *res = case_list->accept(*this); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
120 |
if (res == NULL) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
121 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
122 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
123 |
return current_case_element; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
124 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
125 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
126 |
/******************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
127 |
/* B 1.2.1 - Numeric Literals */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
128 |
/******************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
129 |
void *case_element_iterator_c::visit(integer_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
130 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
131 |
case element_single: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
132 |
return handle_case_element(symbol); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
133 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
134 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
135 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
136 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
137 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
138 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
139 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
140 |
void *case_element_iterator_c::visit(neg_integer_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
141 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
142 |
case element_single: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
143 |
return handle_case_element(symbol); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
144 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
145 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
146 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
147 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
148 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
149 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
150 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
151 |
/********************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
152 |
/* B 1.3.3 - Derived data types */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
153 |
/********************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
154 |
/* signed_integer DOTDOT signed_integer */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
155 |
void *case_element_iterator_c::visit(subrange_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
156 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
157 |
case element_subrange: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
158 |
return handle_case_element(symbol); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
159 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
160 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
161 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
162 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
163 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
164 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
165 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
166 |
/* enumerated_type_name '#' identifier */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
167 |
void *case_element_iterator_c::visit(enumerated_value_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
168 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
169 |
case element_single: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
170 |
return handle_case_element(symbol); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
171 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
172 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
173 |
break; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
174 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
175 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
176 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
177 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
178 |
/********************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
179 |
/* B 3.2.3 Selection Statements */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
180 |
/********************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
181 |
void *case_element_iterator_c::visit(case_list_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
182 |
return iterate_list(symbol); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
183 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
184 |