author | Mario de Sousa <msousa@fe.up.pt> |
Fri, 13 Apr 2012 13:05:44 +0100 | |
changeset 503 | e1e7c7678c44 |
parent 377 | 60b012b7793f |
child 596 | 4efb11e44065 |
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" |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
52 |
|
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 |
//#define DEBUG |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
55 |
#ifdef DEBUG |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
56 |
#define TRACE(classname) printf("\n____%s____\n",classname); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
57 |
#else |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
58 |
#define TRACE(classname) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
59 |
#endif |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
60 |
|
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 |
#define ERROR error_exit(__FILE__,__LINE__) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
63 |
/* function defined in main.cc */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
64 |
extern void error_exit(const char *file_name, int line_no); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
65 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
66 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
67 |
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
|
68 |
if (current_case_element == case_element) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
69 |
current_case_element = NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
70 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
71 |
else if (current_case_element == NULL) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
72 |
current_case_element = case_element; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
73 |
return case_element; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
74 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
75 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
76 |
/* Not found! */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
77 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
78 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
79 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
80 |
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
|
81 |
void *res; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
82 |
for (int i = 0; i < list->n; i++) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
83 |
res = list->elements[i]->accept(*this); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
84 |
if (res != NULL) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
85 |
return res; |
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 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
88 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
89 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
90 |
/* start off at the first case element once again... */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
91 |
void case_element_iterator_c::reset(void) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
92 |
current_case_element = NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
93 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
94 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
95 |
|
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
347
diff
changeset
|
96 |
/* initialize the iterator object. |
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
347
diff
changeset
|
97 |
* 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
|
98 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
99 |
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
|
100 |
/* do some consistency check... */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
101 |
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
|
102 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
103 |
if (NULL == case_list) ERROR; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
104 |
|
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
347
diff
changeset
|
105 |
/* OK. Now initialize this object... */ |
347
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
106 |
this->case_list = list; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
107 |
this->wanted_element_type = element_type; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
108 |
reset(); |
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 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
112 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
113 |
/* 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
|
114 |
* 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
|
115 |
* 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
|
116 |
* reference the first element... |
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 |
* Returns the case element's symbol! |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
119 |
*/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
120 |
symbol_c *case_element_iterator_c::next(void) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
121 |
void *res = case_list->accept(*this); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
122 |
if (res == NULL) |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
123 |
return NULL; |
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 |
return current_case_element; |
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 |
|
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 |
/* B 1.2.1 - Numeric Literals */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
130 |
/******************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
131 |
void *case_element_iterator_c::visit(integer_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
132 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
133 |
case element_single: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
134 |
return handle_case_element(symbol); |
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 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
137 |
break; |
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 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
140 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
141 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
142 |
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
|
143 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
144 |
case element_single: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
145 |
return handle_case_element(symbol); |
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 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
148 |
break; |
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 |
return NULL; |
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 |
|
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 |
/* B 1.3.3 - Derived data types */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
155 |
/********************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
156 |
/* signed_integer DOTDOT signed_integer */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
157 |
void *case_element_iterator_c::visit(subrange_c *symbol) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
158 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
159 |
case element_subrange: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
160 |
return handle_case_element(symbol); |
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 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
163 |
break; |
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 |
return NULL; |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
166 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
167 |
|
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
168 |
/* enumerated_type_name '#' identifier */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
169 |
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
|
170 |
switch (wanted_element_type) { |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
171 |
case element_single: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
172 |
return handle_case_element(symbol); |
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 |
default: |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
175 |
break; |
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 |
return NULL; |
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 |
|
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 |
/* B 3.2.3 Selection Statements */ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
182 |
/********************************/ |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
183 |
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
|
184 |
return iterate_list(symbol); |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
185 |
} |
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
diff
changeset
|
186 |