1
|
/**
|
2
|
*
|
3
|
* OOAS Compiler (Deprecated)
|
4
|
*
|
5
|
* Copyright 2015, Institute for Software Technology, Graz University of
|
6
|
* Technology. Portions are copyright 2015 by the AIT Austrian Institute
|
7
|
* of Technology. All rights reserved.
|
8
|
*
|
9
|
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
10
|
*
|
11
|
* Please notice that this version of the OOAS compiler is considered de-
|
12
|
* precated. Only the Java version is maintained.
|
13
|
*
|
14
|
* Contributors:
|
15
|
* Willibald Krenn (TU Graz/AIT)
|
16
|
* Stefan Tiran (TU Graz/AIT)
|
17
|
*/
|
18
|
|
19
|
using System;
|
20
|
using System.Collections.Generic;
|
21
|
using System.Text;
|
22
|
|
23
|
namespace TUG.Mogentes
|
24
|
{
|
25
|
/*Notice: The visitor must implement the traversal!*/
|
26
|
public interface IAstVisitor
|
27
|
{
|
28
|
string returnVisitorName();
|
29
|
|
30
|
/*Identifiers*/
|
31
|
void visit(EnumIdentifier enumIdentifier);
|
32
|
void visit(LandmarkIdentifier landmarkIdentifier);
|
33
|
void visit(AttributeIdentifier attributeIdentifier);
|
34
|
void visit(ExpressionVariableIdentifier expressionVariableIdentifier);
|
35
|
void visit(ParameterIdentifier parameterIdentifier);
|
36
|
void visit(LocalVariableIdentifier localVariableIdentifier);
|
37
|
void visit(TypeIdentifier typeIdentifier);
|
38
|
void visit(SelfTypeIdentifier typeIdentifier);
|
39
|
void visit(MethodIdentifier methodIdentifier);
|
40
|
void visit(NamedActionIdentifier namedActionIdentifier);
|
41
|
void visit(MainModule mainModule);
|
42
|
void visit(Module module);
|
43
|
void visit(NondetIdentifierList nondetIdentifierList);
|
44
|
void visit(SeqIdentifierList seqIdentifierList);
|
45
|
void visit(PrioIdentifierList prioIdentifierList);
|
46
|
void visit(UnspecIdentifierList unspecIdentifierList);
|
47
|
|
48
|
|
49
|
/*Statements*/
|
50
|
void visit(NondetBlock nondetBlock);
|
51
|
void visit(SeqBlock seqBlock);
|
52
|
void visit(PrioBlock prioBlock);
|
53
|
void visit(GuardedCommand guardedCommand);
|
54
|
void visit(Assignment assignment);
|
55
|
void visit(Call call);
|
56
|
void visit(SkipStatement skipStatement);
|
57
|
void visit(AbortStatement abortStatement);
|
58
|
void visit(KillStatement killStatement);
|
59
|
|
60
|
|
61
|
/*Expressions*/
|
62
|
void visit<T>(ValueExpression<T> valueExpression);
|
63
|
void visit(UnresolvedIdentifierExpression unresolvedIdentifierExpression);
|
64
|
void visit(IdentifierExpression identifierExpression);
|
65
|
void visit(ListConstructor listConstructor);
|
66
|
void visit(SetConstructor setConstructor);
|
67
|
void visit(MapConstructor mapConstructor);
|
68
|
void visit(TupleConstructor tupleConstructor);
|
69
|
void visit(AccessExpression accessExpression);
|
70
|
void visit(BinaryOperator binaryOperator);
|
71
|
void visit(TernaryOperator ternaryOperator);
|
72
|
void visit(TupleMapAccessExpression tupleMapAccessExpression);
|
73
|
void visit(CallExpression callExpression);
|
74
|
void visit(ForallQuantifier quantifier);
|
75
|
void visit(ExistsQuantifier quantifier);
|
76
|
void visit(UnaryOperator unaryOperator);
|
77
|
void visit(TypeExpression typeExpression);
|
78
|
void visit(NullType nullType);
|
79
|
|
80
|
/*Types*/
|
81
|
void visit(CharType charType);
|
82
|
void visit(IntType intType);
|
83
|
void visit(BoolType boolType);
|
84
|
void visit(FloatType floatType);
|
85
|
void visit(EnumType enumType);
|
86
|
void visit(ListType listType);
|
87
|
void visit(MapType mapType);
|
88
|
void visit(QrType qrType);
|
89
|
void visit(TupleType tupleType);
|
90
|
void visit(FunctionType functionType);
|
91
|
void visit(OoActionSystemType ooActionSystemType);
|
92
|
void visit(OpaqueType opaqueType);
|
93
|
|
94
|
void visit(AnyType anyType);
|
95
|
|
96
|
void visit(ObjectConstructor objectConstructor);
|
97
|
|
98
|
void visit(QValConstructor qValConstructor);
|
99
|
|
100
|
void visit(QualitativeConstraintStatement qalitativeConstraintStatement);
|
101
|
|
102
|
void visit(ConstantIdentifier constantIdentifier);
|
103
|
}
|
104
|
|
105
|
public delegate IAstVisitor CreateVisitor(ParserState aState);
|
106
|
|
107
|
public abstract class OoaCompleteAstTraversalVisitor : IAstVisitor
|
108
|
{
|
109
|
protected C5.HashSet<object> m_visited = new C5.HashSet<object>();
|
110
|
protected ParserState m_ParserState;
|
111
|
protected bool m_DuplicateVisit;
|
112
|
|
113
|
protected void VisitSub(IAst subElement, IAst parent)
|
114
|
{
|
115
|
if (subElement == null)
|
116
|
return;
|
117
|
if (m_visited.Contains(subElement))
|
118
|
return;
|
119
|
if (!(subElement is OpaqueType) && !m_DuplicateVisit)
|
120
|
m_visited.Add(subElement);
|
121
|
VisitAstElement(subElement, parent);
|
122
|
}
|
123
|
|
124
|
/// <summary>
|
125
|
/// Is called once per Ast element. Makes sense to override it in a
|
126
|
/// subclass..
|
127
|
/// </summary>
|
128
|
/// <param name="element">to be visited</param>
|
129
|
/// <param name="parent">parent of the element in the ast</param>
|
130
|
protected virtual void VisitAstElement(IAst element, IAst parent)
|
131
|
{
|
132
|
element.Accept(this);
|
133
|
}
|
134
|
|
135
|
public OoaCompleteAstTraversalVisitor(ParserState aState)
|
136
|
{
|
137
|
m_ParserState = aState;
|
138
|
}
|
139
|
|
140
|
public OoaCompleteAstTraversalVisitor(ParserState aState, bool completeTraversal)
|
141
|
: this(aState)
|
142
|
{
|
143
|
m_DuplicateVisit = completeTraversal;
|
144
|
}
|
145
|
|
146
|
public string returnVisitorName()
|
147
|
{
|
148
|
return this.GetType().ToString();
|
149
|
}
|
150
|
|
151
|
public override string ToString()
|
152
|
{
|
153
|
return returnVisitorName();
|
154
|
}
|
155
|
|
156
|
public virtual void visit(EnumIdentifier enumIdentifier)
|
157
|
{
|
158
|
VisitSub(enumIdentifier.type, enumIdentifier);
|
159
|
}
|
160
|
|
161
|
public virtual void visit(ConstantIdentifier constantIdentifier)
|
162
|
{
|
163
|
if (constantIdentifier.type != null)
|
164
|
VisitSub(constantIdentifier.type, constantIdentifier);
|
165
|
VisitSub(constantIdentifier.Value, constantIdentifier);
|
166
|
}
|
167
|
|
168
|
|
169
|
public virtual void visit(LandmarkIdentifier landmarkIdentifier)
|
170
|
{
|
171
|
VisitSub(landmarkIdentifier.type, landmarkIdentifier);
|
172
|
}
|
173
|
|
174
|
public virtual void visit(AttributeIdentifier attributeIdentifier)
|
175
|
{
|
176
|
VisitSub(attributeIdentifier.type, attributeIdentifier);
|
177
|
VisitSub(attributeIdentifier.initializer, attributeIdentifier);
|
178
|
}
|
179
|
|
180
|
public virtual void visit(ExpressionVariableIdentifier expressionVariableIdentifier)
|
181
|
{
|
182
|
VisitSub(expressionVariableIdentifier.type, expressionVariableIdentifier);
|
183
|
}
|
184
|
|
185
|
public virtual void visit(ParameterIdentifier parameterIdentifier)
|
186
|
{
|
187
|
VisitSub(parameterIdentifier.type, parameterIdentifier);
|
188
|
}
|
189
|
|
190
|
public virtual void visit(LocalVariableIdentifier localVariableIdentifier)
|
191
|
{
|
192
|
VisitSub(localVariableIdentifier.type, localVariableIdentifier);
|
193
|
}
|
194
|
|
195
|
public virtual void visit(TypeIdentifier typeIdentifier)
|
196
|
{
|
197
|
VisitSub(typeIdentifier.type, typeIdentifier);
|
198
|
}
|
199
|
|
200
|
public virtual void visit(SelfTypeIdentifier aself)
|
201
|
{
|
202
|
visit((TypeIdentifier)aself);
|
203
|
}
|
204
|
|
205
|
public virtual void visit(MethodIdentifier methodIdentifier)
|
206
|
{
|
207
|
VisitSub(methodIdentifier.type, methodIdentifier);
|
208
|
foreach (var sym in methodIdentifier.symbolTable.symbolList)
|
209
|
VisitSub(sym, methodIdentifier);
|
210
|
foreach (var par in methodIdentifier.parameter)
|
211
|
VisitSub(par, methodIdentifier);
|
212
|
VisitSub(methodIdentifier.body, methodIdentifier);
|
213
|
}
|
214
|
|
215
|
public virtual void visit(NamedActionIdentifier namedActionIdentifier)
|
216
|
{
|
217
|
VisitSub(namedActionIdentifier.type, namedActionIdentifier);
|
218
|
foreach (var sym in namedActionIdentifier.symbolTable.symbolList)
|
219
|
VisitSub(sym, namedActionIdentifier);
|
220
|
foreach (var par in namedActionIdentifier.parameter)
|
221
|
VisitSub(par, namedActionIdentifier);
|
222
|
VisitSub(namedActionIdentifier.body, namedActionIdentifier);
|
223
|
}
|
224
|
|
225
|
public virtual void visit(MainModule mainModule)
|
226
|
{
|
227
|
foreach (var sym in mainModule.symbolTable.symbolList)
|
228
|
VisitSub(sym, mainModule);
|
229
|
bool haveInstance = mainModule.instance != null;
|
230
|
if (haveInstance)
|
231
|
VisitSub(mainModule.instance, mainModule);
|
232
|
else
|
233
|
VisitSub(mainModule.systemDescription, mainModule);
|
234
|
}
|
235
|
|
236
|
public virtual void visit(Module module)
|
237
|
{
|
238
|
foreach (var sym in module.symbolTable.symbolList)
|
239
|
VisitSub(sym, module);
|
240
|
}
|
241
|
|
242
|
public virtual void visit(NondetIdentifierList nondetIdentifierList)
|
243
|
{
|
244
|
foreach (var id in nondetIdentifierList.identifiers)
|
245
|
VisitSub(id, nondetIdentifierList);
|
246
|
}
|
247
|
|
248
|
public virtual void visit(SeqIdentifierList seqIdentifierList)
|
249
|
{
|
250
|
foreach (var id in seqIdentifierList.identifiers)
|
251
|
VisitSub(id, seqIdentifierList);
|
252
|
}
|
253
|
|
254
|
public virtual void visit(PrioIdentifierList prioIdentifierList)
|
255
|
{
|
256
|
foreach (var id in prioIdentifierList.identifiers)
|
257
|
VisitSub(id, prioIdentifierList);
|
258
|
}
|
259
|
|
260
|
public virtual void visit(UnspecIdentifierList unspecIdentifierList)
|
261
|
{
|
262
|
foreach (var id in unspecIdentifierList.identifiers)
|
263
|
VisitSub(id, unspecIdentifierList);
|
264
|
}
|
265
|
|
266
|
public virtual void visit(NondetBlock nondetBlock)
|
267
|
{
|
268
|
foreach (var id in nondetBlock.symbols.symbolList)
|
269
|
VisitSub(id, nondetBlock);
|
270
|
|
271
|
foreach (var stmnt in nondetBlock.statements)
|
272
|
VisitSub(stmnt, nondetBlock);
|
273
|
}
|
274
|
|
275
|
public virtual void visit(SeqBlock seqBlock)
|
276
|
{
|
277
|
foreach (var id in seqBlock.symbols.symbolList)
|
278
|
VisitSub(id, seqBlock);
|
279
|
|
280
|
if (seqBlock.filter != null)
|
281
|
VisitSub(seqBlock.filter, seqBlock);
|
282
|
|
283
|
foreach (var stmnt in seqBlock.statements)
|
284
|
VisitSub(stmnt, seqBlock);
|
285
|
}
|
286
|
|
287
|
public virtual void visit(PrioBlock prioBlock)
|
288
|
{
|
289
|
foreach (var id in prioBlock.symbols.symbolList)
|
290
|
VisitSub(id, prioBlock);
|
291
|
|
292
|
foreach (var stmnt in prioBlock.statements)
|
293
|
VisitSub(stmnt, prioBlock);
|
294
|
}
|
295
|
|
296
|
public virtual void visit(GuardedCommand guardedCommand)
|
297
|
{
|
298
|
VisitSub(guardedCommand.guard, guardedCommand);
|
299
|
VisitSub(guardedCommand.body, guardedCommand);
|
300
|
}
|
301
|
|
302
|
public virtual void visit(Assignment assignment)
|
303
|
{
|
304
|
foreach (var vexp in assignment.places)
|
305
|
VisitSub(vexp, assignment);
|
306
|
foreach (var expr in assignment.values)
|
307
|
VisitSub(expr, assignment);
|
308
|
|
309
|
VisitSub(assignment.nondetExpression, assignment);
|
310
|
}
|
311
|
|
312
|
public virtual void visit(Call call)
|
313
|
{
|
314
|
VisitSub(call.callExpression, call);
|
315
|
}
|
316
|
|
317
|
public virtual void visit(SkipStatement skipStatement)
|
318
|
{ }
|
319
|
|
320
|
public virtual void visit(AbortStatement abortStatement)
|
321
|
{ }
|
322
|
|
323
|
public virtual void visit(KillStatement killStatement)
|
324
|
{
|
325
|
VisitSub(killStatement.someOne, killStatement);
|
326
|
}
|
327
|
|
328
|
public virtual void visit<T>(ValueExpression<T> valueExpression)
|
329
|
{ }
|
330
|
|
331
|
public virtual void visit(UnresolvedIdentifierExpression unresolvedIdentifierExpression)
|
332
|
{
|
333
|
VisitSub(unresolvedIdentifierExpression.type, unresolvedIdentifierExpression);
|
334
|
}
|
335
|
|
336
|
public virtual void visit(IdentifierExpression identifierExpression)
|
337
|
{
|
338
|
VisitSub(identifierExpression.type, identifierExpression);
|
339
|
VisitSub(identifierExpression.identifier, identifierExpression);
|
340
|
}
|
341
|
|
342
|
public virtual void visit(TypeExpression typeExpression)
|
343
|
{
|
344
|
VisitSub(typeExpression.type, typeExpression);
|
345
|
}
|
346
|
|
347
|
public virtual void visit(ListConstructor listConstructor)
|
348
|
{
|
349
|
foreach (var lvar in listConstructor.comprehensionVariables.symbolList)
|
350
|
VisitSub(lvar, listConstructor);
|
351
|
|
352
|
foreach (var elems in listConstructor.elements)
|
353
|
VisitSub(elems, listConstructor);
|
354
|
|
355
|
if (listConstructor.comprehension != null)
|
356
|
VisitSub(listConstructor.comprehension, listConstructor);
|
357
|
}
|
358
|
|
359
|
public virtual void visit(SetConstructor setConstructor)
|
360
|
{
|
361
|
foreach (var svar in setConstructor.comprehensionVariables.symbolList)
|
362
|
VisitSub(svar, setConstructor);
|
363
|
|
364
|
foreach (var elems in setConstructor.items)
|
365
|
VisitSub(elems, setConstructor);
|
366
|
|
367
|
VisitSub(setConstructor.comprehension, setConstructor);
|
368
|
}
|
369
|
|
370
|
public virtual void visit(MapConstructor mapConstructor)
|
371
|
{
|
372
|
/*foreach (var lvar in mapConstructor.localVariables.symbolList)
|
373
|
VisitSub(lvar, mapConstructor);*/
|
374
|
|
375
|
foreach (var elem in mapConstructor.items)
|
376
|
{
|
377
|
VisitSub(elem.key, mapConstructor);
|
378
|
VisitSub(elem.value, mapConstructor);
|
379
|
}
|
380
|
}
|
381
|
|
382
|
public virtual void visit(TupleConstructor tupleConstructor)
|
383
|
{
|
384
|
/*foreach (var lvar in tupleConstructor.localVariables.symbolList)
|
385
|
VisitSub(lvar, tupleConstructor);*/
|
386
|
|
387
|
foreach (var elem in tupleConstructor.values)
|
388
|
VisitSub(elem, tupleConstructor);
|
389
|
}
|
390
|
|
391
|
public virtual void visit(AccessExpression accessExpression)
|
392
|
{
|
393
|
VisitSub(accessExpression.left, accessExpression);
|
394
|
VisitSub(accessExpression.right, accessExpression);
|
395
|
}
|
396
|
|
397
|
public virtual void visit(BinaryOperator binaryOperator)
|
398
|
{
|
399
|
VisitSub(binaryOperator.left, binaryOperator);
|
400
|
VisitSub(binaryOperator.right, binaryOperator);
|
401
|
}
|
402
|
|
403
|
public virtual void visit(TernaryOperator ternaryOperator)
|
404
|
{
|
405
|
VisitSub(ternaryOperator.left, ternaryOperator);
|
406
|
VisitSub(ternaryOperator.mid, ternaryOperator);
|
407
|
VisitSub(ternaryOperator.right, ternaryOperator);
|
408
|
}
|
409
|
|
410
|
public virtual void visit(TupleMapAccessExpression tupleMapAccessExpression)
|
411
|
{
|
412
|
VisitSub(tupleMapAccessExpression.argument, tupleMapAccessExpression);
|
413
|
VisitSub(tupleMapAccessExpression.child, tupleMapAccessExpression);
|
414
|
}
|
415
|
|
416
|
public virtual void visit(CallExpression callExpression)
|
417
|
{
|
418
|
if (callExpression.arguments != null)
|
419
|
foreach (var arg in callExpression.arguments)
|
420
|
VisitSub(arg, callExpression);
|
421
|
VisitSub(callExpression.child, callExpression);
|
422
|
}
|
423
|
|
424
|
public virtual void visit(ForallQuantifier quantifier)
|
425
|
{
|
426
|
foreach (var lvar in quantifier.symbols.symbolList)
|
427
|
VisitSub(lvar, quantifier);
|
428
|
|
429
|
VisitSub(quantifier.child, quantifier);
|
430
|
}
|
431
|
|
432
|
public virtual void visit(ExistsQuantifier quantifier)
|
433
|
{
|
434
|
foreach (var lvar in quantifier.symbols.symbolList)
|
435
|
VisitSub(lvar, quantifier);
|
436
|
|
437
|
VisitSub(quantifier.child, quantifier);
|
438
|
}
|
439
|
|
440
|
public virtual void visit(UnaryOperator unaryOperator)
|
441
|
{
|
442
|
VisitSub(unaryOperator.child, unaryOperator);
|
443
|
if (unaryOperator.kind == ExpressionKind.Cast)
|
444
|
VisitSub(unaryOperator.type, unaryOperator);
|
445
|
}
|
446
|
|
447
|
|
448
|
|
449
|
public virtual void visit(CharType charType)
|
450
|
{
|
451
|
}
|
452
|
|
453
|
public virtual void visit(IntType intType)
|
454
|
{
|
455
|
}
|
456
|
|
457
|
public virtual void visit(BoolType boolType)
|
458
|
{
|
459
|
}
|
460
|
|
461
|
public virtual void visit(FloatType floatType)
|
462
|
{
|
463
|
}
|
464
|
|
465
|
public virtual void visit(EnumType enumType)
|
466
|
{
|
467
|
foreach (var sym in enumType.listOfEnumSymbols)
|
468
|
VisitSub(sym, enumType);
|
469
|
}
|
470
|
|
471
|
public virtual void visit(ListType listType)
|
472
|
{
|
473
|
VisitSub(listType.innerType, listType);
|
474
|
}
|
475
|
|
476
|
public virtual void visit(MapType mapType)
|
477
|
{
|
478
|
VisitSub(mapType.fromType, mapType);
|
479
|
VisitSub(mapType.toType, mapType);
|
480
|
}
|
481
|
|
482
|
public virtual void visit(QrType qrType)
|
483
|
{
|
484
|
foreach (var m in qrType.landmarks)
|
485
|
VisitSub(m, qrType);
|
486
|
}
|
487
|
|
488
|
public virtual void visit(TupleType tupleType)
|
489
|
{
|
490
|
foreach (var t in tupleType.innerTypes)
|
491
|
VisitSub(t, tupleType);
|
492
|
}
|
493
|
|
494
|
public virtual void visit(FunctionType functionType)
|
495
|
{
|
496
|
foreach (var a in functionType.parameter)
|
497
|
VisitSub(a, functionType);
|
498
|
VisitSub(functionType.returnType, functionType);
|
499
|
}
|
500
|
|
501
|
public virtual void visit(OoActionSystemType ooActionSystemType)
|
502
|
{
|
503
|
foreach (var s in ooActionSystemType.symbols.symbolList)
|
504
|
VisitSub(s, ooActionSystemType);
|
505
|
|
506
|
VisitSub(ooActionSystemType.doOdBlock, ooActionSystemType);
|
507
|
}
|
508
|
|
509
|
public virtual void visit(OpaqueType opaqueType)
|
510
|
{
|
511
|
VisitSub(opaqueType.resolvedType, opaqueType);
|
512
|
}
|
513
|
|
514
|
public virtual void visit(NullType nullType)
|
515
|
{ }
|
516
|
|
517
|
public virtual void visit(AnyType anyType)
|
518
|
{ }
|
519
|
|
520
|
public virtual void visit(ObjectConstructor objectConstructor)
|
521
|
{
|
522
|
VisitSub(objectConstructor.type, objectConstructor);
|
523
|
}
|
524
|
|
525
|
public virtual void visit(QValConstructor qValConstructor)
|
526
|
{
|
527
|
}
|
528
|
|
529
|
public virtual void visit(QualitativeConstraintStatement qalitativeConstraintStatement)
|
530
|
{
|
531
|
VisitSub(qalitativeConstraintStatement.variable0, qalitativeConstraintStatement);
|
532
|
VisitSub(qalitativeConstraintStatement.variable1, qalitativeConstraintStatement);
|
533
|
if (qalitativeConstraintStatement.variable2 != null)
|
534
|
VisitSub(qalitativeConstraintStatement.variable2, qalitativeConstraintStatement);
|
535
|
}
|
536
|
|
537
|
}
|
538
|
|
539
|
|
540
|
|
541
|
/// <summary>
|
542
|
/// Visitor that restricts itself to expressions
|
543
|
/// </summary>
|
544
|
public class OoaExpressionVisitor : OoaCompleteAstTraversalVisitor
|
545
|
{
|
546
|
|
547
|
protected override void VisitAstElement(IAst element, IAst parent)
|
548
|
{
|
549
|
// we are only interested in an expression.
|
550
|
if (element.nodeType == AstNodeTypeEnum.expression)
|
551
|
base.VisitAstElement(element, parent);
|
552
|
}
|
553
|
|
554
|
public OoaExpressionVisitor()
|
555
|
: base(null)
|
556
|
{ }
|
557
|
|
558
|
}
|
559
|
|
560
|
/// <summary>
|
561
|
/// Visitor that restricts itself to statements
|
562
|
/// </summary>
|
563
|
public class OoaStatementVisitor : OoaCompleteAstTraversalVisitor
|
564
|
{
|
565
|
protected override void VisitAstElement(IAst element, IAst parent)
|
566
|
{
|
567
|
// we are only interested in an expression.
|
568
|
if (element.nodeType == AstNodeTypeEnum.statement)
|
569
|
base.VisitAstElement(element, parent);
|
570
|
}
|
571
|
|
572
|
public OoaStatementVisitor()
|
573
|
: base(null)
|
574
|
{ }
|
575
|
|
576
|
}
|
577
|
|
578
|
|
579
|
|
580
|
/// <summary>
|
581
|
/// Visitor that restricts itself to types
|
582
|
/// </summary>
|
583
|
public class OoaTypeVisitor : OoaCompleteAstTraversalVisitor
|
584
|
{
|
585
|
protected override void VisitAstElement(IAst element, IAst parent)
|
586
|
{
|
587
|
// we are only interested in an expression.
|
588
|
if (element.nodeType == AstNodeTypeEnum.type)
|
589
|
base.VisitAstElement(element, parent);
|
590
|
}
|
591
|
|
592
|
public OoaTypeVisitor()
|
593
|
: base(null)
|
594
|
{ }
|
595
|
}
|
596
|
|
597
|
|
598
|
/// <summary>
|
599
|
/// Visitor that restricts itself to identifier
|
600
|
/// </summary>
|
601
|
public class OoaIdentifierVisitor : OoaCompleteAstTraversalVisitor
|
602
|
{
|
603
|
protected override void VisitAstElement(IAst element, IAst parent)
|
604
|
{
|
605
|
// we are only interested in an expression.
|
606
|
if (element.nodeType == AstNodeTypeEnum.identifier)
|
607
|
base.VisitAstElement(element, parent);
|
608
|
}
|
609
|
|
610
|
public OoaIdentifierVisitor()
|
611
|
: base(null)
|
612
|
{ }
|
613
|
|
614
|
}
|
615
|
|
616
|
|
617
|
|
618
|
}
|