1 |
7
|
krennw
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
2
|
krennw
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
#include "AstFactory.hpp"
|
33 |
|
|
#include "Ast.hpp"
|
34 |
|
|
#include <base/Debug.hpp>
|
35 |
|
|
#include <base/Exceptions.hpp>
|
36 |
|
|
#include <ast/identifiers/Identifier.hpp>
|
37 |
|
|
#include <ast/identifiers/TypeIdentifier.hpp>
|
38 |
|
|
#include <ast/identifiers/EnumIdentifier.hpp>
|
39 |
|
|
#include <ast/identifiers/AttributeIdentifier.hpp>
|
40 |
|
|
#include <ast/identifiers/LocalVariableIdentifier.hpp>
|
41 |
|
|
#include <ast/identifiers/ParameterIdentifier.hpp>
|
42 |
|
|
#include <ast/identifiers/ExpressionVariableIdentifier.hpp>
|
43 |
|
|
#include <ast/identifiers/MethodIdentifier.hpp>
|
44 |
|
|
#include <ast/identifiers/NamedActionIdentifier.hpp>
|
45 |
|
|
#include <ast/identifiers/Module.hpp>
|
46 |
|
|
#include <ast/identifiers/IdentifierBlock.hpp>
|
47 |
|
|
#include <ast/identifiers/ConstantIdentifier.hpp>
|
48 |
|
|
#include <ast/types/IntType.hpp>
|
49 |
|
|
#include <ast/types/BoolType.hpp>
|
50 |
|
|
#include <ast/types/EnumType.hpp>
|
51 |
|
|
#include <ast/types/ValuedEnumType.hpp>
|
52 |
|
|
#include <ast/types/ListType.hpp>
|
53 |
|
|
#include <ast/types/TupleType.hpp>
|
54 |
|
|
#include <ast/types/NullType.hpp>
|
55 |
|
|
#include <ast/types/FunctionType.hpp>
|
56 |
|
|
#include <ast/types/ActionSystemType.hpp>
|
57 |
|
|
#include <ast/types/PointerType.hpp>
|
58 |
|
|
#include <ast/statements/GuardedCommand.hpp>
|
59 |
|
|
#include <ast/statements/Call.hpp>
|
60 |
|
|
#include <ast/statements/Assignment.hpp>
|
61 |
|
|
#include <ast/statements/SeqBlock.hpp>
|
62 |
|
|
#include <ast/statements/NondetBlock.hpp>
|
63 |
|
|
#include <ast/statements/PrioBlock.hpp>
|
64 |
|
|
#include <ast/statements/Skip.hpp>
|
65 |
|
|
#include <ast/statements/Break.hpp>
|
66 |
|
|
#include <ast/statements/Abort.hpp>
|
67 |
|
|
#include <ast/expressions/TernaryOperator.hpp>
|
68 |
|
|
#include <ast/expressions/BinaryOperator.hpp>
|
69 |
|
|
#include <ast/expressions/UnaryOperator.hpp>
|
70 |
|
|
#include <ast/expressions/ForallQuantifier.hpp>
|
71 |
|
|
#include <ast/expressions/ExistsQuantifier.hpp>
|
72 |
|
|
#include <ast/expressions/ListConstructor.hpp>
|
73 |
|
|
#include <ast/expressions/SetConstructor.hpp>
|
74 |
|
|
#include <ast/expressions/TupleConstructor.hpp>
|
75 |
|
|
#include <ast/expressions/ObjectConstructor.hpp>
|
76 |
|
|
#include <ast/expressions/ValueExpression.hpp>
|
77 |
|
|
#include <ast/expressions/IdentifierExpression.hpp>
|
78 |
|
|
#include <ast/expressions/TypeExpression.hpp>
|
79 |
|
|
#include <ast/expressions/TupleMapAccessExpression.hpp>
|
80 |
|
|
#include <ast/expressions/CallExpression.hpp>
|
81 |
|
|
#include <ast/expressions/AccessExpression.hpp>
|
82 |
|
|
#include <ast/identifiers/MainModule.hpp>
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
namespace Ast {
|
86 |
|
|
namespace Factory {
|
87 |
|
|
|
88 |
|
|
ActionSystemInstance* createActionSystemInstance(CallContext &context) {
|
89 |
|
|
return context.m_ast->createActionSystemInstance();
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
ExpressionList* createExpressionList(CallContext &context) {
|
93 |
|
|
return context.m_ast->createExpressionList();
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
IdentifierList* createIdentifierList(CallContext &context) {
|
97 |
|
|
return context.m_ast->createIdentifierList();
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
StatementList* createStatementList(CallContext &context) {
|
101 |
|
|
return context.m_ast->createStatementList();
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
Type* createType(CallContext &context, TypeKind t) {
|
106 |
|
|
return context.m_ast->createType(t);
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
Statement* createStatement(CallContext &context, StatementKind t) {
|
110 |
|
|
return context.m_ast->createStatement(t);
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
Identifier* createIdentifier(CallContext &context, IdentifierKind t) {
|
114 |
|
|
return context.m_ast->createIdentifier(t);
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
Expression* createExpression(CallContext &context, ExpressionKind t) {
|
118 |
|
|
return context.m_ast->createExpression(t);
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
SymbolTable* createSymbolTable(CallContext &context) {
|
126 |
|
|
return context.m_ast->createSymbolTable();
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
ParameterList* createParameterList(CallContext &context) {
|
133 |
|
|
return context.m_ast->createParameterList();
|
134 |
|
|
}
|
135 |
|
|
|
136 |
|
|
TypeList* createTypeList(CallContext &context) {
|
137 |
|
|
return context.m_ast->createTypeList();
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
ActionSystemInstanceList* createActionSystemInstanceList(CallContext &context) {
|
141 |
|
|
return context.m_ast->createActionSystemInstanceList();
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
bool addSymbolToTable(void* symbolTable, void* identifier) {
|
145 |
|
|
SymbolTable* table = (SymbolTable*) symbolTable;
|
146 |
|
|
Identifier* id = (Identifier*) identifier;
|
147 |
|
|
return table->addIdentifier(id);
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
bool addParameterToList(void* parameterList, void* parameterIdentifier) {
|
151 |
|
|
((ParameterList*)parameterList)->push_back((ParameterIdentifier*)parameterIdentifier);
|
152 |
|
|
return true;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
bool addTypeToList(void* typeList, void* type) {
|
156 |
|
|
((TypeList*)typeList)->push_back((Type*)type);
|
157 |
|
|
return true;
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
bool addActionSystemInstanceToList(void* objectsList, void* instanceRef) {
|
161 |
|
|
((ActionSystemInstanceList*)objectsList)->push_back((ActionSystemInstance*)instanceRef);
|
162 |
|
|
return true;
|
163 |
|
|
}
|
164 |
|
|
|
165 |
|
|
bool addIdentifierToBlock(void* idBlock, void* idRef){
|
166 |
|
|
((IdentifierBlock*)idBlock)->addElement((Identifier*)idRef);
|
167 |
|
|
return true;
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
bool addIdentifierToList(void* idList, void* idRef) {
|
171 |
|
|
((IdentifierList*)idList) -> push_back((Identifier*)idRef);
|
172 |
|
|
return true;
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
bool addExpressionToList(void* exprList, void* exprRef) {
|
176 |
|
|
((ExpressionList*)exprList) -> push_back((Expression*)exprRef);
|
177 |
|
|
return true;
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
bool addStatementToList(void* stmtList, void* stmtRef) {
|
181 |
|
|
((StatementList*)stmtList) -> push_back((Statement*)stmtRef);
|
182 |
|
|
return true;
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
bool initIdentifier(void* id, std::int32_t line, std::int32_t col, const char* text,
|
190 |
|
|
void* scopeRef, void* typeRef)
|
191 |
|
|
{
|
192 |
|
|
((Identifier*)id)->init(line,col,text,(IScope*)scopeRef,(Type*)typeRef);
|
193 |
|
|
return true;
|
194 |
|
|
}
|
195 |
|
|
bool initEnumIdentifier(void* enumId, std::int32_t line, std::int32_t col, const char* text,
|
196 |
|
|
void* scopeRef, void* typeRef, bool haveValue, std::int32_t value)
|
197 |
|
|
{
|
198 |
|
|
((EnumIdentifier*)enumId) -> init(line, col, text, (IScope*) scopeRef, (Type*) typeRef, haveValue, value);
|
199 |
|
|
return true;
|
200 |
|
|
}
|
201 |
|
|
bool initConstIdentifier(void* constId, std::int32_t line, std::int32_t col, const char* text,
|
202 |
|
|
void* scopeRef, void* typeRef, void* valueRef)
|
203 |
|
|
{
|
204 |
|
|
((ConstantIdentifier*)constId) -> init(line,col,text,(IScope*)scopeRef, (Type*)typeRef, (Expression*)valueRef);
|
205 |
|
|
return true;
|
206 |
|
|
}
|
207 |
|
|
bool initAttrIdentifier(void* attrId, std::int32_t line, std::int32_t col, const char* text,
|
208 |
|
|
void* scopeRef, void* typeRef, void* initRef,bool isStatic, bool isControllable, bool isObservable)
|
209 |
|
|
{
|
210 |
|
|
((AttributeIdentifier*)attrId) -> init(line, col, text, (IScope*) scopeRef, (Type*)typeRef,
|
211 |
|
|
(Expression*) initRef, isStatic, isControllable, isObservable);
|
212 |
|
|
return true;
|
213 |
|
|
}
|
214 |
|
|
bool initExprVarIdentifier(void* exprVarId, std::int32_t line, std::int32_t col, const char* text,
|
215 |
|
|
void* scopeRef, void* typeRef, bool initialized)
|
216 |
|
|
{
|
217 |
|
|
((ExpressionVariableIdentifier*) exprVarId) -> init(line, col, text, (IScope*)scopeRef,
|
218 |
|
|
(Type*)typeRef, initialized);
|
219 |
|
|
return true;
|
220 |
|
|
}
|
221 |
|
|
bool initTypeIdentifier(void* typeId, std::int32_t line, std::int32_t col, const char* text,
|
222 |
|
|
void* scopeRef, void* typeRef, const char* prefix)
|
223 |
|
|
{
|
224 |
|
|
((TypeIdentifier*)typeId)->init(line,col,text,(IScope*)scopeRef,(Type*)typeRef,prefix);
|
225 |
|
|
return true;
|
226 |
|
|
}
|
227 |
|
|
bool initMethodIdentifier(void* methodId, std::int32_t line, std::int32_t col, const char* text,
|
228 |
|
|
void* scopeRef, void* typeRef, const char* prefix, void* parameterListRef, void* symbolTableRef,
|
229 |
|
|
void* bodyRef)
|
230 |
|
|
{
|
231 |
|
|
((MethodIdentifier*)methodId) -> init(line,col,text,(IScope*)scopeRef, (Type*)typeRef,
|
232 |
|
|
prefix, (ParameterList*) parameterListRef, (SymbolTable*) symbolTableRef, (Block*) bodyRef);
|
233 |
|
|
return true;
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
bool initModule(void* moduleId, int line, int col, const char* text, void* scopeRef,
|
237 |
|
|
void* typeRef, const char* prefix, void* symTabRef)
|
238 |
|
|
{
|
239 |
|
|
((Module*)moduleId) ->init(line, col, text, (IScope*)scopeRef,
|
240 |
|
|
(Type*) typeRef, prefix, (SymbolTable*)symTabRef);
|
241 |
|
|
return true;
|
242 |
|
|
}
|
243 |
|
|
|
244 |
|
|
bool initMainModule(void* moduleId, int line, int col, const char* text, void* scopeRef,
|
245 |
|
|
void* typeRef, const char* prefix, void* symTabRef, void* idListRef)
|
246 |
|
|
{
|
247 |
|
|
((MainModule*)moduleId) ->init(line, col, text, (IScope*)scopeRef,
|
248 |
|
|
(Type*) typeRef, prefix, (SymbolTable*)symTabRef, (IdentifierBlock*) idListRef);
|
249 |
|
|
return true;
|
250 |
|
|
}
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
bool initIntType(void* typeId, void* identifierRef, bool anonymousType, std::int32_t low,
|
257 |
|
|
std::int32_t high)
|
258 |
|
|
{
|
259 |
|
|
((IntType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType, low, high);
|
260 |
|
|
return true;
|
261 |
|
|
}
|
262 |
|
|
bool initBoolType(void* typeId, void* identifierRef, bool anonymousType)
|
263 |
|
|
{
|
264 |
|
|
((BoolType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType);
|
265 |
|
|
return true;
|
266 |
|
|
}
|
267 |
|
|
bool initValuedEnumType(void* typeId, void* identifierRef, bool anonymousType, void* symTabRef,
|
268 |
|
|
void* intTypeRef)
|
269 |
|
|
{
|
270 |
|
|
((ValuedEnumType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType,
|
271 |
|
|
(SymbolTable*) symTabRef, (IntType*) intTypeRef);
|
272 |
|
|
return true;
|
273 |
|
|
}
|
274 |
|
|
bool initEnumType(void* typeId,void* identifierRef, bool anonymousType, void* symTabRef)
|
275 |
|
|
{
|
276 |
|
|
((EnumType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType,
|
277 |
|
|
(SymbolTable*) symTabRef);
|
278 |
|
|
return true;
|
279 |
|
|
}
|
280 |
|
|
bool initListType(void* typeId, void* identifierRef, bool anonymousType, void* innerTypeRef,
|
281 |
|
|
std::uint32_t maxNumberOfElements)
|
282 |
|
|
{
|
283 |
|
|
((ListType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType,
|
284 |
|
|
(Type*) innerTypeRef, maxNumberOfElements);
|
285 |
|
|
return true;
|
286 |
|
|
}
|
287 |
|
|
bool initTupleType(void* typeId, void* identifierRef, bool anonymousType, void* typeListRef)
|
288 |
|
|
{
|
289 |
|
|
((TupleType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType,
|
290 |
|
|
(TypeList*) typeListRef);
|
291 |
|
|
return true;
|
292 |
|
|
}
|
293 |
|
|
bool initFunctionType(void* typeId, void* identifierRef, bool anonymousType, void* paramTypeListRef,
|
294 |
|
|
void* returnTypeRef, std::int32_t functionKind, bool isPure)
|
295 |
|
|
{
|
296 |
|
|
((FunctionType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType,
|
297 |
|
|
(TypeList*) paramTypeListRef, (Type*)returnTypeRef, (FunctionKind) functionKind, isPure);
|
298 |
|
|
return true;
|
299 |
|
|
}
|
300 |
|
|
bool initActionSystemInstance(void* instance, void* typeRef, const char* name,
|
301 |
|
|
std::int32_t numOfCreatedObjs, void* parentInstanceRef)
|
302 |
|
|
{
|
303 |
|
|
((ActionSystemInstance*)instance) -> init( (ActionSystemType*) typeRef, name,
|
304 |
|
|
numOfCreatedObjs, (ActionSystemInstance*) parentInstanceRef);
|
305 |
|
|
return true;
|
306 |
|
|
}
|
307 |
|
|
bool initActionSystemType(void* typeId, void* identifierRef, bool anonymousType, void* baseTypeRef,
|
308 |
|
|
void* parentScopeRef, void* doOdBlockRef, void* symTab, void* objectsListRef,
|
309 |
|
|
void* derivedObjectsListRef, bool autoConstruction, bool isInSystemDescription)
|
310 |
|
|
{
|
311 |
|
|
((ActionSystemType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType,
|
312 |
|
|
(ActionSystemType*) baseTypeRef, (IScope*) parentScopeRef, (Block*) doOdBlockRef,
|
313 |
|
|
(SymbolTable*) symTab, (ActionSystemInstanceList*) objectsListRef,
|
314 |
|
|
(ActionSystemInstanceList*) derivedObjectsListRef, autoConstruction, isInSystemDescription);
|
315 |
|
|
return true;
|
316 |
|
|
}
|
317 |
|
|
bool initNullType(void* typeId, void* identifierRef, bool anonymousType)
|
318 |
|
|
{
|
319 |
|
|
((NullType*)typeId) -> init( (TypeIdentifier*) identifierRef, anonymousType);
|
320 |
|
|
return true;
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
bool initSkip(void* stmnt, std::int32_t line, std::int32_t col)
|
324 |
|
|
{
|
325 |
|
|
((Skip*)stmnt) -> init(line, col);
|
326 |
|
|
return true;
|
327 |
|
|
}
|
328 |
|
|
|
329 |
|
|
bool initBreak(void* stmnt, std::int32_t line, std::int32_t col)
|
330 |
|
|
{
|
331 |
|
|
((Break*)stmnt) -> init(line, col);
|
332 |
|
|
return true;
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
bool initAbort(void* stmnt, std::int32_t line, std::int32_t col)
|
336 |
|
|
{
|
337 |
|
|
((Abort*)stmnt) -> init(line, col);
|
338 |
|
|
return true;
|
339 |
|
|
}
|
340 |
|
|
|
341 |
|
|
bool initNondetBlock(void* block, std::int32_t line, std::int32_t col,
|
342 |
|
|
void* symTabRef, void* stmtListRef, void* scopeRef)
|
343 |
|
|
{
|
344 |
|
|
((NondetBlock*)block) -> init(line, col, (SymbolTable*) symTabRef,
|
345 |
|
|
(StatementList*) stmtListRef, (IScope*)scopeRef);
|
346 |
|
|
return true;
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
bool initSeqBlock(void* block, std::int32_t line, std::int32_t col,
|
350 |
|
|
void* symTabRef, void* stmtListRef, void* scopeRef, void* filterExprRef)
|
351 |
|
|
{
|
352 |
|
|
((SeqBlock*)block) -> init(line, col, (SymbolTable*) symTabRef,
|
353 |
|
|
(StatementList*) stmtListRef, (IScope*)scopeRef, (Expression*) filterExprRef);
|
354 |
|
|
return true;
|
355 |
|
|
}
|
356 |
|
|
|
357 |
|
|
bool initPrioBlock(void* block, std::int32_t line, std::int32_t col,
|
358 |
|
|
void* symTabRef, void* stmtListRef, void* scopeRef)
|
359 |
|
|
{
|
360 |
|
|
((PrioBlock*)block) -> init(line, col, (SymbolTable*) symTabRef,
|
361 |
|
|
(StatementList*) stmtListRef, (IScope*)scopeRef);
|
362 |
|
|
return true;
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
bool initGuardedCommand(void* stmt,std::int32_t line,std::int32_t pos,
|
366 |
|
|
void* scopeRef,void* guardExprRef,void* bodyRef)
|
367 |
|
|
{
|
368 |
|
|
((GuardedCommand*)stmt) -> init(line, pos, (IScope*) scopeRef, (Expression*) guardExprRef,
|
369 |
|
|
(Block*)bodyRef);
|
370 |
|
|
return true;
|
371 |
|
|
}
|
372 |
|
|
|
373 |
|
|
bool initAssignment(void* stmt,std::int32_t line,std::int32_t pos,void* scopeRef,
|
374 |
|
|
void* nonDetExprRef, void* placeExprListRef, void* valueExprListRef, void* symTabRef)
|
375 |
|
|
{
|
376 |
|
|
((Assignment*)stmt) -> init(line, pos, (IScope*) scopeRef,
|
377 |
|
|
(Expression*) nonDetExprRef, (ExpressionList*) placeExprListRef,
|
378 |
|
|
(ExpressionList*) valueExprListRef, (SymbolTable*)symTabRef);
|
379 |
|
|
return true;
|
380 |
|
|
}
|
381 |
|
|
|
382 |
|
|
bool initCall(void* stmt,std::int32_t line,std::int32_t pos,void* callExprRef)
|
383 |
|
|
{
|
384 |
|
|
((Call*)stmt) -> init(line,pos, (Expression*) callExprRef);
|
385 |
|
|
return true;
|
386 |
|
|
}
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
bool initTypeExpression(void* expr, std::int32_t line, std::int32_t pos,
|
391 |
|
|
void* typeRef, void* callTargetsIdentifierListRef, void* symbTabRef)
|
392 |
|
|
{
|
393 |
|
|
((TypeExpression*)expr)->init(line,pos,(Type*)typeRef,
|
394 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
395 |
|
|
(SymbolTable*)symbTabRef);
|
396 |
|
|
return true;
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
bool initIdentifierExpression(void* expr, std::int32_t line, std::int32_t pos,
|
400 |
|
|
void* typeRef, void* callTargetsIdentifierListRef, void* symbTabRef, void* identifierRef,
|
401 |
|
|
bool isSelf)
|
402 |
|
|
{
|
403 |
|
|
((IdentifierExpression*)expr)->init(line,pos,(Type*)typeRef,
|
404 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
405 |
|
|
(SymbolTable*)symbTabRef, (Identifier*) identifierRef, isSelf);
|
406 |
|
|
return true;
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
bool initUnaryExpression(void* expr, std::int32_t line, std::int32_t pos,
|
410 |
|
|
void* typeRef, void* callTargetsIdentifierListRef, void* symbTabRef,
|
411 |
|
|
void* child)
|
412 |
|
|
{
|
413 |
|
|
((UnaryOperator*)expr)->init(line,pos,(Type*)typeRef,
|
414 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
415 |
|
|
(SymbolTable*)symbTabRef, (Expression*) child);
|
416 |
|
|
return true;
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
bool initBinaryExpression(void* expr, std::int32_t line, std::int32_t pos,
|
420 |
|
|
void* typeRef, void* callTargetsIdentifierListRef, void* symbTabRef,
|
421 |
|
|
void* left, void* right)
|
422 |
|
|
{
|
423 |
|
|
((BinaryOperator*)expr)->init(line,pos,(Type*)typeRef,
|
424 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
425 |
|
|
(SymbolTable*)symbTabRef, (Expression*) left, (Expression*)right);
|
426 |
|
|
return true;
|
427 |
|
|
}
|
428 |
|
|
|
429 |
|
|
bool initTernaryExpression(void* expr, std::int32_t line, std::int32_t pos,
|
430 |
|
|
void* typeRef, void* callTargetsIdentifierListRef, void* symbTabRef,
|
431 |
|
|
void* left, void* mid, void* right, void* defScopeRef)
|
432 |
|
|
{
|
433 |
|
|
((TernaryOperator*)expr)->init(line,pos,(Type*)typeRef,
|
434 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
435 |
|
|
(SymbolTable*)symbTabRef, (Expression*) left,
|
436 |
|
|
(Expression*)mid, (Expression*)right, (Scope*) defScopeRef);
|
437 |
|
|
return true;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
bool initIntValueExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
441 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef, std::int32_t value)
|
442 |
|
|
{
|
443 |
|
|
((IntValueExpression*)expr)->init(line,pos,(Type*)typeRef,
|
444 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
445 |
|
|
(SymbolTable*)symbTabRef, value);
|
446 |
|
|
return true;
|
447 |
|
|
}
|
448 |
|
|
|
449 |
|
|
bool initBoolValueExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
450 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,bool value)
|
451 |
|
|
{
|
452 |
|
|
((BoolValueExpression*)expr)->init(line,pos,(Type*)typeRef,
|
453 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
454 |
|
|
(SymbolTable*)symbTabRef, value);
|
455 |
|
|
return true;
|
456 |
|
|
}
|
457 |
|
|
|
458 |
|
|
bool initRefValueExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
459 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef, void* value)
|
460 |
|
|
{
|
461 |
|
|
((RefValueExpression*)expr)->init(line,pos,(Type*)typeRef,
|
462 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
463 |
|
|
(SymbolTable*)symbTabRef, value);
|
464 |
|
|
return true;
|
465 |
|
|
}
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
bool initListConstructor(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
469 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
470 |
|
|
void* exprList, void* symTab, void* parentScope,
|
471 |
|
|
void* comprehension, bool hasComprehension)
|
472 |
|
|
{
|
473 |
|
|
((ListConstructor*)expr) ->init(line,pos,(Type*)typeRef,
|
474 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
475 |
|
|
(SymbolTable*)symbTabRef, (ExpressionList*) exprList,
|
476 |
|
|
(SymbolTable*)symTab, (IScope*) parentScope,
|
477 |
|
|
(Expression*) comprehension, hasComprehension);
|
478 |
|
|
return true;
|
479 |
|
|
}
|
480 |
|
|
|
481 |
|
|
bool initSetConstructor(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
482 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
483 |
|
|
void* exprList, void* symTab, void* parentScope,
|
484 |
|
|
void* comprehension, bool hasComprehension)
|
485 |
|
|
{
|
486 |
|
|
((SetConstructor*)expr) ->init(line,pos,(Type*)typeRef,
|
487 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
488 |
|
|
(SymbolTable*)symbTabRef, (ExpressionList*) exprList,
|
489 |
|
|
(SymbolTable*)symTab, (IScope*) parentScope,
|
490 |
|
|
(Expression*) comprehension, hasComprehension);
|
491 |
|
|
return true;
|
492 |
|
|
}
|
493 |
|
|
|
494 |
|
|
bool initTupleConstructor(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
495 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
496 |
|
|
void* exprList, void* tupleTypeId, bool isMatcher)
|
497 |
|
|
{
|
498 |
|
|
((TupleConstructor*)expr)->init(line,pos,(Type*)typeRef,
|
499 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
500 |
|
|
(SymbolTable*)symbTabRef, (ExpressionList*) exprList,
|
501 |
|
|
(Identifier*) tupleTypeId, isMatcher);
|
502 |
|
|
return true;
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
bool initAccessExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
506 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
507 |
|
|
void* left, void* right)
|
508 |
|
|
{
|
509 |
|
|
((AccessExpression*)expr)->init(line,pos,(Type*)typeRef,
|
510 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
511 |
|
|
(SymbolTable*)symbTabRef, (Expression*) left, (Expression*) right);
|
512 |
|
|
return true;
|
513 |
|
|
}
|
514 |
|
|
|
515 |
|
|
bool initTupleMapAccessExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
516 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
517 |
|
|
void* child, void* argument)
|
518 |
|
|
{
|
519 |
|
|
((TupleMapAccessExpression*)expr)->init(line,pos,(Type*)typeRef,
|
520 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
521 |
|
|
(SymbolTable*)symbTabRef, (Expression*) child, (Expression*) argument);
|
522 |
|
|
return true;
|
523 |
|
|
}
|
524 |
|
|
|
525 |
|
|
bool initCallExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
526 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
527 |
|
|
void* child, void* argumentList, void* scopeRef)
|
528 |
|
|
{
|
529 |
|
|
((CallExpression*)expr)->init(line,pos,(Type*)typeRef,
|
530 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
531 |
|
|
(SymbolTable*)symbTabRef, (Expression*) child, (ExpressionList*) argumentList,
|
532 |
|
|
(IScope*)scopeRef);
|
533 |
|
|
return true;
|
534 |
|
|
}
|
535 |
|
|
|
536 |
|
|
bool initQuantifierExpression(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
537 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
538 |
|
|
void* child, void* symTabRef, void* scopeRef)
|
539 |
|
|
{
|
540 |
|
|
((Quantifier*)expr)->init(line,pos,(Type*)typeRef,
|
541 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
542 |
|
|
(SymbolTable*)symbTabRef, (Expression*) child,
|
543 |
|
|
(SymbolTable*) symTabRef, (IScope*) scopeRef);
|
544 |
|
|
return true;
|
545 |
|
|
}
|
546 |
|
|
|
547 |
|
|
bool initObjectConstructor(void* expr, std::int32_t line, std::int32_t pos, void* typeRef,
|
548 |
|
|
void* callTargetsIdentifierListRef, void* symbTabRef,
|
549 |
|
|
void* instanceList, std::uint32_t currentInstance, const char* name)
|
550 |
|
|
{
|
551 |
|
|
((ObjectConstructor*)expr)->init(line,pos,(Type*)typeRef,
|
552 |
|
|
(IdentifierList*)callTargetsIdentifierListRef,
|
553 |
|
|
(SymbolTable*)symbTabRef,(ActionSystemInstanceList*) instanceList,
|
554 |
|
|
currentInstance, name);
|
555 |
|
|
|
556 |
|
|
return true;
|
557 |
|
|
}
|
558 |
|
|
|
559 |
|
|
|
560 |
|
|
}} |